-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
280 lines (208 loc) · 7.08 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
" -----------------------------------
" vimrc / 'Vim' configuration file
"
" written by ryz <ryzawy@gmail.com>
" last update: 2012-04-17 10:45:00
" -----------------------------------
" latest changes/additions/removals:
" [+] disabled font anti aliasing
" [=] changed font to terminus
" [-] -
" -----------------------------------
" to use this vimrc, copy it to
" for GNU/Linux and Unix: ~/.vimrc
" for MS-DOS and Win32 : $VIM\_vimrc
" -----------------------------------
" pathogen needs to be called BEFORE plugident
call pathogen#infect()
call pathogen#helptags()
" general settings {{{
" ----------------
set nocompatible " don't emulate vi-behaviour, must be the first option
set backup " make backup files
set backspace=2 " backspacing in insert mode over everything else; same as 'backspace=indent,eol,start'
filetype on " detect the type of file
set history=50 " How many lines of history to remember
set showcmd " display incomplete commands
if has ("mouse")
set mouse=a " enable mouse support (all modes)
endif
" scrolling
set scrolloff=3 " start scrolling three lines before the horizontal window border
" line numbering
set number " show line numbers
set relativenumber " line numbering relative to the current one
set numberwidth=4 " use 'x' spaces for numbers, e.g. '4' for '999 '
set cursorline " show cursor line (colorscheme dependent)
set ruler " show the cursor position all the time
set nopaste " not in paste mode per default
" search related
set hls " highlight search-pattern
set incsearch " incremential search ("set is" also works)
set ignorecase " case-insensitive if search is all-lowercase...
set smartcase " ...but if one or more characters are uppercase, be case-sensitive
" substitute related
set gdefault " add g (global) flag to subsitutions
set autochdir " working directory is the same as the current file
" set backup directories
if has ("unix")
set backupdir=~/.vim/backup " where to put backup files under unix/linux
set directory=~/.vim/tmp " where to put swap (.swp) files under unix/linux
elseif has ("mac")
set backupdir=~/.vim/backup " where to put backup files under mac osx
set directory=~/.vim/tmp " where to put swap (.swp) files under mac osx
elseif has ("win32")
set backupdir=$TEMP " where to put backup files under windows
set directory=$TEMP " where to put swap (.swp) files under windows
endif
set fileformats=unix,dos,mac " support all three, in this order
set wildmenu " sane <Tab> completion, stops at longest unique prefix
set wildmode=list:longest,full " enables a list of possible filenames to tab-completed
set wildignore=*.o,*.png,*.jpg " ignore these filetypes while expanding chars
" disable sound on errors
set noerrorbells
set t_vb=
set tm=500
" }}}
" theme/colors {{{
" ----------------------
set background=dark
syntax on " syntax highlighting
if has ("gui_running")
colorscheme solarized " awesome theme
" colorscheme ir_dark " my custom theme, see http://github.com/ryz/vim-irdark
else
colorscheme solarized " great colortheme
endif
set t_Co=256 " set terminal to 256 colors
" }}}
" status bar {{{
" ----------------------
" show paste mode in status bar
function! HasPaste()
if &paste
return '[PASTE]'
else
return ''
endif
endfunction
set statusline=%{hostname()}:%F%m%r%h%w\ [%{&ff}][%Y]\ [ascii=\%03.3b]\ [hex=\%02.2B]\ [pos=%04l,%04v][%p%%]\ [ln=%L]\ %{HasPaste()}" informative status line
set laststatus=2 " always show status line
set cmdheight=2 " height of the command line, e.g. two lines; helps to avoid 'hit ENTER to continue' message
set shortmess=a " keep status messages short; helps to avoid 'hit ENTER to continue' message
" }}}
" folding {{{
" ----------------------
if has ("folding")
set foldenable " turn on folding
set foldmethod=marker " auto-fold on marker
endif
" }}}
" text formatting/layout {{{
" ----------------------
" set nowrap " no line wrapping at all
set wrap " line wrapping
set textwidth=79 " wrap at line x
set formatoptions=qrn1
if exists('+colorcolumn')
set colorcolumn=+1 " show colored column at line x (+x of textwidth)
else
endif
set ai " autoindent
set si " smartindent
set ci
" tab behaviour
set expandtab " use spaces in place of tabs.
set tabstop=8 " number of spaces for a tab.
set softtabstop=4 " number of spaces for a tab in editing operations.
set shiftwidth=4 " number of spaces for indent (>>, <<, ...)
"au BufWinLeave * mkview " save fold/view state on exit
"au BufWinEnter * silent loadview " silently reload saved view state
" }}}
" plugin-stuff {{{
" ----------------------
" SnipMate related
let g:snippets_dir = '$VIM\vimfiles\bundle\snipmate-snippets\snippets'
" SuperTab related
let g:SuperTabDefaultCompletionType = "context"
" TagList related
let Tlist_Use_Right_Window = 1
let Tlist_Ctags_Cmd = 'd:\tools\ctags58\ctags.exe' " set Exuberant Ctags directory for TagList
" NERDTree related
let NERDTreeShowBookmarks = 1
let NERDTreeChDirMode = 2
let NERDTreeIgnore = ['\.vim$', '\~$', '.png', '.swp']
" }}}
" key bindings {{{
" ------------
" unmap cursor/arrow keys for navigation (to help me sticking to hjkl)
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" disable the infamous help key
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
" remap 'jj' in INSERT mode to escape
inoremap jj <ESC>
" remap leader key to , (useful for plugins like NERDCommenter)
let mapleader=","
" remap leader + space to clear search-highlighting
nnoremap <leader><space> :noh<CR>
" remap leader + s to replace word under cursor
nnoremap <Leader>s :%s#\<<C-r><C-w>\>#
nnoremap <Leader>S :%s#<C-r><C-w>#
" remap '%' to TAB for fast switching between bracket pairs
nnoremap <tab> %
vnoremap <tab> %
" map leader + m to open the MRU plugin
nnoremap <leader>m :MRU<CR>
"" .vimrc related stuff
" open new tab and edit $MYVIMRC
map <F9> :tabnew<CR>:e $MYVIMRC<CR>
" SOURCE current file
map <F10> :so %<CR>
" time and date via F3
nmap <F3> a<C-R>=strftime("%Y-%m-%d %H:%M:%S")<CR><Esc>
imap <F3> <C-R>=strftime("%Y-%m-%d %H:%M:%S")<CR>
" tabs
map <S-h> gT
map <S-l> gt
map tn :tabnew<CR>
map td :tabclose<CR>
"" executing/compiling files
" execute current file
map <F5> :!%<CR>
" compile current TeX file with 'pdflatex' (needs MiKTeX)
map <F6> :!pdflatex % &<CR>
" programming
" toggle NERDTree and TagList via F-keys
map <F7> :NERDTreeToggle<CR>
map <F8> :TlistToggle<CR>
" NERDTree via leader key
nnoremap <leader>n :NERDTree .<CR>
" }}}
" gui settings {{{
" ------------
" everything GUI-related that was not defined earlier
if has ("gui_running")
" set a nice, readable GUI font
if has ("win32")
set guifont=Dina:h16 " not a standard font
endif
if has ("mac")
set guifont=TerminusMedium:h12 " not a standard font
endif
set noantialias " turn off font anti aliasing
" turn off the GUI widgets
set guioptions-=T " remove the toolbar (icons on top of the screen)
set guioptions-=m " remove the menu bar
set guioptions-=r " remove the right scroll bar
endif
" }}}
" EOF