-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
282 lines (218 loc) · 7.76 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
281
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <[email protected]>
" Last change: 2008 Jul 02
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
" pathogen.vim
execute pathogen#infect()
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
"autocmd vimenter * NERDTree
" sets the language of the menu (gvim)
"set langmenu=en_GB.UTF-8
" Sets the language of the messages / ui (vim)
"language en
" Persistent undo
" tell it to use an undo file
set hidden
"set undofile
" " set a directory to store the undo history
"set undodir=~/.vim/undo
"set undolevels=1000 " How many undos
"set undoreload=5000 " number of lines to save for undo
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" To make sure arrow keys work
set term=builtin_ansi
set notimeout " don't timeout on mappings
set ttimeout " do timeout on terminal key codes
set timeoutlen=100 " timeout after 100 msec
set number " always show line numbers
set showmatch " set show matching parenthesis
"set ignorecase " ignore case when searching
"set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set smarttab " insert tabs on the start of a line according to
" shiftwidth, not tabstop
set hlsearch " highlight search terms
set incsearch " show search matches as you type
set visualbell " don't beep
set noerrorbells " don't beep
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set history=100 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set hlsearch " highlight searches
set incsearch " do incremental searching
set nobackup " do not keep a backup file
set ttyfast " smoother changes
set ttymouse=xterm2
set tabstop=2 " set tab = 2 spaces "
set shiftwidth=2 " set shift width = 2 spaces "
set expandtab
set pastetoggle=<F2>
" Instead of pressing shift + : you can just press ; !!
nnoremap ; :
set tw=0
" Word counter
function! WC()
let filename = expand("%")
let cmd = "detex " . filename . " | wc -w | tr -d [:space:]"
let result = system(cmd)
echo result . " words"
endfunction
command WC call WC()
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
" In many terminal emulators the mouse works just fine, thus enable it.
set mouse=a
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
" let fortran_free_source=1
let fotran_have_tabs=1
syntax on
set hlsearch
colorscheme koehler
set bg=dark
endif
set bg=dark
" GitHub markdown syntax downloaded from
" https://github.com/jtratner/vim-flavored-markdown
augroup markdown
au!
au BufNewFile,BufRead *.md,*.markdown setlocal filetype=ghmarkdown
augroup END
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
" set autoindent " always set autoindenting on
set noautoindent
set nosmartindent
set nocindent
endif " has("autocmd")
autocmd! BufRead,BufNewFile *.ics setfiletype icalendar
" tab navigation like firefox
nnoremap <C-p> :bprevious<cr>
nnoremap <C-n> :bnext<CR>
nnoremap <C-t> :enew<CR>
" tab navigation like firefox
nnoremap <A-p> :tabprevious<CR>
nnoremap <A-n> :tabnext<CR>
nnoremap <A-t> :tabnew<CR>
" Open new split panes to right and bottom, which feels more natural than
" Vim’s default:
"set splitbelow
set splitright
" We can use different key mappings for easy navigation between splits to save
" a keystroke. So instead of ctrl-w then j, it’s just ctrl-j:
nnoremap <C-j> <C-W>j
nnoremap <C-k> <C-W>k
nnoremap <C-h> <C-W>h
nnoremap <C-l> <C-W>l
" For MAC OS X remap Enter to insert a newline without going into insert mode
nnoremap o<Esc>
set wrap linebreak textwidth=0
" Spell checking highlighting
"
hi SpellBad cterm=underline,bold ctermfg=grey ctermbg=blue
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
" Vim markdown options
autocmd BufRead,BufNewFile *.md set filetype=markdown
let g:vim_markdown_math = 1
let g:vim_markdown_json_frontmatter = 1
let g:vim_markdown_new_list_item_indent = 2
let g:vim_markdown_folding_disabled = 1
" Fix backspace and delete issue
set backspace=indent,eol,start
set t_kb=
set t_kD=[3~
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" add all your plugins here (note older versions of Vundle
" used Bundle instead of Plugin)
Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'kien/rainbow_parentheses.vim'
"Plugin 'Valloric/YouCompleteMe'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Enable folding with the spacebar
nnoremap <space> za
" zR --> Open all folds. This sets 'foldlevel' to highest fold level.
" zM --> Close all folds: set 'foldlevel' to 0. 'foldenable' will be set.
" rainbow_parentheses options (https://github.com/kien/rainbow_parentheses.vim)
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['black', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['red', 'firebrick3'],
\ ]
let g:rbpt_max = 16
let g:rbpt_loadcmd_toggle = 0
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces