Andrew Kim
Andrew Kim

Reputation: 3335

vim formatting on github

Ever since I started using vim, some of my files look vastly different on a github view as far as indentation goes. It's the weirdest behavior. I'll open the file in both vim and atom and all the indentations look fine, as soon as i open that same file in github the formatting is all wonky.

Here are some screen shots:

Code in vim:

enter image description here

Code in atom:

enter image description here

Code on github:

enter image description here

Everything I've seen in my google searches about indentation are issues with various plugins and nothing to with this. Any ideas why this is happening? If it helps here's my .vimrc file:

syntax on
set number
set hlsearch
set showcmd
set ignorecase
set smartcase
set splitright
set tabstop=2
set shiftwidth=2
set iskeyword-=_
set autoindent
set smartindent
set scrolloff=999
set syntax=markdown

noremap <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
noremap <C-t> gt

au BufNewFile,BufFilePre,BufRead *.md set filetype=markdown

Upvotes: 1

Views: 76

Answers (1)

jaeheung
jaeheung

Reputation: 1208

Create a file named .editorconfig in your github repo with this contents:

[*]
indent_style = tab
indent_size = 2

Upvotes: 3

Related Questions