-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
288 lines (232 loc) · 8.34 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
282
283
284
285
286
287
288
" vim: foldmethod=marker:foldlevel=0
" Pathogen {{{
" call pathogen for enabling plugins
call pathogen#infect()
"}}}
" VIM Airline {{{
" patch je fonts. Instructies van: https://powerline.readthedocs.org/en/latest/fontpatching.html
" $ sudo apt-get install python-fontforge
" Copy the font file into ~/.fonts (or another X font directory):
" $ cp "MyFontFile for Powerline.otf" ~/.fonts
" Update your font cache:
" If you're using vim in a terminal you may need to close all
" open terminal windows after updating the font cache.
" $ fc-cache -vf ~/.fonts
" use 256 colors
set t_Co=256
" use unicode symbols
let g:Powerline_symbols = "fancy"
"}}}
" Tabs {{{
" mappings:
" map - keymap for normal, visual, select, oper.pending mode
" map! - keymap for insert and command-line mode
" nmap - Display normal mode maps
" imap - Display insert mode maps
" vmap - Display visual and select mode maps
" smap - Display select mode maps
" xmap - Display visual mode maps
" cmap - Display command-line mode maps
" omap - Display operator pending mode maps
" shortcuts for switching tabs. Now use alt+N or cmd+N for switching
map <M-1> 1gt
map <M-2> 2gt
map <M-3> 3gt
map <M-4> 4gt
map <M-5> 5gt
map <M-6> 6gt
map <M-7> 7gt
map <M-8> 8gt
map <M-9> 9gt
map <M-0> :tablast<CR>
"}}}
" Syntax {{{
" enable syntax highlighting
syntax on
syntax enable
" show linenumbers
set number
" Indentation settings for using 2 spaces instead of tabs.
" Do not change 'tabstop' from its default value of 8 with this setup.
set tabstop=4 " number of visual spaces per TAB
" set softtabstop=2 " the number of spaces that is inserted when you hit <TAB>
" set expandtab " use spaces instead of tabs (use for Python!)
"
" Highlight searches (use <C-L> to temporarily turn off highlighting; see the
" mapping of <C-L> below)
set hlsearch
"
" Show partial commands in the last line of the screen
"set showcmd
"
" Attempt to determine the type of a file based on its name and possibly its
" contents. Use this to allow intelligent auto-indenting for each filetype,
" and for plugins that are filetype specific.
" filetype indent plugin on
"
"}}}
" Search {{{
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
"}}}
" Miscellaneous {{{
" Allow vim settings in the header-comment
set modeline
"
" Always display the status line, even if only one window is displayed
set laststatus=2
"
" Instead of failing a command because of unsaved changes, instead raise a
" dialogue asking if you wish to save changed files.
set confirm
"
" Use visual bell instead of beeping when doing something wrong
set visualbell
"
" And reset the terminal code for the visual bell. If visualbell is set, and
" this line is also included, vim will neither flash nor beep. If visualbell
" is unset, this does nothing.
set t_vb=
"
" Set the command window height to 2 lines, to avoid many cases of having to
" "press <Enter> to continue"
set cmdheight=2
"
" Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search
nnoremap <C-L> :nohl<CR><C-L>
" colorscheme badwolf
colorscheme badwolf
" show command in bottom bar
set showcmd
" highlight current line
set cursorline
" visual autocomplete for command menu
set wildmenu
" leader is comma
let mapleader=","
" Easy shortcuts for editing the .vimrc and .bashrc
nnoremap <leader>ev :vsp $MYVIMRC<CR> " edit the vimrc
nnoremap <leader>eb :vsp ~/.bashrc<CR> " edit bashrc
nnoremap <leader>sv :source $MYVIMRC<CR> " execute the commands in .vimrc
" Toggle the Tagbar (plugin: http://majutsushi.github.io/tagbar/)
nmap <F8> :TagbarToggle<CR>
" ControlP plugin
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
"}}}
" NERDTree {{{
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" C-n or :NERDTreeToggle # opens NERDTree
"""""""""""""""""""
" O P E N I N G
" m # opens menu mode for creating/deleting files, 'Ctrl-c' exits out of this mode
" i # opens file with horizontal split
" s # opens file in vertical split
" o or <enter> # opens selected file
" t # opens file in new tab
"""""""""""""""""""
" B O O K M A R K S
" B # shows bookmarks
" :Bookmark <name> # creates bookmark for selected tree branch
" D # deletes selected bookmark
" :NERDTreeFind # finds current file in tree
" q # closes NERDTree
" Ctrl-w-w # jump cursor to next viewport including the one for NERDTree
" gt and gT # switches between tabs
" Toggle Nerdtree with ctrl+N
nmap <c-n> :NERDTreeToggle<CR>
"" Optional, to show special NERDTree browser characters properly (e.g. on remote linux system)
let g:NERDTreeDirArrows=0
"" Show bookmarks by default
let NERDTreeShowBookmarks=1
"}}}
" SESSIONS {{{
" save session
nnoremap <leader>s :mksession<CR>
"}}}
" Folding {{{
" Enable folding, show all folds
set foldenable
" Open most folds by default
set foldlevelstart=10
" Folds can be nested. Setting a max on the number of
" folds guards against too many folds
set foldnestmax=10
" fold based on indent level. Other acceptable values are marker,
" manual, expr, syntax, diff
set foldmethod=indent
" Use <space> for opening/closing folds
nnoremap <space> za
" each time you close a file, its fold state will be saved and reloaded
" when you reopen the file in Vim
au BufWinLeave * mkview
au BufWinEnter * silent loadview
" }}}
" TMUX {{{
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" source: http://manuals.bioinformatics.ucr.edu/home/programming-in-r/vim-r
" sample settings for vim-r-plugin and screen.vim
" Installation
" - Place plugin file under ~/.vim/
" - To activate help, type in vim :helptags ~/.vim/doc
" - Place the following vim conf lines in .vimrc
" Usage
" - Read intro/help in vim with :h vim-r-plugin or :h screen.txt
" - To initialize vim/R session, start screen/tmux, open some *.R file in vim and then hit F2 key
" - Object/omni completion command CTRL-X CTRL-O
" - To update object list for omni completion, run :RUpdateObjList
" My favorite Vim/R window arrangement
" tmux attach
" Open *.R file in Vim and hit F2 to open R
" Go to R pane and create another pane with C-a %
" Open second R session in new pane
" Go to vim pane and open a new viewport with :split *.R
" Useful tmux commands
" tmux new -s <myname> start new session with a specific name
" tmux ls (C-a-s) list tmux session
" tmux attach -t <id> attach to specific session
" tmux kill-session -t <id> kill specific session
" C-a-: kill-session kill a session
" C-a % split pane vertically
" C-a " split pane horizontally
" C-a-o jump cursor to next pane
" C-a C-o swap panes
" C-a-: resize-pane -L 10 resizes pane by 10 to left (L R U D)
" Corresponding Vim commands
" :split or :vsplit split viewport
" C-w-w jump cursor to next pane-
" C-w-r swap viewports
" C-w C-++ resize viewports to equal split
" C-w 10+ increase size of current pane by value
" To open R in terminal rather than RGui (only necessary on OS X)
" let vimrplugin_applescript = 0
" let vimrplugin_screenplugin = 0
" For tmux support
let g:ScreenImpl = 'Tmux'
let vimrplugin_screenvsplit = 1 " For vertical tmux split
let g:ScreenShellInitialFocus = 'shell'
" instruct to use your own .screenrc file
let g:vimrplugin_noscreenrc = 1
" For integration of r-plugin with screen.vim
"let g:vimrplugin_screenplugin = 1
" Don't use conque shell if installed
let vimrplugin_conqueplugin = 0
" map the letter 'r' to send visually selected lines to R
"let g:vimrplugin_map_r = 1
" see R documentation in a Vim buffer
"let vimrplugin_vimpager = "no"
" start R with F2 key
"map <F2> <Plug>RStart
"imap <F2> <Plug>RStart
"vmap <F2> <Plug>RStart
" send selection to R with space bar
"vmap <Space> <Plug>RDSendSelection
" send line to R with space bar
"nmap <Space> <Plug>RDSendLine
" Remove the Background Color Eraser (http://superuser.com/questions/399296/256-color-support-for-vim-background-in-tmux)
set t_ut=
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"}}}