From a2df6e51f4a091cb6fdbb938e03a03511d13c908 Mon Sep 17 00:00:00 2001 From: Jelle Helsen Date: Sun, 1 Sep 2013 20:37:18 +0200 Subject: [PATCH] cleanup --- vimrc | 340 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 183 insertions(+), 157 deletions(-) diff --git a/vimrc b/vimrc index 4196e24..754db2d 100644 --- a/vimrc +++ b/vimrc @@ -1,3 +1,5 @@ +" vim: set sw=4 ts=4 sts=4 et tw=78 foldmarker={,} foldlevel=0 foldmethod=marker spell: + set nocompatible " Be iMproved if has('vim_starting') @@ -13,49 +15,52 @@ NeoBundleFetch 'Shougo/neobundle.vim' " After install, turn shell ~/.vim/bundle/vimproc, (n,g)make -f your_machines_makefile NeoBundle 'Shougo/vimproc' -NeoBundle 'altercation/vim-colors-solarized' -NeoBundle 'spf13/vim-colors' -NeoBundle 'tpope/vim-surround' -NeoBundle 'spf13/vim-autoclose' -NeoBundle 'kien/ctrlp.vim' -NeoBundle 'myusuf3/numbers.vim' -NeoBundle 'tpope/vim-fugitive' -NeoBundle 'Lokaltog/vim-easymotion' -NeoBundle 'rails.vim' -NeoBundle 'scrooloose/syntastic' -NeoBundle 'tpope/vim-fugitive' -NeoBundle 'mattn/webapi-vim' -NeoBundle 'mattn/gist-vim' -NeoBundle 'scrooloose/nerdcommenter' -NeoBundle 'godlygeek/tabular' -if executable('ctags') - NeoBundle 'majutsushi/tagbar' -endif -NeoBundle 'Shougo/neocomplete.vim' -NeoBundle 'Shougo/neosnippet' -NeoBundle 'elzr/vim-json' -NeoBundle 'groenewege/vim-less' -NeoBundle 'pangloss/vim-javascript' -NeoBundle 'briancollins/vim-jst' -NeoBundle 'kchmck/vim-coffee-script' -NeoBundle 'airblade/vim-gitgutter' - -" HTML -NeoBundle 'amirh/HTML-AutoCloseTag' -NeoBundle 'hail2u/vim-css3-syntax' -NeoBundle 'tpope/vim-haml' - -" Ruby -NeoBundle 'tpope/vim-rails' -let g:rubycomplete_buffer_loading = 1 -"let g:rubycomplete_classes_in_global = 1 -"let g:rubycomplete_rails = 1 - -NeoBundle 'tpope/vim-markdown' -NeoBundle 'spf13/vim-preview' -NeoBundle 'tpope/vim-cucumber' -NeoBundle 'quentindecock/vim-cucumber-align-pipes' -NeoBundle 'Puppet-Syntax-Highlighting' +" Bundles { + NeoBundle 'altercation/vim-colors-solarized' + NeoBundle 'spf13/vim-colors' + NeoBundle 'tpope/vim-surround' + NeoBundle 'spf13/vim-autoclose' + NeoBundle 'kien/ctrlp.vim' + NeoBundle 'myusuf3/numbers.vim' + NeoBundle 'tpope/vim-fugitive' + NeoBundle 'Lokaltog/vim-easymotion' + NeoBundle 'rails.vim' + NeoBundle 'scrooloose/syntastic' + NeoBundle 'tpope/vim-fugitive' + NeoBundle 'mattn/webapi-vim' + NeoBundle 'mattn/gist-vim' + NeoBundle 'scrooloose/nerdcommenter' + NeoBundle 'godlygeek/tabular' + if executable('ctags') + NeoBundle 'majutsushi/tagbar' + endif + NeoBundle 'Shougo/neocomplete.vim' + NeoBundle 'Shougo/neosnippet' + NeoBundle 'elzr/vim-json' + NeoBundle 'groenewege/vim-less' + NeoBundle 'pangloss/vim-javascript' + NeoBundle 'briancollins/vim-jst' + NeoBundle 'kchmck/vim-coffee-script' + NeoBundle 'airblade/vim-gitgutter' + + " HTML + NeoBundle 'amirh/HTML-AutoCloseTag' + NeoBundle 'hail2u/vim-css3-syntax' + NeoBundle 'tpope/vim-haml' + + " Ruby + NeoBundle 'tpope/vim-rails' + let g:rubycomplete_buffer_loading = 1 + "let g:rubycomplete_classes_in_global = 1 + "let g:rubycomplete_rails = 1 + + NeoBundle 'tpope/vim-markdown' + NeoBundle 'spf13/vim-preview' + NeoBundle 'tpope/vim-cucumber' + NeoBundle 'quentindecock/vim-cucumber-align-pipes' + NeoBundle 'Puppet-Syntax-Highlighting' + +" }" set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter') @@ -63,51 +68,54 @@ filetype plugin indent on filetype plugin on NeoBundleCheck -let mapleader = ',' -set expandtab -set shiftwidth=2 -set softtabstop=2 -set nu -syntax on - -" Snippets " -" Plugin key-mappings. -imap (neosnippet_expand_or_jump) -smap (neosnippet_expand_or_jump) -xmap (neosnippet_expand_target) - -" SuperTab like snippets behavior. -imap neosnippet#expandable_or_jumpable() ? - \ "\(neosnippet_expand_or_jump)" - \: pumvisible() ? "\" : "\" -smap neosnippet#expandable_or_jumpable() ? - \ "\(neosnippet_expand_or_jump)" - \: "\" - -" For snippet_complete marker. -if has('conceal') - set conceallevel=2 concealcursor=i -endif - -if has('cmdline_info') - set ruler " Show the ruler - set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " A ruler on steroids - set showcmd " Show partial commands in status line and - " Selected characters/lines in visual mode -endif - -if has('statusline') - set laststatus=2 - " Broken down into easily includeable segments - set statusline=%<%f\ " Filename - set statusline+=%w%h%m%r " Options - set statusline+=%{fugitive#statusline()} " Git Hotness - set statusline+=\ [%{&ff}/%Y] " Filetype - set statusline+=\ [%{getcwd()}] " Current dir - set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info -endif +" General config { + let mapleader = ',' + set expandtab + set shiftwidth=2 + set softtabstop=2 + set nu + syntax on + + if has('cmdline_info') + set ruler " Show the ruler + set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " A ruler on steroids + set showcmd " Show partial commands in status line and + " Selected characters/lines in visual mode + endif + + if has('statusline') + set laststatus=2 + " Broken down into easily includeable segments + set statusline=%<%f\ " Filename + set statusline+=%w%h%m%r " Options + set statusline+=%{fugitive#statusline()} " Git Hotness + set statusline+=\ [%{&ff}/%Y] " Filetype + set statusline+=\ [%{getcwd()}] " Current dir + set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info + endif + + " Window movements" + map j_ + map k_ + map l_ + map h_ + + if has("user_commands") + command! -bang -nargs=* -complete=file E e + command! -bang -nargs=* -complete=file W w + command! -bang -nargs=* -complete=file Wq wq + command! -bang -nargs=* -complete=file WQ wq + command! -bang Wa wa + command! -bang WA wa + command! -bang Q q + command! -bang QA qa + command! -bang Qa qa + endif + + "Yank to end of line" + nnoremap Y y$ -" Formatting { + " Formatting { set nowrap " Wrap long lines set autoindent " Indent at the same level of the previous line @@ -135,89 +143,75 @@ endif " Workaround broken colour highlighting in Haskell autocmd FileType haskell setlocal nospell -" } - -map j_ -map k_ -map l_ -map h_ - -if has("user_commands") - command! -bang -nargs=* -complete=file E e - command! -bang -nargs=* -complete=file W w - command! -bang -nargs=* -complete=file Wq wq - command! -bang -nargs=* -complete=file WQ wq - command! -bang Wa wa - command! -bang WA wa - command! -bang Q q - command! -bang QA qa - command! -bang Qa qa -endif - -nnoremap Y y$ - -" Code folding options -nmap f0 :set foldlevel=0 -nmap f1 :set foldlevel=1 -nmap f2 :set foldlevel=2 -nmap f3 :set foldlevel=3 -nmap f4 :set foldlevel=4 -nmap f5 :set foldlevel=5 -nmap f6 :set foldlevel=6 -nmap f7 :set foldlevel=7 -nmap f8 :set foldlevel=8 -nmap f9 :set foldlevel=9 + " } + + " Code folding options { + " + nmap f0 :set foldlevel=0 + nmap f1 :set foldlevel=1 + nmap f2 :set foldlevel=2 + nmap f3 :set foldlevel=3 + nmap f4 :set foldlevel=4 + nmap f5 :set foldlevel=5 + nmap f6 :set foldlevel=6 + nmap f7 :set foldlevel=7 + nmap f8 :set foldlevel=8 + nmap f9 :set foldlevel=9 + " } -" Toggle search highlighting -nmap / :set invhlsearch + " Toggle search highlighting { + nmap / :set invhlsearch + " }" -" Find merge conflict markers -map fc /\v^[<\|=>]{7}( .*\|$) + " Find merge conflict markers { + map fc /\v^[<\|=>]{7}( .*\|$) + " }" -" Shortcuts -" Change Working Directory to that of the current file -cmap cwd lcd %:p:h -cmap cd. lcd %:p:h + " Shortcuts + " Change Working Directory to that of the current file + cmap cwd lcd %:p:h + cmap cd. lcd %:p:h -" Visual shifting (does not exit Visual mode) -vnoremap < >gv + " Visual shifting (does not exit Visual mode) + vnoremap < >gv -" Allow using the repeat operator with a visual selection (!) -" http://stackoverflow.com/a/8064607/127816 -vnoremap . :normal . + " Allow using the repeat operator with a visual selection (!) + " http://stackoverflow.com/a/8064607/127816 + vnoremap . :normal . -" Fix home and end keybindings for screen, particularly on mac -" - for some reason this fixes the arrow keys too. huh. -map  $ -imap  $ -map  g0 -imap  g0 + " Fix home and end keybindings for screen, particularly on mac + " - for some reason this fixes the arrow keys too. huh. + map  $ + imap  $ + map  g0 + imap  g0 -" For when you forget to sudo.. Really Write the file. -cmap w!! w !sudo tee % >/dev/null + " For when you forget to sudo.. Really Write the file. + cmap w!! w !sudo tee % >/dev/null -" Some helpers to edit mode -" http://vimcasts.org/e/14 -cnoremap %% =expand('%:h').'/' -map ew :e %% -map es :sp %% -map ev :vsp %% -map et :tabe %% + " Some helpers to edit mode + " http://vimcasts.org/e/14 + cnoremap %% =expand('%:h').'/' + map ew :e %% + map es :sp %% + map ev :vsp %% + map et :tabe %% -" Adjust viewports to the same size -map = = + " Adjust viewports to the same size + map = = -" Map ff to display all lines with keyword under cursor -" and ask which one to jump to -nmap ff [I:let nr = input("Which one: ")exe "normal " . nr ."[\t" + " Map ff to display all lines with keyword under cursor + " and ask which one to jump to + nmap ff [I:let nr = input("Which one: ")exe "normal " . nr ."[\t" -" Easier horizontal scrolling -map zl zL -map zh zH + " Easier horizontal scrolling + map zl zL + map zh zH -" } +" }" +"}" " Plugins { " Misc { @@ -250,6 +244,26 @@ map zh zH set completeopt=menu,preview,longest " } + " NeoComplete { + " Snippets " + " Plugin key-mappings. + imap (neosnippet_expand_or_jump) + smap (neosnippet_expand_or_jump) + xmap (neosnippet_expand_target) + + " SuperTab like snippets behavior. + imap neosnippet#expandable_or_jumpable() ? + \ "\(neosnippet_expand_or_jump)" + \: pumvisible() ? "\" : "\" + smap neosnippet#expandable_or_jumpable() ? + \ "\(neosnippet_expand_or_jump)" + \: "\" + + " For snippet_complete marker. + if has('conceal') + set conceallevel=2 concealcursor=i + endif + " }" " Ctags { set tags=./tags;/,~/.vimtags @@ -435,3 +449,15 @@ map zh zH let g:gitgutter_realtime = 0 " } "} +" +set winwidth=84 +" We have to have a winheight bigger than we want to set winminheight. But if +" we set winheight to be huge before winminheight, the winminheight set will +" fail. +set winheight=5 +set winminheight=5 +set winheight=999 +" " +map gr :topleft :split config/routes.rb +map gg :topleft 100 :split Gemfile +