" === README START === " My vim configuration. I put all of this in $HOME/.vim. I then make a link " from $HOME/.vim/vimrc to $HOME/.vimrc " " INSTALL: " * mkdir -p ~/.vim/backup " * wget -O ~/.vim/vimrc https://raw.githubusercontent.com/taylor/vimconfig/master/vimrc " * vim +PluginInstall +qall " " TIPS: " "*p to paste from system copy buffer " use ^P/^N in insert mode to complete words " ^] to jump to tags " ^W s,^W v - split windows " gt/gT switching between tabs (or use mappings below) " f / t - jump to next letter or before letter " gv - highlight last visual " gg=G - Indent the whole file ********* " gc - comment " ^c^c - slime " " For trac.vim: " :TWOpen - Open the wiki View " :TWSave "" - Saves the Active Wiki Page " " => \ " => , " " NERDTree and Taglist: " " ,tt will toggle taglist on and off " nmap tt :Tlist " " ,nn will toggle NERDTree on and off " nmap nn :NERDTreeToggle " nmap ,nn :NERDTreeTabsToggle " map n :NERDTreeTabsToggle """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set nocompatible " Install Vundle plugin manager let has_vundle=1 if !filereadable(expand("$HOME/.vim/bundle/Vundle.vim/autoload/vundle.vim")) echo "Installing Vundle..." echo "" if isdirectory(expand('$HOME/.vim/bundle')) == 0 call mkdir(expand('$HOME/.vim/bundle'), 'p') endif execute 'silent !git clone https://github.com/gmarik/Vundle.vim.git "' . expand('$HOME/.vim/bundle/Vundle.vim') . '"' "execute 'silent !git clone https://github.com/gmarik/vundle "' . expand('$HOME/.vim/bundle/vundle') . '"' let has_vundle=0 endif " Use pathogen if installed if filereadable(expand("$HOME/.vim/bundle/vim-pathogen/autoload/pathogen.vim")) source ~/.vim/bundle/vim-pathogen/autoload/pathogen.vim call pathogen#infect() endif filetype off set rtp+=~/.vim/bundle/Vundle.vim/ "call vundle#rc() call vundle#begin() Plugin 'gmarik/Vundle.vim' Plugin 'tpope/vim-pathogen' "" === Utils Plugin 'MarcWeber/vim-addon-mw-utils' Plugin 'taylor/git-grep-vim' Plugin 'rking/ag.vim' " lots of other plugins depend on tlib_vim Plugin 'tomtom/tlib_vim' "" === Development Plugin 'scrooloose/syntastic' Plugin 'vim-ruby/vim-ruby' Plugin 'vim-scripts/matchit.zip' Plugin 'vim-scripts/ruby-matchit' "Plugin 'msanders/snipmate.vim' "Plugin 'garbas/vim-snipmate' "Plugin 'MarcWebe/UltiSnips' Plugin 'SirVer/ultisnips' Plugin 'honza/vim-snippets' Plugin 'BjRo/vim-extest' Plugin 'carlosgaldino/elixir-snippets' "Plugin 'taylor/vim-ixxspec' " run specs in tmux "Plugin 'sunaku/vim-ruby-minitest' "Plugin 'duskhacker/sweet-rspec-vim' "TEMP Plugin 'gregsexton/gitv' " gitk like thing for vim " https://github.com/lord-garbage/tslime.vim Plugin 'lord-garbage/tslime.vim' "Plugin 'actionshrimp/vim-xpath' Plugin 'tomtom/tcomment_vim' "Plugin 'ianremmler/comment' " Code comments "Plugin 'scrooloose/nerdcommenter' "Plugin 'sukima/xmledit' Plugin 'vim-scripts/Align' " Git Plugin 'tpope/vim-fugitive' "" === Syntax "TEMP Plugin 'tpope/vim-cucumber' " cucumber syntax "TEMP Plugin 'taylor/vim-mswebdev' " ms web dev syntax crap "Plugin 'mjwall/clj-vim' "Plugin 'elixir-lang/vim-elixir' "Plugin 'heartsentwined/vim-ember-script' Plugin 'httplog' "" === Color schemes "colors-bnelson-less -- UNKNOWN Plugin 'rking/vim-detailed' "Plugin 'git@bitbucket.org:kisom/eink.vim.git' Plugin 'chmllr/vim-colorscheme-elrodeo' Plugin 'ianremmler/frood' Plugin 'nielsmadan/harlequin' "colors-ixxcolors -- UNKNOWN "colors-lettuce -- UNKNOWN Plugin 'plynch/maltese' "colors-misc -- UNKNOWN "colors-smyck -- UNKNOWN Plugin 'altercation/vim-colors-solarized' "colors-syntaxless-kyle -- UNKNOWN Plugin 'tir_black' Plugin 'nanotech/jellybeans.vim' "colors-vayn-schemes -- UNKNOWN Plugin 'taylor/colors-misc.vim' " More look and feel "Plugin 'Lokaltog/vim-powerline' Plugin 'itchyny/lightline.vim' Plugin 'itchyny/landscape.vim' "" === Pairing "mail-notmuch -- UNKNOWN "misc-taylor -- UNKNOWN "syntax-tmux -- UNKNOWN "utils-conque_2.3 -- UNKNOWN " Extra functionality "" readline key bindings: Plugin 'tpope/vim-rsi' " auto-completion everywhere Plugin 'Valloric/YouCompleteMe' Plugin 'taylor/vim-zoomwin' "Plugin 'maba/vim-markdown-preview' Plugin 'kien/ctrlp.vim' "utils-fuzzyfinder -- UNKNOWN Plugin 'mattn/gist-vim' " directory browser side-bar Plugin 'scrooloose/nerdtree' Plugin 'jistr/vim-nerdtree-tabs' "Plugin 'nixternal/taskwarrior-vim' "Plugin 'vim-scripts/Conque-Shell' "utils-l9 -- UNKNOWN "utils-tracwiki -- UNKNOWN Plugin 'http://repo.or.cz/r/vcscommand.git' "Plugin 'nsmgr8/vitra' "-- Trac UI "Plugin 'mattn/webapi-vim' "-- used by gist, vitra, etc Plugin 'mattn/webapi-vim' Plugin 'smerrill/vagrant-vim' Plugin 'expelledboy/vim-erl-mode' "Plugin 'tpope/vim-five' Plugin 'taq/vim-git-branch-info' Plugin 'git://gitorious.org/vim-gnupg/vim-gnupg.git' "vim-pandoc -- Plugin 'taylor/taglist.vim' "" Experimenting: " See testingstuff.vim if filereadable(expand("$HOME/.vim/testingstuff-plugins.vim")) source ~/.vim/testingstuff-plugins.vim endif " press - to open a dir listing, press again to go up a dir Plugin 'dhruvasagar/vim-vinegar' call vundle#end() if has_vundle == 0 echo "Installing Plugins, please ignore key map error messages" echo "" :PluginInstall endif "" === Plugins not available on github or else where "" NOTE: made a copy at https://github.com/taylor/taglist.vim " taglist.vim - http://www.vim.org/scripts/script.php?script_id=273 " let taglist_url = "http://vim.sourceforge.net/scripts/download_script.php?src_id=19573" " if !filereadable(expand("$HOME/.vim/bundle/taglist/plugin/taglist.vim")) " echo "Installing taglist.vim" " execute 'silent !mkdir -p "' . expand("$HOME/.vim/bundle/taglist/") . '"' " execute 'silent !wget -O $HOME/.vim/taglist.zip "' . taglist_url . '"' " execute 'silent !unzip taglist.zip -d "' . expand("$HOME/.vim/bundle/taglist/") . '"' " endif "Don't run Sy by default. You can toggle it anytime via :SignifyToggle. let g:signify_disable_by_default = 1 let g:signify_vcs_list = [ 'git' ] """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set nocompatible syntax on filetype on " Enable filetype detection filetype indent on " Enable filetype-specific indenting filetype plugin on " Enable filetype-specific plugins xnoremap p p:let @"=@0 " keep the copied text ready to paste again when pasting in visual mode instead of copying the newly replaced text "xnoremap p (v:register == '"') ? '"0p' : 'p' " only paste from 0 register if default register is used. NOTE: if delete is used pasting from 1 is required set scrolloff=3 " lines above/below cursor "set mouse=n "set clipboard+=unnamed " Yanks go on clipboard instead. set timeoutlen=450 " Time to wait after ESC (default causes an annoying delay) " first the disabled features due to security concerns set modelines=0 " no modelines [http://www.guninski.com/vim1.html] let g:secure_modelines_verbose=0 " securemodelines vimscript let g:secure_modelines_modelines = 15 " 15 available modelines " Gist should be private/secret (-p) by default. -P is public let g:gist_post_private = 1 set splitbelow " split below w/focus set splitright " split right w/focus set history=1000 set ruler " show the cursor position all the time set showcmd " display incomplete commands set incsearch " do incremental searching "set nu " line numbers set backspace=indent,eol,start set noerrorbells set visualbell t_vb= " Disable ALL bells " xterm title set title " convert tabs to spaces. indent level is 2 " filetype plugin indent on set ts=2 set sw=2 set et set showfulltag " show full completion tags "set wildignore+=*.o,*~,.lo " ignore object files "set wildmode=longest:full "set wildmenu " menu has tab completion "set complete=.,w,b,u,U,t,i,d " do lots of scanning on tab completion set ttyfast set dictionary=/usr/share/dict/words if has("vms") set nobackup " do not keep a backup file, use versions instead else set backup " keep a backup file set backupdir=~/.vim/backup endif " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") set hlsearch endif " Ctrl-/ will turn off highlight (until next search) map  :noh " toggle paste set pastetoggle= "nmap P :set invpaste "imap P :set invpaste "nmap :set invpaste "imap :set invpaste " Move faster map map " v one char, vv to get a word, vvv to get paragraph vmap v (expand_region_expand) vmap (expand_region_shrink) " set background=dark if $TERM =~ '256' set t_Co=256 if has("gui_running") set mousehide " Hide mouse after chars typed set cursorline let g:solarized_termcolors=256 set guioptions-=T " no toolbar colorscheme solarized map "*p " paste with middle button set nu " it always looks fine in macvim set lines=40 set columns=140 else colorscheme landscape end elseif $TERM =~ '^xterm-' set t_Co=16 colorscheme landscape elseif $TERM =~ '^xterm$' set t_Co=8 colorscheme frood endif "autocmd InsertEnter * set cul cuc "autocmd InsertLeave * set nocul nocuc "autocmd FocusGained * set cul cuc "autocmd FocusLost * set nocul nocuc " If I forgot to sudo vim a file, do that with :w!! cmap w!! %!sudo tee > /dev/null % "noremap :w "imap :w "noremap :!ruby % "map r :!ruby % "Buffer next,previous (ctrl-{n,p}) "noremap  :bn "noremap  :bp ""netrw stuff "" http://mysite.verizon.net/astronaut/vim/index.html#NETRW "" "let g:netrw_altv = 1 "let g:netrw_fastbrowse = 2 "let g:netrw_keepdir = 0 "let g:netrw_liststyle = 2 "let g:netrw_retmap = 1 "let g:netrw_silent = 1 "let g:netrw_special_syntax= 1 " Don't use Ex mode, use Q for formatting map Q gq let maplocalleader = "," " Make ',e' (in normal mode) give a prompt for opening files " " in the same dir as the current buffer's file. if has("unix") map e :e =expand("%:p:h") . "/" " For emacs map d :e =expand("%:p:h") . "/" else map e :e =expand("%:p:h") . "\\" endif let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude=vendor/ --exclude-standard', 'find %s -type f'] let g:ctrlp_use_caching = 0 " "" More emacs " map 2 :split " map 3 :vsplit " " map 0 :close " map 1 :only " vim trac plugin let g:tracServerList = {} if filereadable(expand("$HOME/.vim/tracserverlist")) source ~/.vim/tracserverlist endif " --------------------------------------------------------------------------- " tabs " (LocalLeader is ",") map tc :tabnew " create a new tab map tC :tabnew % " create a new tab "map td :tabclose " close a tab map tq :tabclose " close a tab map tn :tabnext " next tab map tp :tabprev " previous tab map tm :tabmove " move a tab to a new location " " fuzzy finder textmate " if has("ruby") " "map f :FuzzyFinderTextMate " map f :FufFile " " " Autocomplete " autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete " autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1 " autocmd FileType ruby,eruby let g:rubycomplete_rails = 1 " autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1 " "improve autocomplete menu color " highlight Pmenu ctermbg=238 gui=bold " else " map f :FuzzyFinderFile " end " " " BufExplorer " map bb :BufExplorer " " --------------------------------------------------------------------------- " configuration for fuzzyfinder " find in buffer is ,fb " nmap fb :FuzzyFinderBuffer " " find in file is ,ff " nmap ff :FufFileWithCurrentBufferDir " "nmap ff :FufFile " "nmap ff :FuzzyFinderFile " " find in tag is ,ft " nmap ft :FufBufferTag "nmap ft :FuzzyFinderTag " --------------------------------------------------------------------------- " Settings for gist.vim if has("mac") let g:gist_clip_command = 'pbcopy' else let g:gist_clip_command = 'xclip' end let g:gist_detect_filetype = 1 " --------------------------------------------------------------------------- " Settings for taglist.vim let Tlist_Use_Right_Window=1 let Tlist_Auto_Open=0 let Tlist_Enable_Fold_Column=0 let Tlist_Compact_Format=0 let Tlist_WinWidth=28 let Tlist_Exit_OnlyWindow=1 let Tlist_File_Fold_Auto_Close = 1 map Tf :ExTestRunFile map Tm :ExTestRunMethod map Tl :ExTestRunLast let g:extest_exunit_run_file_cmd = "mix test '%f'" let g:extest_exunit_run_test_cmd = "mix test '%f'" "let g:extest_amrita_run_file_cmd = "mix amrita '%f'" "let g:extest_amrita_run_test_cmd = "mix amrita '%f:%l'" if version >= 700 let NERDTreeIgnore=['\~$', '^\.git', '\.swp$', '\.DS_Store$'] let NERDTreeShowHidden=1 " ,tt will toggle taglist on and off nmap tt :Tlist " ,nn will toggle NERDTree on and off nmap nn :NERDTreeTabsToggle nmap ,nn :NERDTreeTabsToggle "map n :NERDTreeTabsToggle end let NERDTreeHijackNetrw=1 "let g:ConqueTerm_ReadUnfocused = 1 "nmap zz :ZoomWin "nmap z :ZoomWin compiler ruby "compiler python "For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries "let &guioptions = substitute(&guioptions, "t", "", "g") " This is an alternative that also works in block mode, but the deleted " text is lost and it only works for putting the current register. "vnoremap p "_dp " map mp :Mm " Markdown -- added *.md, because I do not care about modula2 augroup mkd autocmd BufRead *.mkd,*.md,*.markdown set ai formatoptions=tcroqn2 comments=n:> ft=markdown augroup END "set cinoptions=:0,p0,t0 "set cinwords=if,else,while,do,for,switch,case " Only do this part when compiled with support for autocommands. if has("autocmd") " Enable file type detection. " Use the default filetype settings, so that mail gets 'tw' set to 72, " 'cindent' is on in C files, etc. " Also load indent files, to automatically do language-dependent indenting. filetype plugin indent on " Put these in an autocmd group, so that we can delete them easily. augroup vimrcEx au! " For all text files set 'textwidth' to 78 characters. autocmd FileType text setlocal textwidth=78 " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif augroup END else set autoindent " always set autoindenting on endif " has("autocmd") " Don't write backup file for some files au BufWrite /private/tmp/crontab.*,/tmp/crontab.*,/dev/shm/* set nowritebackup nobackup " We don't want a swap file and backup for these "private" files autocmd BufReadPre,FileReadPre,BufWrite *encrypted*,*credentials*,*authinfo*,.authinfo*,*pass,pass,pass.*,*private*,.chef/*,~/.mutt/private/*,~/.vim/tracserverlist set viminfo= nowritebackup nobackup noswapfile " set up syntax highlighting for my e-mail au BufRead,BufNewFile .followup,.article,.letter,/tmp/pico*,nn.*,snd.*,/tmp/mutt*,sup.* :set ft=mail " VimClojure let vimclojure#HighlightBuiltins = 1 let vimclojure#ParenRainbow = 1 set tags+=gems.tags " spell checking " text & mutt files au BufNewFile,BufRead /tmp/mutt*,/tmp/cvs*,*.txt set tw=72 noai noshowmatch au BufNewFile,BufRead /tmp/mutt*,/tmp/cvs*,*.txt setlocal spell spelllang=en_us au BufNewFile,BufRead /tmp/mutt*,/tmp/cvs*,*.txt syntax off " git commits au BufNewFile,BufRead *.git/COMMIT_EDITMSG set tw=72 noai noshowmatch au BufNewFile,BufRead *.git/COMMIT_EDITMSG setlocal spell spelllang=en_us " Elixir eex files until they fix syntax au BufNewFile,BufRead *.eex set ft=html autocmd BufWinEnter * if line2byte(line("$") + 1) > 1000000 | syntax clear | endif set foldlevelstart=99 "noremap  :bn "noremap  :bp " Download statusline config if !filereadable(expand("$HOME/.vim/vimrc-statusline")) echo "Installing statuline config..." echo "" execute 'silent !curl -kqs -o "' . expand('$HOME/.vim/vimrc-statusline') . '" https://raw.githubusercontent.com/taylor/vimconfig/master/vimrc-statusline' endif if filereadable(expand("$HOME/.vim/vimrc-statusline")) so ~/.vim/vimrc-statusline endif "Plugin 'bling/vim-airline' if filereadable(expand("$HOME/.vim/testingstuff.vim")) echo "" echo "Looking like we have some test vim plugins to playwith in testingstuff.vim..." echo "" so ~/.vim/testingstuff.vim endif