set autoindent set modeline set background=dark set encoding=utf-8 set history=1000 set showcmd set laststatus=2 set virtualedit=block set hidden set listchars=eol:$,tab:⊫—,trail:␣,extends:»,precedes:«,nbsp:· if has("syntax") set statusline=%<[#%n]\ %f%y%H%M%R%W\ %=U+%04B\ %{synIDattr(synID(line('.'),col('.'),1),'name')}\ %-10.(%l,%c%V%)\ %P else set statusline=%<[#%n]\ %f%y%H%M%R%W\ %=%-14.(%l,%c%V%)\ %P endif if 1 let c_comment_strings=1 " c in insert mode is a bit much let g:EnhCommentifyUserBindings='Yes' endif if has("syntax") syntax on filetype plugin indent on " Use Posix syntax for the 'sh' filetype. let g:is_posix = 1 endif " Set palette for godlygeek's cterm-hex patch. if exists("+termpalette") set termpalette=xterm endif " Incrementally-highlighted search. Use Ctrl-L to suppress highlight. if has("extra_search") set hlsearch set incsearch nnoremap :nohl if !&insertmode inoremap :nohl endif endif highlight Tab ctermbg=Blue if has("syntax") match Tab /\t/ endif " Use sudo to write a file, if we opened it without appropriate permissions if 1 command! SW exe "w !sudo dd of=%" | e! endif " :NN and :PP (with optional !): like :n/:N, but quit after the last (before " the first) file. if 1 command! -bar -bang -count=1 NN if argidx() < argc()- | n | else | q | endif command! -bar -bang -count=1 PP if argidx() >= | N | else | q | endif endif " :Run : run a shell command, placing its output in a new window. if 1 command! -nargs=+ -complete=shellcmd Run new | set buftype=nofile | r ! endif if has("insert_expand") " Syntax-complete if that's the best we can do if has("autocmd") autocmd Filetype * if &omnifunc == "" | setlocal omnifunc=syntaxcomplete#Complete | endif endif " Omni-complete with ctrl-space set cot+=longest inoremap pumvisible() ? "\" : "\\" endif " Ctrl-Up and Ctrl-Down: scroll through the quickfix list. nnoremap :cp nnoremap :cn inoremap :cp inoremap :cn " :Man command. runtime! ftplugin/man.vim " I never write plaintex. if 1 let tex_flavor="latex" endif " to save and build, to rebuild tags " First, the versions for vim.tiny nnoremap :wa:!make nnoremap :!ctags -R .:redr! " And the improved versions if 1 " Compile without prompting and open the quickfix window if necessary. command! -bar -complete=file -nargs=* Make silent! make | cw | redr! nnoremap :wa:Make nnoremap :silent! !ctags -R .:redr! endif if 1 " Execute the current line. nnoremap @;; "pyy:@p " Operator to execute a command from the buffer. Uses "p and '', sorry. nnoremap @; m':silent set opfunc=ExecRegiong@ vnoremap @; :call ExecRegion('vis') function! ExecRegion(type, ...) if a:type == "vis" " Yank and execute the visual region. :'<,'> y p @p else " remember the buffer let l:origbuf = bufnr("%") " Yank and execute the operator region. :'[,'] y p @p " If we're in the same buffer as before, keep our position if bufnr("%") == l:origbuf && has("ex_extra") norm g`` endif endif endfun endif if 1 nnoremap g\j :silent! set opfunc=JoinOpg@ vnoremap g\j J function! JoinOp(type) '[,'] j endfun endif " C-c prefix for VCS commands. Normal mode only. " The abbreviations differ from those with \c prefix. nnoremap a :VCSAdd nnoremap A :VCSAnnotate nnoremap c :VCSCommit nnoremap d :VCSDiff nnoremap D :VCSVimDiff nnoremap l :VCSLog nnoremap o :VCSGotoOriginal nnoremap R :VCSRevert nnoremap s :VCSStatus nnoremap u :VCSUpdate nnoremap :VCSGotoOriginal! if has("textobjects") " iT to select an inner tagblock in visual mode without the leading/trailing " newline. This is useful for XML/HTML/etc like the following: " " content paragraph that should be selected " vnoremap iT itk$oj^O " Format the current iT tagblock: join, indent, and re-split. nmap gqP viTJ==Vgq " Pseudo-textobject for An Indented region (all the surrounding lines with " at least as much indent as the current one). Needs much work. vnoremap ai :. let ai_re='[^[:space:]].*\%' . virtcol(".") . 'v'gv?=ai_rej^o/=ai_rek$ endif if has("digraphs") " Digraphs for schwa. digr ee 601 " ə digr Ee 399 " Ə digr EE 398 " Ǝ endif if 1 " Open a line indented to the current column. nnoremap o :let b:ospaces=virtcol(".")-1o:exe "norm " . b:ospaces . "i ":.retab!A nnoremap O :let b:ospaces=virtcol(".")-1O:exe "norm " . b:ospaces . "i ":.retab!A endif if &t_Co > 128 highlight Pmenu ctermbg=92 ctermfg=15 highlight PmenuSel ctermbg=147 ctermfg=0 highlight Special ctermfg=216 endif if 1 let g:csapprox_no_warn=1 let g:CSApprox_verbose_level=0 endif