" Environment { " Basics { set nocompatible " Must be first line " } " Windows Compatible { " On Windows, also use '.vim' instead of 'vimfiles'; this makes synchronization " across (heterogeneous) systems easier. if has('win32') || has('win64') set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after source $VIMRUNTIME/mswin.vim endif " Vundle " source C:/projects/dotfiles/vim/vundle.vim " } syntax enable " key mappings { let mapleader = "," "Saves time; maps the spacebar to colon nmap : "Shortcut for editing vimrc file in a new tab nmap ev :tabedit $MYVIMRC "fix line endings nnoremap ed :e ++ff=dos "make Y behave like other commands nnoremap Y y$ "fast paste yank register nnoremap s "0P "navigate by row nnoremap j gj nnoremap k gk nnoremap s :Ack '' "paste default buffer on newline and autoindent nnoremap v o" "remove trailing whitespace nnoremap w :%s/\s\+$//e " navigate tabs like most editors " just another reason to love nnoremap :tabprevious nnoremap :tabnext " nnoremap J :tabprevious " nnoremap K :tabnext "quick save and quit "nnoremap s :wq nnoremap :noh nnoremap % vnoremap % " Switch between the last two files nnoremap " NERDTree settings {{{ " Put focus to the NERD Tree with F3 (tricked by quickly closing it and " immediately showing it again, since there is no :NERDTreeFocus command) nnoremap n :NERDTreeClose:NERDTreeToggle nnoremap m :NERDTreeClose:NERDTreeFind nnoremap N :NERDTreeClose " Quicker window movement nnoremap j nnoremap k nnoremap h nnoremap l map :NERDTreeToggle " } "show line and column number on bottom of screen set ruler " Open new split panes to right and bottom, which feels more natural set splitbelow set splitright nnoremap / /\v vnoremap / /\v set ignorecase set smartcase set gdefault " search/replace 'globally' (on a line) by default set incsearch set showmatch set hlsearch set relativenumber set number set undofile set nomodeline " disable mode lines (security measure) "turn on spell ckecking and wrap lines for git commit msgs autocmd Filetype gitcommit setlocal spell textwidth=72 " for enabling block cursor in conemu let &t_ti.="\e[1 q" let &t_SI.="\e[5 q" let &t_EI.="\e[1 q" let &t_te.="\e[0 q" " Formatting { " set nowrap " Wrap long lines set autoindent " Indent at the same level of the previous line set shiftwidth=2 " Use indents of 4 spaces set expandtab " Tabs are spaces, not tabs set tabstop=2 " An indentation every four columns set softtabstop=2 " Let backspace delete indent iabbrev cpa Cherry pick PR #123 for iEF- "don't treat - as a word separator "especially handy when working html classes and ids set iskeyword+=- " set lisp "set matchpairs+=<:> " Match, to be used with % " set pastetoggle= " pastetoggle (sane indentation on pastes) "set comments=sl:/*,mb:*,elx:*/ " auto format comment blocks " Remove trailing whitespaces and ^M chars " autocmd FileType c,cpp,java,php,javascript,python,twig,xml,yml autocmd BufWritePre call StripTrailingWhitespace() " autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig " } " Backups files set backupdir=~/.vim/backup// " backups set directory=~/.vim/swap// " swap files set undodir=~/.vim/undo// set backup " enable backup " Set syntax highlighting for specific file types autocmd BufRead,BufNewFile *.md set filetype=markdown autocmd BufRead,BufNewFile *.markdown set filetype=markdown " Enable spellchecking for Markdown autocmd BufRead,BufNewFile *.md setlocal spell " Automatically wrap at 80 characters for Markdown autocmd BufRead,BufNewFile *.md setlocal textwidth=80 autocmd BufRead,BufNewFile *.markdown setlocal textwidth=80