silent! execute pathogen#infect() """ DEFAULT VIM SETTINGS " Reload vimrc on save augroup reload_vimrc " { autocmd! autocmd BufWritePost $MYVIMRC source $MYVIMRC augroup END " } let mapleader=" " syntax on filetype plugin indent on " Set colorscheme when the terminal has 256 color support try if (&t_Co == 256) && match($TERM, "256color") >= 0 autocmd ColorScheme janah highlight Normal ctermbg=235 colorscheme janah else throw "nocolor" endif catch colorscheme desert endtry " Some vim settings set number set relativenumber set list set modeline set background=dark set foldmethod=indent set listchars=trail:·,tab:▸\ ,eol:¬ set scrolloff=1 set backspace=indent,eol,start set cursorline " Search-related things set hlsearch "highlight search result set incsearch " incremental search set ignorecase set smartcase " capital letters = case sensitive " Disable ex mode nnoremap Q " Save as sudo cnoremap w!! w !sudo tee > /dev/null % " Remove training spaces on save autocmd BufWritePre * :%s/\s\+$//e " Switch windows with [direction] nnoremap j nnoremap k nnoremap h nnoremap l " Never use the arrow keys inoremap inoremap inoremap inoremap noremap noremap noremap noremap " Append modeline when pressing ml function! AppendModeline() let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') let l:modeline = substitute(&commentstring, "%s", l:modeline, "") call append(line("$"), l:modeline) endfunction nnoremap ml :call AppendModeline() " NeoVIM specifics if has('nvim') nmap h tnoremap autocmd TermOpen * setlocal nolist endif """ PLUGIN SPECIFIC SETTINGS if exists("g:loaded_pathogen") " NERDTree: " Open NERDTree when no file is specified autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif " Airline: " On arch linux install the following: " otf-powerline-symbols-git " powerline-fonts-git let g:airline_powerline_fonts = 1 let g:airline#extensions#tabline#enabled = 1 if !exists('g:airline_symbols') let g:airline_symbols = {} endif let g:airline_symbols.space = "\ua0" set laststatus=2 endif " vim: set ts=8 sw=4 tw=0 et :