plugins: Move init confs to plugin confs
[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 au BufNewFile *.{h,hpp,hxx} call AddIncludeGuards()
77
78 au FileType cpp,c packadd termdebug
79
80 augroup autofoldcolumn
81 au!
82 au CursorHold,BufWinEnter * AutoOrigamiFoldColumn
83 augroup END
84
85
86 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
87 " General settings
88
89
90 " Attention: Must be run after plugsetup.vim
91 " Trailing whitespace
92 highlight default link BadWhitespace SpellCap
93
94 " Setup BadWhitespace syntax match expressions.
95 function SetBadWhitespaceSyntax()
96 " Do not expose bad whitespace in help buffers or for man pages. Or, more
97 " generally, if we open the file readonly.
98 "if &ft != "help" && &ft != "man"
99 if !&readonly
100 " Make trailing whitespace be flagged as bad.
101 syn match BadWhitespace /\s\+$/ containedin=ALL
102 " Make space before tab be flagged as bad and vice versa
103 syn match BadWhitespace / \+\t/ containedin=ALL
104 syn match BadWhitespace /\t \+/ containedin=ALL
105 endif
106 endfunction
107
108 " Make trailing whitespace be flagged as bad.
109 au BufRead,BufNewFile * call SetBadWhitespaceSyntax()
110
111 " termdebug split windows
112 let g:termdebug_wide = 1
113 let termdebugger = $HOME . '/.vim/gdb.sh'
114