Indentation for vimrc, and CursorHold

This commit is contained in:
Hunter Haugen 2011-03-13 14:50:06 -07:00
parent e8c936ca78
commit 8fe0d01df9

67
.vimrc
View file

@ -285,6 +285,46 @@ map <silent> <S-F9> :set list! listchars<CR>
set fillchars=fold:-
"-----------------------------------------------------------------------
" Preview window for :help CursorHold-example after updatetime
"-----------------------------------------------------------------------
au! CursorHold *.[ch] nested call PreviewWord()
func PreviewWord()
if &previewwindow " don't do this in the preview window
return
endif
let w = expand("<cword>") " get the word under cursor
if w =~ '\a' " if the word contains a letter
" Delete any existing highlight before showing another tag
silent! wincmd P " jump to preview window
if &previewwindow " if we really get there...
match none " delete existing highlight
wincmd p " back to old window
endif
" Try displaying a matching tag for the word under the cursor
try
exe "ptag " . w
catch
return
endtry
silent! wincmd P " jump to preview window
if &previewwindow " if we really get there...
if has("folding")
silent! .foldopen " don't want a closed fold
endif
call search("$", "b") " to end of previous line
let w = substitute(w, '\\', '\\\\', "")
call search('\<\V' . w . '\>') " position cursor on match
" Add a match highlight to the word at this position
hi previewWord term=bold ctermbg=green guibg=green
exe 'match previewWord "\%' . line(".") . 'l\%' . col(".") . 'c\k*"'
wincmd p " back to old window
endif
endif
endfun
"-----------------------------------------------------------------------
" completion
"-----------------------------------------------------------------------
@ -305,7 +345,6 @@ set dictionary=/usr/share/dict/words
"-----------------------------------------------------------------------
if has("eval")
" If we're in a wide window, enable line numbers.
fun! <SID>WindowWidth()
if winwidth(0) > 90
@ -606,8 +645,9 @@ nmap <Leader><F8> :exec "make -C " . expand("%:p:h")<CR>
" Insert a single char
noremap <Leader>i i<Space><Esc>r
" Split the line
" Split the line into a (n)ew line or an (o)pen line
nmap <Leader>n \i<CR>
nmap <Leader>o \i<CR>k$
" Pull the following line to the cursor position
noremap <Leader>J :s/\%#\(.*\)\n\(.*\)/\2\1<CR>
@ -632,7 +672,7 @@ noremap <Leader>gp gqap
noremap <Leader>clr :s/^.*$//<CR>:nohls<CR>
" Delete blank lines
"noremap <Leader>dbl :g/^$/d<CR>:nohls<CR>
noremap <Leader>dbl :g/^$/d<CR>:nohls<CR>
" Enclose each selected line with markers
noremap <Leader>enc :<C-w>execute
@ -1033,9 +1073,9 @@ map <F23> <S-F11>
map <F24> <S-F12>
map <S-F2> :vsplit ~/.vim/ref_full.vim<CR>
map <F2> :11vsplit ~/.vim/ref.vim<CR>
map <F3> :Sexplore /home/hunner/<CR>
map <F3> :Sexplore $HOME<CR>
map <S-F3> :2split ~/.vim/fun_ref.vim<CR>
map <F4> :set nu<CR>
map <F4> :set rnu!<CR>
map <S-F4> :set nu!<CR>
map <F5> ggVGg?
map <F6> :set encoding=utf-8<CR> | :set fenc=utf-8<CR>
@ -1048,15 +1088,18 @@ map <S-F6> :set encoding=iso8859-15<CR> | :set fenc=iso8859-15<CR>
nnoremap <Esc> :noh<CR><Esc>
map <F11> !!date<CR>
map <F12> :TC<CR>
nmap :X :x
nmap :W :w
nmap :Q :q
nmap :B :b
nnoremap :X :x
nnoremap :W :w
nnoremap :Q :q
nnoremap :B :b
noremap <Leader>rg :color relaxedgreen<CR>
noremap <Leader>ip :color inkpot<CR>
noremap <Leader>ir :color ir_black<CR>
map <Leader>t :FufFile<CR>
map <Leader>d :FufDir<CR>
map <Leader>f :FufFile<CR>
map <Leader>b :FufBuffer<CR>
map <Leader>c :FufDir<CR>
map <Leader>w :bdelete<CR>
map <F1> :FufHelp<CR>
noremap <F12> <Esc>:syntax sync fromstart<CR>
inoremap <F12> <C-o>:syntax sync fromstart<CR>
syntax sync minlines=200
@ -1095,4 +1138,4 @@ endif
" imap /me <C-V><C-A>ACTION
"-----------------------------------------------------------------------
" vim: set shiftwidth=4 softtabstop=4 expandtab tw=72 :
" vim: set shiftwidth=2 softtabstop=2 expandtab tw=72 :