1 " My personal vim, nvim, gvim configuration
2 " Author: Stefan Huber <shuber@sthu.org>
5 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
15 set fillchars=vert:│,fold:\
16 set listchars=tab:»,trail:·,eol:$
19 filetype plugin indent on
38 set wildmode=longest,list:full
44 if filereadable($HOME . '/.vim/lowendbox')
55 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
56 " Some filetype-specific settings
58 au FileType text,markdown,asciidoc,mail,gitcommit,mediawiki,vimwiki,tex setlocal spell
59 au FileType text,markdown,asciidoc,mail,gitcommit,mediawiki,vimwiki setlocal formatoptions+=n
60 au Filetype mail setlocal formatoptions+=o
61 " Add | for block quotation, such that gq respects it
62 au Filetype mail setlocal comments+=n:\|,
64 au Filetype go setlocal shiftwidth=8 tabstop=8 noexpandtab
65 au Filetype tex setlocal shiftwidth=2 tabstop=2
67 au FileType mediawiki setlocal wrap linebreak textwidth=0
70 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
71 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
73 " Line wrap crippled with numbers shown
74 au Filetype man setlocal nonumber
76 " Minimum indenting for source code
77 au FileType java,cpp,c,cs let g:detectindent_min_indent = 4
78 " Consider using localvimrc config file or editorconfig instead
79 "au BufReadPost *.java :DetectIndent
81 au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
82 au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
84 au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh'
85 au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp'
86 au BufNewFile *.{h,hpp,hxx} call AddIncludeGuards()
88 au FileType cpp,c packadd termdebug
90 augroup autofoldcolumn
92 au CursorHold,BufWinEnter * AutoOrigamiFoldColumn
96 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
100 " Attention: Must be run after plugsetup.vim
101 " Trailing whitespace
102 highlight default link BadWhitespace SpellCap
104 " Setup BadWhitespace syntax match expressions.
105 function SetBadWhitespaceSyntax()
106 " Do not expose bad whitespace in help buffers or for man pages. Or, more
107 " generally, if we open the file readonly.
108 "if &ft != "help" && &ft != "man"
110 " Make trailing whitespace be flagged as bad.
111 syn match BadWhitespace /\s\+$/ containedin=ALL
112 " Make space before tab be flagged as bad and vice versa
113 syn match BadWhitespace / \+\t/ containedin=ALL
114 syn match BadWhitespace /\t \+/ containedin=ALL
118 " Make trailing whitespace be flagged as bad.
119 au BufRead,BufNewFile * call SetBadWhitespaceSyntax()
121 " termdebug split windows
122 let g:termdebug_wide = 1
123 let termdebugger = $HOME . '/.vim/gdb.sh'