When copying from Github the indentation is not preserved - github

I was trying to copy from GitHub the following file: https://github.com/vineodd/PIMSim/blob/master/GEM5Simulation/gem5/configs/common/MemConfig.py
I have tried using git clone, downloading directly from the website and also copying and pasting. I have done this in four different text editors: sublime text, atom, textWrangler and Spyder. In Spyder it gives me the following message:
Contains mixed end-of-line characters.
Every time, when I open the file the indentation is wrong in a lot of places, what is a problem because it is a Python file. You can see it for example in the line 280. In GitHub all appears to be fine. Can I do something to fix this? Has this happened to anyone before? Any help would be appreciated. Thanks in advance!

I have already figured it out what was happening here. The file was combining spaces and tabs for indentation. GitHub displays tabs as 8 columns (spaces), but in the text editors it was equivalent to 4 columns. So to fix it I opened a new file where I just wrote a tab. I copied it and used it to replace all tabs for 8 columns.

If you're using intellij/Android studio, you can 'Paste as Plain Text'

Related

VSCode autocomplete/intellisense(?) in Jupyter Notebook when starting string literals keeps making me accidentally insert 'ArithmeticError' every time

screenshot of the popup code suggestion box being mentioned
In VSCode Jupyter Notebook code cells, I keep having this annoying popup when I open any single or double quotes. It doesn't appear on markdown cells, nor in regular editor on .py files. It doesn't look like your typical IntelliSense suggestions either (I think), and I've tried to disable as many of such extensions as possible, but I'm not able to get rid of this annoying popup.
Appreciate if someone could point me in the right direction. Or at least what it's actually called, so I can Google the correct term. Thanks.
Figured it out.
In VS Code settings, go to Extensions > Jupyter > Python Completion Trigger Characters
defaults were: .%'"
So I deleted the single and double quotes, restarted, and voila, no more annoying popups.

Indentation issue after pushing code from Brackets Editor to Github

For my code I'm using Brackets. In editor, code looks proper but after pushing it to github repository, indentations are messed up.
I'm using tab key to make indentation but in preferences there is set "use 2 spaces" after pressing tab key.
I've find out that Github is using 8 spaces for recognised tab keys. But still, it does not give me anything.
The biggest problem is when I use "one var statement".
I've also used jsbeautifier and it doesn't help me at all.
Here you can find an example: My Github code example
Does anybody had such a problem with brackets and github indentations?
Yes I had such problems.
These problems did not reappear when we moved to eslint inside of our IDE. The setup varies for each IDE. You can refer https://eslint.org/docs/rules/indent
If setting eslint is hard for you. Try bracket extensions like https://github.com/brackets-beautify/brackets-beautify . When used correctly it will beautify on save. Caution: Dont beautify code written by others or a team.

Why markdown lines pasted from vim to github gets linearized

I just started with the github and markdown, created my first README.md.
Edited text in vim and wanted see how it would be previewed in the github. However my line breaks were "deleted" (several lines became one long line).
How can I fix this problem?
This is what I did:
Edited text in vim
> My email(space)(space)
> My name(space)(space)
Pasted text into the github code editor and checked the preview
My text became
> My email(space)> My name
Make sure those two spaces are preserved when you copy uour text from vim to the GitHub editor.
If those spaces are there, then your newline will be preserved in the preview.

Cut and paste from eclipse into MS word appears as large blue blob

This has been bothering me for years. Every time I cut a block of code from a java file in eclipse and paste into a word document, the text just appears as a big block of text. Does anyone know of a way to fix this?
This mostly happens with single line copying. Try copying by including the white-space from the above/bottom line.
Try pasting your code into a basic text editor first, like notepad; it should get rid of any attributes that are coming from where you cut from.
EDIT
See http://office.microsoft.com/en-us/word-help/control-the-formatting-when-you-paste-text-HA010215708.aspx and look for the "Keep Text Only" option.
This is well known problem. It is registered as a Eclipse bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=86503
Unfortunately, for today, this problem is not solved.

Indentation issue using sublime text 2

I have the following problem.
I use ubuntu 12.04 and sublime-text-2 or gedit.
Sometimes i copy/paste something in a haml/ruby file, i indent it at 2 spaces, but when i push it up to github, the indentation is all wrong and not only the part I've copy/pasted. In my editor looks good.
If I open the file with LibreOffice/LeafPad the identation is like on github, but i wanna have it working on ST2.
Any suggestions?
To have correct indent across the service you should not use hard tabs
http://opensourcehacker.com/2012/05/13/never-use-hard-tabs/
You can achieve this functionality in Sublime Text 2 with a tab policy setting:
http://opensourcehacker.com/2012/05/11/sublime-text-2-tips-for-python-and-web-developers/#Configure_sane_tab_and_whitespace_policy_and_other_settings
Also not that you might need to choose new policy for existing files from View > Indentation menu.
You can also mass-convert existing files away from tabs.
With Sublime Text 2:
http://opensourcehacker.com/2012/05/11/sublime-text-2-tips-for-python-and-web-developers/#Converting_existing_files_to_use_spaces_instead_of_tabs
... or batch convert the whole project:
http://miohtama.github.com/vvv/tools/expandtabs.html