update and comment vimrc

This commit is contained in:
Barak Michener 2013-04-12 17:27:10 -04:00
parent a50d01abd6
commit 0495d974c3
6 changed files with 160 additions and 130 deletions

@ -1 +1 @@
Subproject commit c504654f37adbeeebc31796eea3ba828429dfb40
Subproject commit 6118864a4d84521028e8079317f838cef1c32869

@ -1 +1 @@
Subproject commit 40d05ace57fb51cc2c2b2e9eb81c4832ed291630
Subproject commit 9a341ec18f631e58398350cc9665b8ec4d50954d

@ -1 +1 @@
Subproject commit 78f345bab3865159596ffeeaaffd580e82716edd
Subproject commit 51001b66de7d9a0a6f20acd843a24fdb82bdaf2c

@ -1 +1 @@
Subproject commit 989ad9b0fba141806175248f30c383957bfd89df
Subproject commit 25d428c3900d8f45d2b3f771a734033fb0104262

View file

@ -45,24 +45,24 @@ au BufRead,BufNewFile *.go set filetype=go
"Settings per filetype
augroup python
"autocmd FileType python set omnifunc=pythoncomplete#Complete
"autocmd FileType python call SuperTabSetCompletionType("<C-X><C-O>")
"autocmd FileType python set completeopt-=preview
autocmd FileType python set ts=4
autocmd FileType python set softtabstop=4
autocmd FileType python set shiftwidth=4
autocmd FileType python set expandtab
autocmd FileType python set nosmartindent
autocmd FileType python let b:auto_trim_whitespace=1
augroup END
augroup javascript
autocmd FileType javascript set ts=4
autocmd FileType javascript set softtabstop=4
autocmd FileType javascript set shiftwidth=4
autocmd FileType javascript set expandtab
autocmd FileType javascript let b:auto_trim_whitespace=1
augroup END
"augroup python
""autocmd FileType python set omnifunc=pythoncomplete#Complete
""autocmd FileType python call SuperTabSetCompletionType("<C-X><C-O>")
""autocmd FileType python set completeopt-=preview
"autocmd FileType python set ts=4
"autocmd FileType python set softtabstop=4
"autocmd FileType python set shiftwidth=4
"autocmd FileType python set expandtab
"autocmd FileType python set nosmartindent
"autocmd FileType python let b:auto_trim_whitespace=1
"augroup END
"augroup javascript
"autocmd FileType javascript set ts=4
"autocmd FileType javascript set softtabstop=4
"autocmd FileType javascript set shiftwidth=4
"autocmd FileType javascript set expandtab
"autocmd FileType javascript let b:auto_trim_whitespace=1
"augroup END
augroup mkd
autocmd FileType mkd set ai formatoptions=tcroqn2 comments=n:&gt;
@ -77,4 +77,5 @@ autocmd FileType go let b:auto_trim_whitespace=1
autocmd FileType cpp let b:auto_trim_whitespace=1
autocmd FileType perl let b:auto_trim_whitespace=1
autocmd FileType borg let b:auto_trim_whitespace=1
autocmd FileType javascript let b:auto_trim_whitespace=1

245
.vimrc
View file

@ -3,10 +3,10 @@
" | _ \/ _` | '_/ _` | / //(_-< \ V / | ' \| '_/ _|
" |___/\__,_|_| \__,_|_\_\ /__/ (_)_/|_|_|_|_|_| \__|
"
" Let's have a look.
" First, we are vim, not vi, so start as many others do with
"
" ** BASIC EDITOR SETTINGS **
"
" First, we are vim, not vi, so start as many others do with
set nocompatible
" Set syntax and highlighting
@ -33,6 +33,7 @@ set expandtab
let mapleader = ","
" Set 'smart' things in Vim
" Search case insensitive, unless it contains Uppercase letters
set smartcase
" Use all the indent features
set autoindent
@ -93,10 +94,14 @@ autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType python set tags+=$HOME/.vim/tags/python.ctags
"autocmd FileType python set omnifunc=pythoncomplete#Complete
"autocmd FileType python call SuperTabSetCompletionType("<C-X><C-O>")
"
" Set filetype for VimOrganizer
au! BufRead,BufWrite,BufWritePost,BufNewFile *.org
au BufEnter *.org call org#SetOrgFileType()
" Cull trailing whitespace for all files.
autocmd BufWritePre * :call AutoTrimWhitespace()
" Turn on the cursorline (highlight on line under cursor) but only for the
" window and buffer you're currently in. A handy trick, I'm trying out as of
" 2013-04-12 but the jury is still out.
@ -107,21 +112,25 @@ setlocal cursorline
" ** PLUGIN CONFIGURATION **
" Vim/Unknown
" * Vim general/Unknown
let python_highlight_all = 1
let g:Tb_MaxSize=0
let g:Tb_MapCTabSwitchBufs = 1
" Lusty plugins
" * Configure browser for haskell_doc.vim
let g:haddock_browser = "open"
let g:haddock_browser_callformat = "%s %s"
" * Lusty plugins
let g:LustyExplorerSuppressRubyWarning = 1
let g:LustyJugglerSuppressRubyWarning = 1
let g:LustyJugglerShowKeys = 'a'
" Buftabs
" * Buftabs
let g:buftabs_only_basename = 1
"let g:buftabs_in_statusline=1
"
" NERDTree
" * NERDTree
let g:NERDChristmasTree = 1
let g:NERDChristmasTree = 1
let g:NERDTreeQuitOnOpen = 1
@ -129,11 +138,11 @@ let g:NERDTreeWinPos = "right"
let g:NERDTreeWinSize = 40
let g:NERDTreeDirArrows=0
" Tagbar plugin settings
" * Tagbar plugin settings
let g:tagbar_width = 40
let g:tagbar_autofocus = 1
" Taglist plugin settings (deprecated)
" * Taglist plugin settings (deprecated)
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Use_Right_Window = 1
let Tlist_Inc_Winwidth = 0
@ -141,81 +150,30 @@ let Tlist_File_Fold_Auto_Close = 1
let Tlist_WinWidth = 40
let Tlist_Show_One_File = 0
" ConqueTerm
" * ConqueTerm
let g:ConqueTerm_CWInsert = 1
let g:ConqueTerm_InsertOnEnter = 0
let g:ConqueTerm_SendVisKey = '<Leader>ss'
"MiniBufExplore Options
" * MiniBufExplorer
"let g:miniBufExplMapWindowNavVim = 1
"let g:miniBufExplMapWindowNavArrows = 1
"let g:miniBufExplMapCTabSwitchBufs = 1
"let g:miniBufExplModSelTarget = 1
"let g:miniBufExplForceSyntaxEnable = 1
" CommandT
" * CommandT
let g:CommandTMaxFiles = 1000
let g:CommandTMaxDepth = 7
" * VimOrganizer
" default Tag list. Will be changed in near future so
" that these are defined by config lines in each .org
" file itself, but now these are where you can change things:
let g:org_todo_setup='TODO | DONE'
" while g:org_tag_setup is itself a string
"let g:org_tag_setup='{@home(h) @work(w) @tennisclub(t)} \n {easy(e) hard(d)} \n {computer(c) phone(p)}'
" ** REMAPPINGS **
" I used to use tabs, but then I took an arrow to the knee.
" Tabs in vim suck because they aren't what you want. Use tabbar.
"nnoremap gc :tabnew<CR>
"nnoremap gK :tabclose<CR>
"nnoremap gn gt
"nnoremap gp gT
" I don't know how I came up with gt for opening the tree, but it stuck.
nmap gt :NERDTreeToggle<CR>
nmap gb :TlistToggle<CR>
"nnoremap gx :Kwbd<CR>
" :Kwbd (defined below) really kills a buffer dead, and closes the window.
" gK is similar.
nnoremap gc :Kwbd<CR>
"nnoremap gc :bdelete<CR>
nnoremap gK :bdelete!<CR>
" I use gn/gp to cycle through open tabs
nnoremap gn :bn<CR>
nnoremap gp :bp<CR>
nnoremap gz :pclose<CR>
" The single most handy way to get around a file. Cursor over a word, and then
" type g* -- you'll go to the next instance of that word in the file. Make it
" easier to reach by calling it gw (go-word) instead of hidden away.
nnoremap gw g*
" Make shift-p like p except, put the line above instead of below.
nmap P o<Esc>p
" Line-based movement is cute, but it's tricky for files with lines that wrap.
" Attune more to what you see on the screen instead of where the lines actually
" are.
nnoremap j gj
nnoremap k gk
xnoremap j gj
xnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
xnoremap <Down> gj
xnoremap <Up> gk
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
"nnoremap <C-i> <C-a>
" Years of using bash and zsh have caused my fingers to expect these Emacs-like
" mappings to exist. Make them exist in vim as well. But eye them with
" suspicion, as they come from Emacs.
nnoremap <C-a> ^
nnoremap <C-e> $
xnoremap <C-a> ^
xnoremap <C-e> $
inoremap <C-a> <C-O>^
inoremap <C-e> <C-O>$
" Better fold mappings
nnoremap <silent> <Space> @=(foldlevel('.')?'za':'l')<CR>
vnoremap <Space> zf
" Just to be handy, Ctrl-C acts like escape. So does jj, which never really
" comes up in practice. If you really need to type jj do so slowly.
imap <C-c> <Esc>
inoremap jj <Esc>
" ** STATUSLINE **
@ -250,10 +208,12 @@ command LoadSession :source ~/.vim_last_session
" This is a quick way to edit a persistent scratch buffer for me...
command ScratchOpen :e scp://barak@barakmich.com//home/barak/notes/scratch
" Sudo-make-me-a-sandwich write
" Sudo-make-me-a-sandwich write. For when I forget to be root.
command Wdammit :w !sudo tee > /dev/null %
" Doesn't quite work right but can be a real savior if needed
" Doesn't quite work right but can be a real savior if needed.
" Oh-shit-what-was-this-like-before-I-changed-it?
function! s:DiffWithSaved()
let filetype=&ft
diffthis
@ -263,7 +223,16 @@ function! s:DiffWithSaved()
endfunction
com! DiffSaved call s:DiffWithSaved()
" toggles the quickfix window.
" Highlight lines that are longer than textwidth for the filetype, commonly 80
" characters.
function! HighlightTooLongLines()
highlight def link RightMargin Error
if &textwidth != 0
exec 'match RightMargin /\%<' . (&textwidth + 3) . 'v.\%>' . (&textwidth + 1) . 'v/'
endif
endfunction
" Toggles the quickfix window split.
command -bang -nargs=? QFix call QFixToggle(<bang>0)
function! QFixToggle(forced)
if exists("g:qfix_win") && a:forced == 0
@ -273,7 +242,8 @@ function! QFixToggle(forced)
endif
endfunction
" used to track the quickfix window
" Make the Quickfix window respond well to commands (for instance, q to close,
" Enter to select, etc). In tandem with the above.
augroup QFixToggle
autocmd!
autocmd BufWinEnter quickfix let g:qfix_win = bufnr("$")
@ -281,33 +251,8 @@ augroup QFixToggle
autocmd BufWinLeave * if exists("g:qfix_win") && expand("<abuf>") == g:qfix_win | unlet! g:qfix_win | endif
augroup END
nnoremap <Leader>ff :QFix<CR>
nnoremap <Leader>fn :cnext<CR>
nnoremap <Leader>fp :cprev<CR>
nnoremap <Leader>aw :exe 'Ack ' . expand('<cword>')<CR>
nnoremap <Leader>ac :Ack
nnoremap <Leader>hh :A<CR>
nnoremap <silent> <Leader>o :CommandTBuffer<CR>
nnoremap <Leader>j <C-^>
nnoremap <Leader>p :PTW
function! HighlightTooLongLines()
highlight def link RightMargin Error
if &textwidth != 0
exec 'match RightMargin /\%<' . (&textwidth + 3) . 'v.\%>' . (&textwidth + 1) . 'v/'
endif
endfunction
let s:extrarc = expand($HOME . '/.vimrc_google')
if filereadable(s:extrarc)
exec ':so ' . s:extrarc
endif
" Configure browser for haskell_doc.vim
let g:haddock_browser = "open"
let g:haddock_browser_callformat = "%s %s"
" new shell execute that pipes output to window
" Execute a command that pipes output to window. Captures output into a new,
" appropriately titled, buffer.
function! s:ExecuteInShellOutput(command)
let command = join(map(split(a:command), 'expand(v:val)'))
let winnr = bufwinnr('^' . command . '$')
@ -322,6 +267,8 @@ function! s:ExecuteInShellOutput(command)
silent! execute 'nnoremap <silent> <buffer> <LocalLeader>r :call <SID>ExecuteInShell(''' . command . ''')<CR>'
echo 'Execution of ' . command . ' complete.'
endfunction
" Same as above, doesn't capture output
function! s:ExecuteInShell(command)
let command = join(map(split(a:command), 'expand(v:val)'))
silent! execute 'silent !'. command
@ -368,13 +315,95 @@ function AutoTrimWhitespace()
endif
endfunction
autocmd BufWritePre * :call AutoTrimWhitespace()
" ** KEY REMAPPINGS **
"
" I used to use tabs, but then I took an arrow to the knee.
" Tabs in vim suck because they aren't what you want. Use tabbar.
"nnoremap gc :tabnew<CR>
"nnoremap gK :tabclose<CR>
"nnoremap gn gt
"nnoremap gp gT
" I don't know how I came up with gt for opening the tree, but it stuck.
nmap gt :NERDTreeToggle<CR>
" The same for the TagList, useful for large C files.
nmap gb :TlistToggle<CR>
"nnoremap gx :Kwbd<CR>
" :Kwbd (defined below) really kills a buffer dead, and closes the window.
" gK is similar.
nnoremap gc :Kwbd<CR>
"nnoremap gc :bdelete<CR>
nnoremap gK :bdelete!<CR>
" default Tag list. Will be changed in near future so
" that these are defined by config lines in each .org
" file itself, but now these are where you can change things:
let g:org_todo_setup='TODO | DONE'
" while g:org_tag_setup is itself a string
"let g:org_tag_setup='{@home(h) @work(w) @tennisclub(t)} \n {easy(e) hard(d)} \n {computer(c) phone(p)}'
" I use gn/gp to cycle through open tabs/buffers
nnoremap gn :bn<CR>
nnoremap gp :bp<CR>
nnoremap gz :pclose<CR>
" The single most handy way to get around a file. Cursor over a word, and then
" type g* -- you'll go to the next instance of that word in the file. Make it
" easier to reach by calling it gw (go-word) instead of hidden away.
nnoremap gw g*
" Make shift-p like p except, put the line above instead of below.
nmap P o<Esc>p
" Line-based movement is cute, but it's tricky for files with lines that wrap.
" Attune more to what you see on the screen instead of where the lines actually
" are.
nnoremap j gj
nnoremap k gk
xnoremap j gj
xnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
xnoremap <Down> gj
xnoremap <Up> gk
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
"nnoremap <C-i> <C-a>
" Years of using bash and zsh have caused my fingers to expect these Emacs-like
" mappings to exist. Make them exist in vim as well. But eye them with
" suspicion, as they come from Emacs.
nnoremap <C-a> ^
nnoremap <C-e> $
xnoremap <C-a> ^
xnoremap <C-e> $
inoremap <C-a> <C-O>^
inoremap <C-e> <C-O>$
" Better fold mappings
nnoremap <silent> <Space> @=(foldlevel('.')?'za':'l')<CR>
vnoremap <Space> zf
" Just to be handy, Ctrl-C acts like escape. So does jj, which never really
" comes up in practice. If you really need to type jj do so slowly.
imap <C-c> <Esc>
inoremap jj <Esc>
" Leader key functions
" See quickfix.
nnoremap <Leader>ff :QFix<CR>
" Next quickfix.
nnoremap <Leader>fn :cnext<CR>
" Prev quickfix.
nnoremap <Leader>fp :cprev<CR>
" Ack (grep) for the word under the cursor.
nnoremap <Leader>aw :exe 'Ack ' . expand('<cword>')<CR>
" Ack prompt.
nnoremap <Leader>ac :Ack
" For C++ -- A is a great plugin which allows you to jump from the c file to the
" header and vice-versa. Mneumonic here is headerheader.
nnoremap <Leader>hh :A<CR>
" CommandT is useful, but if I'm juggling lots of buffers, limit it to another
" one I have open (instead of standard <Leader>t).
nnoremap <silent> <Leader>o :CommandTBuffer<CR>
nnoremap <Leader>j <C-^>
nnoremap <Leader>p :PTW
" ** EXTRA INCLUDES **
"
let s:extrarc = expand($HOME . '/.vimrc_google')
if filereadable(s:extrarc)
exec ':so ' . s:extrarc
endif
" ** SEE ALSO **
" filetype.vim