Skip to content

Instantly share code, notes, and snippets.

@Davidslv
Last active December 11, 2015 04:48
Show Gist options
  • Save Davidslv/4547232 to your computer and use it in GitHub Desktop.
Save Davidslv/4547232 to your computer and use it in GitHub Desktop.
My Vim configuration
" https://github.com/tpope/vim-pathogen
call pathogen#infect()
syntax on
set number
set expandtab " no real tabs
set softtabstop=2
set tabstop=4
" make backspace work normally
set backspace=indent,eol,start
"###################################################
"# http://amix.dk/vim/vimrc.html
"###################################################
" Sets how many lines of history VIM has to remember
set history=700
"Always show current position
set ruler
" Configure backspace so it acts as it should act
" set backspace=eol,start,indent
" set whichwrap+=<,>,h,l
" Highlight search results
set hlsearch
" For regular expressions turn magic on
set magic
" No annoying sound on errors
" set noerrorbells
" set novisualbell
" set t_vb=
" set tm=500
"###################################################
"# NERDTREE
"# http://kennedysgarage.com/articles/nerdtree
"###################################################
"Show hidden files in NerdTree
let NERDTreeShowHidden=1
" Enable NERDTree plugin
autocmd VimEnter * NERDTree
filetype plugin indent on
" Close NERDTree, then vim
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
" Close all open buffers on entering a window if the only
" buffer that's left is the NERDTree buffer
function! s:CloseIfOnlyNerdTreeLeft()
if exists("t:NERDTreeBufName")
if bufwinnr(t:NERDTreeBufName) != -1
if winnr("$") == 1
q
endif
endif
endif
endfunction
" Close all open buffers on entering a window if the only
" buffer that's left is the NERDTree buffer
"autopen NERDTree and focus cursor in new document
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment