Why markdown lines pasted from vim to github gets linearized - github

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.

Related

VSCode React/Redux snippets don't work in .jsx files

In one instant my React/Redux snippets broke in .jsx files screenshot.
Everything was working before.
In .js everything is working correctly
screenshot.
Reading the forums, I came across a similar problem, the solution to which was to put a minus prefix before starting to enter the snippet and it worked
screenshot.
The problem is that after opening the snippet, the minus remains in front of it screenshot.
Please help me expand the snippet without the minus prefix in .jsx files.
Update:
When i write only one character it's still work too screenshot.
As soon as i enter the second character, all snippets disappear and in select menu they are missing too screenshot.

How to avoid displaying the leading and trailing spaces in vs code

Attached is the picture where the leading spaces are visible higlighted with red color. How to avoid displaying these whitespaces ? I have tried delete whitespaces extension. On saving the file they again come back.
What you see is changes since the last commit if your code is under version control system like git. Probably when you save your file auto code formatter restore this space according to your code format settings. You can try to disable "Format on save" option in VSCode settings.

When copying from Github the indentation is not preserved

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'

Strange indenting for Java Eclipse project on Github

Everything is good in Eclipse, indenting is fine. Then I put my code on github
and for some reason the indenting was a mess. I am not sure what is going on?
Thanks
If those indentation issues are reflected back in your code after a git push to GitHub, you either have:
a hook removing spaces before tab (as in "Make git automatically remove trailing whitespace before committing")
or a filter content driver declared ina .gitattributes file (as in "Can git automatically switch between spaces and tabs?")
Those are the two automatic mechanisms that could explain a change during the git commit.
But if your code looks fine locally after the git push, but looks not fine on GitHub, then you must have a combination of space and tabs correctly rendered locally, and rendered differently on GitHub.
As mentioned in "Indentation issue using sublime text 2":
The problem is not hard tabs, the problem is mixing spaces and tabs for indentation.
I got this working in eclipse:
Eclipse Settings:
Preferences : Java -> Code Style -> Formatter
Create new profile
Update profile indent settings:
Update Existing Java Source:
(Toolbar) Source : Correct Indentation
Check file, you should see all indentations use spaces, not tabs

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