plugins: Move out configs from init.vim
[vimconf.git] / init.vim
1 " My personal vim, nvim, gvim configuration
2 " Author: Stefan Huber <shuber@sthu.org>
3
4
5 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6 " Some global settings
7
8 set nocompatible
9 set number
10 set cursorline
11 set scrolloff=5
12
13 set encoding=utf-8
14
15 set fillchars=vert:│,fold:\
16 set listchars=tab:»­,trail:·,eol:$
17 set virtualedit=block
18
19 filetype plugin indent on
20
21 set tabstop=4
22 set shiftwidth=4
23 set expandtab
24 set smarttab
25
26 set autoindent
27 set smartindent
28
29 set incsearch
30 set hlsearch
31
32 set foldcolumn=4
33 set foldlevelstart=20
34
35 set colorcolumn=+1
36 set mouse=a
37 set wildmenu
38 set wildmode=longest,list:full
39
40 set tabpagemax=100
41
42 syntax on
43
44 if filereadable($HOME . '/.vim/lowendbox')
45 let g:lowendbox = 1
46 else
47 let g:lowendbox = 0
48 endif
49
50 runtime macros.vim
51 runtime keymaps.vim
52 runtime plugsetup.vim
53
54
55 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
56 " Some filetype-specific settings
57
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:\|,
63
64 au Filetype go setlocal shiftwidth=8 tabstop=8 noexpandtab
65 au Filetype tex setlocal shiftwidth=2 tabstop=2
66
67 au FileType mediawiki setlocal wrap linebreak textwidth=0
68
69 "git scissor line
70 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
71 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
72
73 " Line wrap crippled with numbers shown
74 au Filetype man setlocal nonumber
75
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
80
81 au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
82 au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
83
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()
87
88 au FileType cpp,c packadd termdebug
89
90 augroup autofoldcolumn
91 au!
92 au CursorHold,BufWinEnter * AutoOrigamiFoldColumn
93 augroup END
94
95
96 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
97 " General settings
98
99
100 " Attention: Must be run after plugsetup.vim
101 " Trailing whitespace
102 highlight default link BadWhitespace SpellCap
103
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"
109 if !&readonly
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
115 endif
116 endfunction
117
118 " Make trailing whitespace be flagged as bad.
119 au BufRead,BufNewFile * call SetBadWhitespaceSyntax()
120
121 " termdebug split windows
122 let g:termdebug_wide = 1
123 let termdebugger = $HOME . '/.vim/gdb.sh'
124