-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
191 lines (145 loc) · 4.39 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
" .vimrc
" fix arrow keys and backspace
set nocp
set backspace=2
set sw=8 ts=8 autoindent nowrap
set expandtab
set linebreak
" make backspace eat 8 spaces
set softtabstop=8
" disable intro screen
set shortmess=I
" stop *beeping* beeping
set visualbell t_vb=
" Ctrl-w: toggle word wrap
:noremap <c-w> :set wrap!<cr>
" Alt-<arrow>: navigate windows
:noremap <a-up> :wincmd k<cr>
:noremap <a-down> :wincmd j<cr>
:noremap <a-left> :wincmd h<cr>
:noremap <a-right> :wincmd l<cr>
" Ctrl-Backspace: delete word left
:imap <C-BS> <C-W>
" Ctrl-Delete: delete word right
:imap <C-Del> <C-O>dw
" Ctrl-Up/Down: paragraph up/down
:map <C-Up> {
:map <C-Down> }
:imap <C-Up> <C-O>{
:imap <C-Down> <C-O>}
function! SetTabType()
" any line beginning with a tab?
if search('^\t', 'nw') != 0
" disable et
set noexpandtab
set shiftwidth=8 tabstop=8 softtabstop=8
" highlight spaces used for indentation, >=8 consecutive spaces
:2match ExtraWhitespace2 /^\zs \+\| \{8,\}/
elseif search('^ [^ ]', 'nw') != 0
set expandtab
set shiftwidth=2 tabstop=2 softtabstop=2
" highlight tabs anywhere
:2match ExtraWhitespace2 /\t/
elseif search('^ [^ ]', 'nw') != 0
set expandtab
set shiftwidth=3 tabstop=3 softtabstop=3
" highlight tabs anywhere
:2match ExtraWhitespace2 /\t/
elseif search('^ [^ ]', 'nw') != 0
set expandtab
set shiftwidth=4 tabstop=4 softtabstop=4
" highlight tabs anywhere
:2match ExtraWhitespace2 /\t/
elseif search('^ [^ ]', 'nw') != 0
set expandtab
set shiftwidth=8 tabstop=8 softtabstop=8
" highlight tabs anywhere
:2match ExtraWhitespace2 /\t/
endif
endfunction
if has("autocmd")
" enable file type detection and indentation
filetype plugin indent on
autocmd BufRead * call SetTabType()
" force indentation style for Python
autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4
" make visualbell do nothing
autocmd GUIEnter * set visualbell t_vb=
endif
" detect Make.config as Makefile
au BufRead,BufNewFile Make.config setfiletype make
" color scheme
set bg=dark
:color koehler
" font for gVim
set gfn=Consolas:h11:cANSI
" syntax highlighting on by default
syntax on
" line numbers on
":set number
" disable mouse support
:set mouse=""
" mouse support
":set mouse=a
" force-enable 256 color mode
if $TERM =~ '-256color$'
let &t_Co=256
let &t_AF="\e[38;5;%dm"
let &t_AB="\e[48;5;%dm"
endif
" fix tmux keys
" TODO: this is probably fallout from setting xterm-keys in tmux.conf, since
" terminfo should already have mapped the keys...
if $TERM =~ '^screen' || $TERM =~ '^tmux'
map <Esc>OH <Home>
map! <Esc>OH <Home>
map <Esc>OF <End>
map! <Esc>OF <End>
map <Esc>[1;5H <C-Home>
map! <Esc>[1;5H <C-Home>
map <Esc>[1;5F <C-End>
map! <Esc>[1;5F <C-End>
map <Esc>[1;5C <C-Right>
map! <Esc>[1;5C <C-Right>
map <Esc>[1;5D <C-Left>
map! <Esc>[1;5D <C-Left>
map <Esc>[1;5A <C-Up>
map! <Esc>[1;5A <C-Up>
map <Esc>[1;5B <C-Down>
map! <Esc>[1;5B <C-Down>
map <Esc>[5;5~ <C-PageUp>
map! <Esc>[5;5~ <C-PageUp>
map <Esc>[6;5~ <C-PageDown>
map! <Esc>[6;5~ <C-PageDown>
map <Esc>[3;5~ <C-Del>
map! <Esc>[3;5~ <C-Del>
map <C-_> <C-BS>
map! <C-_> <C-BS>
endif
" search for tags all the way up to /
set tags=tags;/
" tie the system clipboard to the default unnamed register
set clipboard=unnamed
" automatically copy Visual selection to clipboard
:set go+=a
set autochdir
set incsearch
set hlsearch
:highlight ExtraWhitespace ctermbg=red
:highlight ExtraWhitespace2 ctermbg=red
:match ExtraWhitespace /\s\+$\| \+\ze\t/ " trailing whitespace, spaces before tab
hi statusline cterm=none ctermbg=darkblue ctermfg=white
hi statuslinenc cterm=none ctermbg=darkgrey ctermfg=black
hi User1 ctermbg=darkblue ctermfg=yellow
set laststatus=2
set statusline=%.20F " filename
set statusline+=:%l:%v " line and column
set statusline+=\ =\ U+%02B " hex value of character under cursor
set statusline+=\ " space
set statusline+=%m " modified flag
set statusline+=%1*%r%* " read-only flag
set statusline+=\ %= " right align
set statusline+=[%{&et?&sw.'spc':'tab'}]
set statusline+=%{strlen(&fenc)?'['.&fenc.']':''} " encoding
set statusline+=%1*%{&ff!='unix'?'['.&ff.']':''}%* " file format
set statusline+=%y " filetype