My .vimrc
:
filetype on " Auto-detect filetype filetype plugin indent on " Auto-indent set expandtab " No TABs... autocmd FileType make set noexpandtab " ...except in Makefiles autocmd FileType cpp set keywordprg=cppman " Using cppman for 'K' keyword help in C++ files autocmd BufWritePost *.c,*.h,*.cs silent! !ctags . & " Ctrl-], Ctrl-t " If some system gives you problems with encodings and you suspect a " broken Vim setup, try uncommenting this. "set encoding=utf-8 set shiftwidth=4 " 1 indent = 4 spaces set tabstop=4 " 1 TAB = 4 columns set ruler " Display cursor position set laststatus=2 " Display status line "set statusline=%F%m%r%h%w\ [FORMAT=%{&ff},%{&fenc}]\ [TYPE=%Y]\ F2-Paste,\ F8-Tags\ %=[COL=%03v][ROW=%04l/%04L]\ %03p%% set statusline=%F%m%r%h%w\ %=[%{&fenc}][C%03v][R%04l/%04L] set listchars=tab:>-,trail:·,nbsp:»,extends:# " How to display whitespaces set list " Display whitespaces syntax on " Syntax highlighting color koehler " Color scheme set background=dark " Contrast for on-black xterms (which I prefer) set wrap " Wrap long lines set showmatch " Briefly jump to opening brace set vb t_vb= " Disable terminal beeps set incsearch " Incremental search (remember to press <RETURN> when done) set scrolloff=3 " Keep 3 lines above / below cursor when scrolling "set spell " Spellchecker on (]s - next word, zg - add good, zug - undo add, z= - suggest, " :spellr(epall) - replace all occurences) setlocal spelllang=de " Setting language for spellchecker set mouse=a " Enable mouse support for all modes set pastetoggle=<F2> " Toggle 'paste' mode to en-/disable auto-formatting of pasted text set tags=./tags;$HOME highlight ColorColumn ctermbg=magenta call matchadd( 'ColorColumn', '\%76v', 100 ) " Set a 'warning' highlight on column 76 set hlsearch " Highlight search matches " 'hlsearch' makes it hard to tell which is the *current* match, so we " do some trickery to highlight that one in a special way (flashing for " 0.4 seconds). " function to flash the current match a number of times function! HLNext (blink) let [bufnum, lnum, col, off] = getpos('.') let matchlen = strlen(matchstr(strpart(getline('.'),col-1),@/)) let target_pat = '\c\%#\%('.@/.'\)' let i = 1 while i < a:blink exec 'sleep 50m' let ring = matchadd('Comment', target_pat, 101) redraw exec 'sleep 50m' call matchdelete(ring) redraw let i += 1 endwhile endfunction " Rewire n and N to step-and-call-function " Disabled by default because, if you step through many matches often, " the blink delay can slow you down considerably. "nnoremap <silent> n n:call HLNext(5)<cr> "nnoremap <silent> N N:call HLNext(5)<cr> " Settings for vim-taglist (http://vim-taglist.sourceforge.net) nnoremap <silent> <F8> :TlistToggle<CR> " F8 toggles taglist let g:Tlist_GainFocus_On_ToggleOpen = 1 " ...give focus... let g:Tlist_Exit_OnlyWindow = 1 " ...exit if last window open... let g:Tlist_Use_Right_Window = 1 " ...open taglist to the right... let g:Highlight_Tag_On_BufEnter = 1 " ...highlight tag when entering buffer... let g:Tlist_Auto_Open = 0 " ...do not open by default... let g:Tlist_Auto_Update = 1 " ...update automatically... let g:Tlist_Show_One_File = 0 " ...show all open files... let g:Tlist_Enable_Fold_Column = 0 " ...disable folding... let g:Tlist_Use_SingleClick = 1 " ...enable jump-on-click... " Settings for vim-latex (http://vim-latex.sourceforge.net) set shellslash " Convert backward slashes to forward ones in filename references set grepprg=grep\ -nH\ $* " Force grep to display file name even in single-file searches let g:tex_flavor='latex' " Force .tex to mean LaTeX, not plain TeX let g:Tex_SmartQuoteOpen = "``" " Opening quote, English style (German would be "\"`") let g:Tex_SmartQuoteClose = "''" " Closing quote, English style (German would be "\"'") let g:Tex_AutoFolding = 0 " Do not fold on opening file let g:Tex_Env_table = "\\begin{table}\<CR>\\caption{<++>}\<CR>\\label{tab:<++>}\<CR>\\begin{tabularx}{<+width+>}{<+columns+>}\<CR>\\hline\<CR><++>\<CR>\\hline\<CR>\\end{tabularx}\<CR>\\end{table}<++>" let g:Tex_Env_list = "\\begin{lstlisting}[<++>]\<CR><++>\<CR>\\end{lstlisting}<++>" " list<F5> gives lstlisting environment let g:Tex_Com_list = "\\lstinline{<++>}<++>" " list<F7> gives lstinline command " Workaround for Gnome-Terminal bug showing >4;m escape sequence set keyprotocol = "" let &term = &term
My .gvimrc:
highlight Normal guifg=green guibg=black " Colors as I like them set guifont=Monospace\ 10 " The default font sucks set lines=50 columns=150 " Just for example " From https://vim.fandom.com/wiki/Restore_screen_size_and_position if has("gui_running") function! ScreenFilename() if has('amiga') return "s:.vimsize" elseif has('win32') return $HOME.'\_vimsize' else return $HOME.'/.vimsize' endif endfunction function! ScreenRestore() " Restore window size (columns and lines) and position " from values stored in vimsize file. " Must set font first so columns and lines are based on font size. let f = ScreenFilename() if has("gui_running") && g:screen_size_restore_pos && filereadable(f) let vim_instance = (g:screen_size_by_vim_instance==1?(v:servername):'GVIM') for line in readfile(f) let sizepos = split(line) if len(sizepos) == 5 && sizepos[0] == vim_instance silent! execute "set columns=".sizepos[1]." lines=".sizepos[2] silent! execute "winpos ".sizepos[3]." ".sizepos[4] return endif endfor endif endfunction function! ScreenSave() " Save window size and position. if has("gui_running") && g:screen_size_restore_pos let vim_instance = (g:screen_size_by_vim_instance==1?(v:servername):'GVIM') let data = vim_instance . ' ' . &columns . ' ' . &lines . ' ' . \ (getwinposx()<0?0:getwinposx()) . ' ' . \ (getwinposy()<0?0:getwinposy()) let f = ScreenFilename() if filereadable(f) let lines = readfile(f) call filter(lines, "v:val !~ '^" . vim_instance . "\\>'") call add(lines, data) else let lines = [data] endif call writefile(lines, f) endif endfunction if !exists('g:screen_size_restore_pos') let g:screen_size_restore_pos = 1 endif if !exists('g:screen_size_by_vim_instance') let g:screen_size_by_vim_instance = 1 endif autocmd VimEnter * if g:screen_size_restore_pos == 1 | call ScreenRestore() | endif autocmd VimLeavePre * if g:screen_size_restore_pos == 1 | call ScreenSave() | endif endif
My .vim/after/syntax/tex/lstlisting.vim:
" To keep Vim from trying to syntax-highlight included source as LaTeX " (http://stackoverflow.com/a/21651323/60281) syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" syn region texZone start="\\lstinputlisting" end="{\s*[a-zA-Z/.0-9_^]\+\s*}" syn match texInputFile "\\lstinline\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
My .vim/indent/tex.vim:
let b:did_indent = 1 " Disable indenting for LaTeX files