Mercurial > dotfiles
annotate vim/vimrc @ 440:4b816faa06e2
Remove CtrlP, add statusline refresh.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 29 Apr 2018 20:12:47 -0700 |
parents | f1f95a19fffe |
children | a3c6869085c1 |
rev | line source |
---|---|
6 | 1 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
2 " | |
0 | 3 " Ludovic Chabant's ~/.vimrc |
4 " | |
6 | 5 " http://ludovic.chabant.com |
6 " | |
7 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
0 | 8 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
9 " Global Setup {{{ |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
10 |
0 | 11 " Use Vim settings, rather then Vi settings (much better!). |
12 " This must be first, because it changes other options as a side effect. | |
13 set nocompatible | |
14 | |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
15 " Set a variable that says we already sourced this file, for those few |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
16 " settings we don't want to re-apply. |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
17 if exists('g:sourced_vimrc') |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
18 let g:resourcing_vimrc = 1 |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
19 endif |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
20 let g:sourced_vimrc = 1 |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
21 |
386
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
22 " Local pre-override. |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
23 let s:local_vimrc_pre = ludo#localpath('vimrc-local-pre') |
386
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
24 if filereadable(s:local_vimrc_pre) |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
25 execute 'source' s:local_vimrc_pre |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
26 endif |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
27 |
127
1f709d7e03c6
Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
118
diff
changeset
|
28 " Make sure `filetype` stuff is turned off before loading Pathogen. |
1f709d7e03c6
Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
118
diff
changeset
|
29 syntax off |
1f709d7e03c6
Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
118
diff
changeset
|
30 filetype off |
1f709d7e03c6
Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
118
diff
changeset
|
31 |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
32 " Disable some plugins. |
386
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
33 let g:pathogen_disabled = get(g:, 'pathogen_disabled', []) |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
34 call ludo#setup_pathogen([ludo#localpath('bundle'), ludo#localpath('local')]) |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
35 |
347
4d73159f56ca
Use pathogen as a sub-repo, plus a few Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
332
diff
changeset
|
36 " Load pathogen. |
349
8d68547c3660
Fix pathogen initialization.
Ludovic Chabant <ludovic@chabant.com>
parents:
347
diff
changeset
|
37 runtime bundle/pathogen/autoload/pathogen.vim |
352
9580765366a4
Fix some python indenting stuff in vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
349
diff
changeset
|
38 " Add the bundle directory, and potentially add the local one if it exists. |
9580765366a4
Fix some python indenting stuff in vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
349
diff
changeset
|
39 " Note that we pass absolute paths to make pathogen prepend stuff before Vim's |
9580765366a4
Fix some python indenting stuff in vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
349
diff
changeset
|
40 " system files otherwise stuff like indent plugins don't work. |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
41 let s:pathogen_bundles = [ludo#localpath('bundle', '{}')] |
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
42 if isdirectory(ludo#localpath('local')) |
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
43 call add(s:pathogen_bundles, ludo#localpath('local', '{}')) |
286
a29080fb35d9
Add support for local Vim bundle.
Ludovic Chabant <ludovic@chabant.com>
parents:
284
diff
changeset
|
44 endif |
347
4d73159f56ca
Use pathogen as a sub-repo, plus a few Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
332
diff
changeset
|
45 call call('pathogen#infect', s:pathogen_bundles) |
0 | 46 |
10
00cac5ebf546
Added default window size. Added buffer keyboard shortcuts.
ludovicchabant
parents:
6
diff
changeset
|
47 " Hide the toolbar in MacVim/gVIM, and set a nice window size. |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
48 if has("gui_running") && !exists('g:resourcing_vimrc') |
0 | 49 set guioptions=-t |
235
ceb3f44fa2fc
Update sub-repos, make Vim maximized by default.
Ludovic Chabant <ludovic@chabant.com>
parents:
233
diff
changeset
|
50 set lines=999 |
ceb3f44fa2fc
Update sub-repos, make Vim maximized by default.
Ludovic Chabant <ludovic@chabant.com>
parents:
233
diff
changeset
|
51 set columns=999 |
323
e2d944ecda66
Maximize on startup on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
320
diff
changeset
|
52 if has("win32") |
e2d944ecda66
Maximize on startup on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
320
diff
changeset
|
53 au GUIEnter * simalt ~x |
e2d944ecda66
Maximize on startup on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
320
diff
changeset
|
54 endif |
0 | 55 endif |
56 | |
420 | 57 function! s:HasPlugin(plugname) abort |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
58 return globpath(&runtimepath, 'plugin/'.a:plugname.'.vim') !=# '' |
420 | 59 endfunction |
60 | |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
61 " }}} |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
62 |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
63 " General Settings {{{ |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
64 |
135 | 65 " Restrict modelines. |
66 set modelines=1 | |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
67 |
6 | 68 " Don't unload abandoned buffers. |
69 set hidden | |
0 | 70 |
6 | 71 " Show line numbers. |
72 set number | |
73 | |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
74 " Show what mode we're in, and what command we're typing. |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
75 set showmode |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
76 set showcmd |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
77 |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
78 " Keep the cursor off the top/bottom edges. |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
79 set scrolloff=3 |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
80 |
6 | 81 " Smart auto-indenting. |
0 | 82 set autoindent |
83 set smartindent | |
6 | 84 |
85 " Use confirmation dialog. | |
0 | 86 set confirm |
6 | 87 |
76
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
88 " Don't use annoying sounds. |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
89 set visualbell |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
90 |
6 | 91 " Remember lots of commands. |
0 | 92 set history=1000 |
6 | 93 |
76
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
94 " Try to reduce flickering. |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
95 set lazyredraw |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
96 |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
97 " Show matching braces but not for too long. |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
98 set showmatch |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
99 set matchtime=2 |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
100 |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
101 " Show soft-broken/wrapped lines with a prefix. |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
102 set showbreak=→ |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
103 |
6 | 104 " Use incremental search, with highlighting, |
105 " case-insensitive unless we actually type some | |
106 " mixed-case stuff. | |
0 | 107 set incsearch |
108 set hlsearch | |
109 set ignorecase | |
110 set smartcase | |
6 | 111 |
112 " Always show window status lines. | |
0 | 113 set laststatus=2 |
6 | 114 |
115 " Enable using the mouse like some everyday guy. | |
0 | 116 set mouse=a |
6 | 117 |
118 " Show interesting stuff at the bottom of the window. | |
0 | 119 set showcmd |
120 set ruler | |
6 | 121 |
76
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
122 " Make sure splitting windows is done in a way that makes sense. |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
123 set splitbelow |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
124 set splitright |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
125 |
6 | 126 " Don't pollute the hard-drive with *~ files. Only |
127 " create them in hidden backup/temp directories while | |
128 " we edit the file, and then get rid of it. | |
0 | 129 set nobackup |
130 set writebackup | |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
131 execute('set backupdir='.ludo#localpath('backup')) |
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
132 execute('set directory='.ludo#localpath('temp')) |
6 | 133 |
134 " Better command-line completion, but don't show some | |
135 " stuff we don't care about. | |
0 | 136 set wildmenu |
317 | 137 set wildmode=list:longest |
138 set wildignore+=.DS_Store,Thumbs.db | |
139 set wildignore+=*.so,*.dll,*.exe,*.lib,*.pdb | |
140 set wildignore+=*.pyc,*.pyo | |
141 set wildignore+=*.swp | |
142 | |
143 set formatoptions=croqn1 | |
6 | 144 |
145 " Always display the tab-page line. | |
0 | 146 set showtabline=2 |
6 | 147 |
148 " Set the file-formats. | |
0 | 149 set ffs=unix,mac,dos |
6 | 150 |
151 " Tabs and indenting are 4 characters, and tabs behave like | |
152 " spaces during editing. They're smart, too, and when you | |
153 " press <TAB> it actually inserts a soft-tab so everything's | |
154 " indented the same. | |
0 | 155 set tabstop=4 |
156 set shiftwidth=4 | |
157 set softtabstop=4 | |
158 set smarttab | |
159 set expandtab | |
6 | 160 |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
161 " Default encoding |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
162 set encoding=utf-8 |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
163 |
6 | 164 " Clipboard buffer. |
0 | 165 set clipboard=unnamed |
6 | 166 |
352
9580765366a4
Fix some python indenting stuff in vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
349
diff
changeset
|
167 " Smooth terminal experience. |
0 | 168 set ttyfast |
6 | 169 |
170 " Allow backspacing over anything. | |
0 | 171 set backspace=indent,eol,start |
172 | |
6 | 173 " Going left and right let you go to other lines. |
174 set whichwrap+=<,>,h,l | |
175 | |
93
822fc8b4405f
Invisible characters in vimrc.
Ludovic Chabant <ludovic@chabant.com>
parents:
92
diff
changeset
|
176 " How to show invisible characters |
822fc8b4405f
Invisible characters in vimrc.
Ludovic Chabant <ludovic@chabant.com>
parents:
92
diff
changeset
|
177 set listchars=eol:$,tab:>-,trail:-,extends:>,precedes:<,nbsp:%,conceal:. |
822fc8b4405f
Invisible characters in vimrc.
Ludovic Chabant <ludovic@chabant.com>
parents:
92
diff
changeset
|
178 |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
179 " Nice auto-complete menu. |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
180 set complete=.,w,b |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
181 set completeopt=longest,menuone,preview |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
182 |
121
c6f0172aac8d
Add nice column indicators in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
119
diff
changeset
|
183 " Column indicators. |
c6f0172aac8d
Add nice column indicators in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
119
diff
changeset
|
184 set colorcolumn=72,79 |
c6f0172aac8d
Add nice column indicators in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
119
diff
changeset
|
185 |
6 | 186 " And now, for some system-dependent settings: |
187 " - font to use | |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
188 if ludo#platform() == "windows" |
439
f1f95a19fffe
Adjust the font size.
Ludovic Chabant <ludovic@chabant.com>
parents:
435
diff
changeset
|
189 set guifont=InputMono:h10,Hack:h12,Consolas:h12 |
6 | 190 else |
439
f1f95a19fffe
Adjust the font size.
Ludovic Chabant <ludovic@chabant.com>
parents:
435
diff
changeset
|
191 set guifont=InputMono:h10,Hack:h12,Monaco:h12 |
6 | 192 endif |
193 | |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
194 " Syntax highlighting. |
0 | 195 syntax on |
196 | |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
197 " Change the current directory to the home directory. |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
198 if !exists('g:resourcing_vimrc') |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
199 cd ~/ |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
200 endif |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
201 |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
202 " Default color scheme. |
47 | 203 if has('gui_running') |
217
6ee245fa8a3d
Proper colors in iTerm2, and now using solarized for a change.
Ludovic Chabant <ludovic@chabant.com>
parents:
213
diff
changeset
|
204 set background=dark |
47 | 205 else |
206 set background=dark | |
314 | 207 let g:solarized_termcolors = 256 |
208 let g:solarized_termtrans = 1 | |
47 | 209 endif |
217
6ee245fa8a3d
Proper colors in iTerm2, and now using solarized for a change.
Ludovic Chabant <ludovic@chabant.com>
parents:
213
diff
changeset
|
210 colorscheme solarized |
6 | 211 |
212 " Enable file type detection. | |
0 | 213 filetype indent plugin on |
214 | |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
215 " }}} |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
216 |
76
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
217 " Auto-Commands {{{ |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
218 |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
219 " Only show the highlighted cursor line in the current window. |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
220 augroup CursorLine |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
221 au! |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
222 au WinLeave * set nocursorline |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
223 au WinEnter * set cursorline |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
224 augroup END |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
225 |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
226 " }}} |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
227 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
228 " Plugin Settings {{{ |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
229 |
309
5b7acab16766
Make NERDTree ignore stuff, and other Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
230 " NERDTree {{{ |
5b7acab16766
Make NERDTree ignore stuff, and other Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
231 |
320 | 232 let NERDTreeRespectWildIgnore = 1 |
309
5b7acab16766
Make NERDTree ignore stuff, and other Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
233 |
5b7acab16766
Make NERDTree ignore stuff, and other Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
234 " }}} |
5b7acab16766
Make NERDTree ignore stuff, and other Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
235 |
430
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
236 " Ack {{{ |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
237 |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
238 if executable('ag') |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
239 let g:ackprg = 'ag --vimgrep' |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
240 endif |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
241 |
440
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
242 nnoremap <leader>a :Ack!<Space> |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
243 nnoremap <leader>f :Ack! /<C-R><C-W>/ |
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
244 vnoremap <leader>f "zy:Ack! /<C-R>z/ |
430
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
245 |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
246 " }}} |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
247 |
178 | 248 " Ctrl-P {{{ |
249 | |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
250 " We'll set our own mappings. |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
251 let g:ctrlp_map = '' |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
252 |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
253 " Ctrl-P should manage the working directory. |
173
393449253540
Use the new notation for `ctrlp` setting.
Ludovic Chabant <ludovic@chabant.com>
parents:
171
diff
changeset
|
254 let g:ctrlp_working_path_mode = 'ra' |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
255 |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
256 " Ctrl-P should however ignore some stuff. |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
257 let g:ctrlp_custom_ignore = { |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
258 \ 'dir': '\v[\/](\.git|\.hg|\.svn|venv|static|node_modules|_cache|_counter)$' |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
259 \ } |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
260 |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
261 " Make Ctrl-P cache stuff in our temp directory. |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
262 let g:ctrlp_cache_dir = ludo#localpath('cache') |
10
00cac5ebf546
Added default window size. Added buffer keyboard shortcuts.
ludovicchabant
parents:
6
diff
changeset
|
263 |
197
4d34bf15a478
Don't clear CtrlP cache on exit, fix Windows issues.
Ludovic Chabant <ludovic@chabant.com>
parents:
193
diff
changeset
|
264 " Remember things. |
386
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
265 let g:ctrlp_clear_cache_on_exit = 0 |
197
4d34bf15a478
Don't clear CtrlP cache on exit, fix Windows issues.
Ludovic Chabant <ludovic@chabant.com>
parents:
193
diff
changeset
|
266 |
317 | 267 " Don't include some stuff in the most recently used list. |
268 let g:ctrlp_mruf_exclude = 'hg\-editor\-\d+\.txt' | |
269 | |
193
ae53d68033d9
Enable fugitive and some CtrlP extensions, include a new one of my own.
Ludovic Chabant <ludovic@chabant.com>
parents:
191
diff
changeset
|
270 " Enable some cool extensions. |
240
3a6b11d16a2a
Simpler registration for CtrlP extensions.
Ludovic Chabant <ludovic@chabant.com>
parents:
235
diff
changeset
|
271 let g:ctrlp_extensions = [ |
266
de3ef7fbcfc1
Add CtrlP's bookmarkdir extension.
Ludovic Chabant <ludovic@chabant.com>
parents:
252
diff
changeset
|
272 \'tag', 'buffertag', 'quickfix', 'mixed', 'bookmarkdir', |
288
25b672f0f6bd
Remove `projectjump` CtrlP plugin, just use the bookmarks.
Ludovic Chabant <ludovic@chabant.com>
parents:
287
diff
changeset
|
273 \'autoignore' |
240
3a6b11d16a2a
Simpler registration for CtrlP extensions.
Ludovic Chabant <ludovic@chabant.com>
parents:
235
diff
changeset
|
274 \] |
193
ae53d68033d9
Enable fugitive and some CtrlP extensions, include a new one of my own.
Ludovic Chabant <ludovic@chabant.com>
parents:
191
diff
changeset
|
275 |
367 | 276 " Use PyMatch to go faster. |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
277 if (has('python3') || has('python')) && s:HasPlugin('ctrlp-py-matcher') |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
278 let g:ctrlp_match_func = {'match': 'pymatcher#PyMatch'} |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
279 let g:ctrlp_max_files = 0 |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
280 let g:ctrlp_lazy_update = 350 |
367 | 281 endif |
282 | |
178 | 283 " }}} |
284 | |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
285 " FZF {{{ |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
286 |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
287 if ludo#platform() == 'mac' |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
288 if filereadable('/usr/local/opt/fzf/plugin/fzf.vim') |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
289 " FZF installed via Homebrew. |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
290 source /usr/local/opt/fzf/plugin/fzf.vim |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
291 endif |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
292 endif |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
293 |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
294 let g:fzf_action = { |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
295 \'ctrl-t': 'tab split', |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
296 \'ctrl-v': 'vsplit', |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
297 \'ctrl-x': 'split', |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
298 \} |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
299 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
300 " }}} |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
301 |
213
769869e61101
Renamed autotags to gutentags.
Ludovic Chabant <ludovic@chabant.com>
parents:
212
diff
changeset
|
302 " Gutentags {{{ |
206 | 303 |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
304 let g:gutentags_cache_dir = ludo#localpath('tags') |
373 | 305 let g:gutentags_ctags_exclude = ['venv', 'build', 'static', 'node_modules'] |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
306 let g:gutentags_ctags_extra_args = ['--options='.ludo#localpath('ctagsrc')] |
420 | 307 let g:gutentags_ctags_exclude_wildignore = 0 |
206 | 308 |
440
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
309 augroup GutentagsStatusLineRefresher |
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
310 autocmd! |
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
311 autocmd User GutentagsUpdating call lightline#update() |
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
312 autocmd User GutentagsUpdated call lightline#update() |
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
313 augroup END |
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
314 |
206 | 315 " }}} |
316 | |
178 | 317 " Syntastic {{{ |
318 | |
314 | 319 let g:syntastic_auto_loc_list = 2 |
305
a333541a5c74
Syntastic config changes.
Ludovic Chabant <ludovic@chabant.com>
parents:
304
diff
changeset
|
320 let g:syntastic_check_on_open = 1 |
a333541a5c74
Syntastic config changes.
Ludovic Chabant <ludovic@chabant.com>
parents:
304
diff
changeset
|
321 let g:syntastic_check_on_wq = 0 |
a333541a5c74
Syntastic config changes.
Ludovic Chabant <ludovic@chabant.com>
parents:
304
diff
changeset
|
322 |
219
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
323 " flake8 includes pyflakes, pep8, and mccabe |
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
324 " I could maybe replace pyflakes with frosted? |
252
a2e31e166cb9
Just keep flake8 for Python checking in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
240
diff
changeset
|
325 let g:syntastic_python_checkers = ['flake8'] ", 'pylint'] |
219
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
326 let g:syntastic_python_python_exec = 'python3' |
397
c32b9b172314
Specify YCM/OmniSharp mappings only for specific file types.
Ludovic Chabant <ludovic@chabant.com>
parents:
392
diff
changeset
|
327 let g:syntastic_python_flake8_args='--ignore=W191,W391' |
219
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
328 |
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
329 " }}} |
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
330 |
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
331 " Supertab {{{ |
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
332 |
308 | 333 let g:SuperTabDefaultCompletionType = "context" |
334 let g:SuperTabLongestEnhanced = 1 | |
335 let g:SuperTabLongestHighlight = 0 | |
219
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
336 let g:SuperTabCrMapping = 1 |
178 | 337 |
338 " }}} | |
339 | |
340 " Lawrencium {{{ | |
118
c1ff96232138
New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents:
114
diff
changeset
|
341 |
127
1f709d7e03c6
Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
118
diff
changeset
|
342 " Custom Mercurial commands highlighting in Lawrencium. |
118
c1ff96232138
New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents:
114
diff
changeset
|
343 let g:lawrencium_hg_commands_file_types = { |
c1ff96232138
New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents:
114
diff
changeset
|
344 \'clog': 'hggraphlog' |
c1ff96232138
New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents:
114
diff
changeset
|
345 \} |
c1ff96232138
New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents:
114
diff
changeset
|
346 |
127
1f709d7e03c6
Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
118
diff
changeset
|
347 " Make the annotate window better in Lawrencium. |
206 | 348 let g:lawrencium_annotate_width_offset = 1 |
127
1f709d7e03c6
Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
118
diff
changeset
|
349 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
350 " }}} |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
351 |
178 | 352 " Gundo {{{ |
353 | |
354 let g:gundo_map_move_older = '<Down>' | |
355 let g:gundo_map_move_newer = '<Up>' | |
356 | |
357 " }}} | |
358 | |
359 " YankRing {{{ | |
360 | |
361 let g:yankring_replace_n_pkey = '<C-K>' | |
362 let g:yankring_replace_p_pkey = '<C-J>' | |
363 | |
364 " }}} | |
365 | |
366 " Python-Mode {{{ | |
367 | |
419
c4077384f55f
Use `InputMono` or `Hack` if they're installed.
Ludovic Chabant <ludovic@chabant.com>
parents:
414
diff
changeset
|
368 let g:pymode = 0 |
352
9580765366a4
Fix some python indenting stuff in vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
349
diff
changeset
|
369 let g:pymode_python = 'python3' |
307
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
370 |
314 | 371 let g:pymode_syntax = 0 |
307
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
372 let g:pymode_syntax_all = 0 |
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
373 let g:pymode_syntax_builtin_objs = 1 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
374 let g:pymode_syntax_print_as_function = 1 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
375 let g:pymode_syntax_space_errors = 1 |
307
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
376 |
352
9580765366a4
Fix some python indenting stuff in vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
349
diff
changeset
|
377 let g:pymode_indent = 0 |
9580765366a4
Fix some python indenting stuff in vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
349
diff
changeset
|
378 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
379 let g:pymode_run = 0 |
307
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
380 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
381 let g:pymode_lint = 0 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
382 let g:pymode_trim_whitespaces = 0 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
383 let g:pymode_folding = 1 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
384 |
307
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
385 let g:pymode_doc = 1 |
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
386 let g:pymode_doc_bind = 'K' |
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
387 |
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
388 let g:pymode_virtualenv = 0 |
178 | 389 |
314 | 390 let g:pymode_rope = 0 |
391 | |
178 | 392 " }}} |
393 | |
379
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
394 " Lightline {{{ |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
395 let g:lightline = { |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
396 \'colorscheme': 'solarized', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
397 \'active': { |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
398 \ 'left': [ ['mode', 'paste'], |
386
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
399 \ ['fugitive', 'lawrencium', 'readonly', 'relativepath', 'modified'], |
379
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
400 \ ['ctrlpmark'] ], |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
401 \ 'right': [ ['lineinfo'], |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
402 \ ['percent'], |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
403 \ ['fileformat', 'fileencoding', 'filetype'], |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
404 \ ['gutentags', 'syntastic', 'ycm_errs', 'ycm_warns'] ] |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
405 \ }, |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
406 \'component_function': { |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
407 \ 'fugitive': '_LightlineFugitive', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
408 \ 'lawrencium': '_LightlineLawrencium', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
409 \ 'ctrlpmark': '_LightlineCtrlPMark', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
410 \ }, |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
411 \'component_expand': { |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
412 \ 'syntastic': '_LightlineSyntastic', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
413 \ 'ycm_errs': '_LightlineYcmErrors', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
414 \ 'ycm_warns': '_LightlineYcmWarnings', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
415 \ 'gutentags': '_LightlineGutentags', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
416 \ }, |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
417 \'component_type': { |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
418 \ 'syntastic': 'error', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
419 \ 'ycm_errs': 'error', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
420 \ 'ycm_warns': 'warning', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
421 \ 'gutentags': 'warning', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
422 \ }, |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
423 \} |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
424 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
425 function! _LightlineFugitive() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
426 return fugitive#head() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
427 endfunction |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
428 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
429 function! _LightlineLawrencium() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
430 return lawrencium#statusline() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
431 endfunction |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
432 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
433 function! _LightlineCtrlPMark() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
434 if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item') |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
435 call lightline#link('iR'[g:lightline.ctrlp_regex]) |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
436 return lightline#concatenate( |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
437 \['WAT?', g:lightline.ctrlp_prev, |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
438 \ g:lightline.ctrlp_item, |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
439 \ g:lightline.ctrlp_next], |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
440 \0) |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
441 else |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
442 return '' |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
443 endif |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
444 endfunction |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
445 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
446 function! _LightlineGutentags() |
430
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
447 return gutentags#statusline('', '', '♨') |
379
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
448 endfunction |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
449 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
450 function! _LightlineSyntastic() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
451 return SyntasticStatuslineFlag() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
452 endfunction |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
453 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
454 function! _LightlineYcmErrors() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
455 let l:cnt = youcompleteme#GetErrorCount() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
456 return l:cnt > 0 ? string(l:cnt) : '' |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
457 endfunction |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
458 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
459 function! _LightlineYcmWarnings() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
460 let l:cnt = youcompleteme#GetWarningCount() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
461 return l:cnt > 0 ? string(l:cnt) : '' |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
462 endfunction |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
463 " }}} |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
464 |
386
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
465 " YouCompleteMe {{{ |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
466 |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
467 let g:ycm_always_populate_location_list = 1 |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
468 |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
469 " }}} |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
470 |
178 | 471 " }}} |
472 | |
73
39a7e05637d8
Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents:
67
diff
changeset
|
473 " File-Specific Settings {{{ |
39a7e05637d8
Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents:
67
diff
changeset
|
474 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
475 augroup VimRCFileType_markdown |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
476 au! |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
477 autocmd FileType text,markdown setlocal textwidth=80 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
478 autocmd FileType markdown nnoremap <buffer> <localleader>1 yypVr=:redraw<cr> |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
479 autocmd FileType markdown nnoremap <buffer> <localleader>2 yypVr-:redraw<cr> |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
480 autocmd FileType markdown nnoremap <buffer> <localleader>3 mzI###<space><esc>`z4l |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
481 autocmd FileType markdown nnoremap <buffer> <localleader>4 mzI####<space><esc>`z5l |
176 | 482 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
483 autocmd BufRead,BufNewfile */Dropbox/Personal/SimpleNote/* set ft=markdown |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
484 autocmd BufRead,BufNewFile */_content/**/*.html set ft=piecrustmarkdown |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
485 augroup END |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
486 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
487 augroup VimRCFileType_php |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
488 au! |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
489 " Who the hell changes my matchpairs? |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
490 autocmd FileType php setlocal matchpairs-=<:> |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
491 augroup END |
83 | 492 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
493 augroup VimRCFileType_c |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
494 au! |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
495 autocmd FileType c,c++,cpp setlocal foldmethod=syntax |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
496 autocmd FileType c,c++,cpp setlocal colorcolumn=120 |
413
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
497 autocmd FileType c,c++,cpp setlocal synmaxcol=200 |
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
498 autocmd FileType c,c++,cpp nnoremap <buffer> <localleader>z :call <SID>ToggleCppFolding()<CR> |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
499 augroup END |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
500 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
501 augroup VimRCFileType_csharp |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
502 au! |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
503 autocmd BufNewFile,BufRead *.xaml setlocal filetype=xml |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
504 autocmd FileType cs setlocal foldmethod=syntax |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
505 autocmd FileType cs setlocal colorcolumn=120 |
413
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
506 autocmd FileType cs setlocal synmaxcol=200 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
507 augroup END |
83 | 508 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
509 augroup VimRCFileType_css |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
510 au! |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
511 autocmd BufNewFile,BufRead *.less setlocal filetype=less |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
512 autocmd Filetype less,css setlocal foldmethod=marker |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
513 autocmd Filetype less,css setlocal foldmarker={,} |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
514 autocmd Filetype less,css setlocal iskeyword+=- |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
515 autocmd Filetype less,css setlocal omnifunc=csscomplete#CompleteCSS |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
516 augroup END |
160 | 517 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
518 augroup VimRCTrailingWhitespaces |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
519 au! |
287
44c9d65cfa74
Readjust some Vim config stuff around folding.
Ludovic Chabant <ludovic@chabant.com>
parents:
286
diff
changeset
|
520 autocmd FileType php,ruby,python,js,css,less autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces() |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
521 augroup END |
73
39a7e05637d8
Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents:
67
diff
changeset
|
522 |
39a7e05637d8
Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents:
67
diff
changeset
|
523 " }}} |
39a7e05637d8
Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents:
67
diff
changeset
|
524 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
525 " Mappings {{{ |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
526 |
42
6b831735c092
Added french keymap support.
Ludovic Chabant <ludovic@chabant.com>
parents:
18
diff
changeset
|
527 let mapleader="," |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
528 |
76
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
529 " Visual line navigation |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
530 noremap <up> g<up> |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
531 noremap <down> g<down> |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
532 noremap <home> g<home> |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
533 noremap <end> g<end> |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
534 |
367 | 535 noremap <S-up> 20<up> |
536 noremap <S-down> 20<down> | |
537 | |
169
4947d1f99b72
Better tab/buffer navigation.
Ludovic Chabant <ludovic@chabant.com>
parents:
163
diff
changeset
|
538 " Tab navigation |
178 | 539 noremap <C-Tab> :tabnext<cr> |
540 noremap <C-S-Tab> :tabprevious<cr> | |
304
50fbd059a6a1
More Vim customizations.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
541 nnoremap <leader>t :tabnew<cr> |
169
4947d1f99b72
Better tab/buffer navigation.
Ludovic Chabant <ludovic@chabant.com>
parents:
163
diff
changeset
|
542 |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
543 " Window navigation |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
544 nnoremap <C-up> :wincmd k<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
545 nnoremap <C-down> :wincmd j<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
546 nnoremap <C-left> :wincmd h<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
547 nnoremap <C-right> :wincmd l<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
548 |
176 | 549 " Switch buffers. |
420 | 550 nnoremap <F1> :execute ("buffer " . bufname("#"))<cr> |
83 | 551 |
176 | 552 " NERDTree. |
420 | 553 nnoremap <F2> :call <SID>ToggleNERDTree()<cr> |
554 nnoremap <C-F2> :call <SID>FindInNERDTree()<cr> | |
83 | 555 |
157
7fd22eb11789
Added `tagbar` for Vim, with keyboard shortcut.
Ludovic Chabant <ludovic@chabant.com>
parents:
155
diff
changeset
|
556 " Tagbar. |
420 | 557 nnoremap <F3> :TagbarToggle<cr> |
558 nnoremap <C-F3> :TagbarOpenAutoClose<cr> | |
157
7fd22eb11789
Added `tagbar` for Vim, with keyboard shortcut.
Ludovic Chabant <ludovic@chabant.com>
parents:
155
diff
changeset
|
559 |
186
01304e9b4c19
Re-add Gundo mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
185
diff
changeset
|
560 " Gundo. |
420 | 561 nnoremap <F4> :GundoToggle<cr> |
562 | |
563 " F5 to F8 are available for context-dependent mappings. | |
564 | |
565 " Jump to tags by keeping things better in view. Option for jumping to a tag | |
566 " in a split window where everything is folded except what you need to see. | |
567 " Note that if a tag search yield multiple possible results, we will still run | |
568 " some of that `zvzz` stuff, but that's OK, the main point is to not mess up | |
569 " the result selection window either. | |
570 " | |
571 " Go back after checking out a tag. | |
572 nnoremap <F9> :pop<CR> | |
573 " Go check out a tag. | |
574 nnoremap <F10> g<C-]>zvzz | |
575 " Go check out a tag in a split window. | |
576 nnoremap <S-F10> <C-W>vg<C-]>zMzvzz | |
577 " Move to previous matching tag. | |
578 nnoremap <C-F9> :tprevious<CR> | |
579 " Move to next matching tag. | |
580 nnoremap <C-F10> :tnext<CR> | |
186
01304e9b4c19
Re-add Gundo mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
185
diff
changeset
|
581 |
83 | 582 " Common typos. |
583 nnoremap ; : | |
584 | |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
585 " Split windows |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
586 nnoremap <leader>s :split<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
587 nnoremap <leader>v :vsplit<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
588 |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
589 " Easier things to type |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
590 nnoremap <leader>w :w<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
591 nnoremap <leader>q :q<cr> |
119 | 592 nnoremap <leader>hh :Hg |
593 nnoremap <leader>hg :Hg! | |
112 | 594 nnoremap <leader>hs :Hgstatus<cr> |
595 nnoremap <leader>hv :Hgvdiff<cr> | |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
596 |
114
ccc3902408d2
Fix the hash key in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
113
diff
changeset
|
597 " Make the hash-key not suck. |
ccc3902408d2
Fix the hash key in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
113
diff
changeset
|
598 inoremap # X<BS># |
ccc3902408d2
Fix the hash key in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
113
diff
changeset
|
599 |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
600 " Toggle invisible characters |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
601 nnoremap <leader>i :set list!<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
602 |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
603 " Clear search matches |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
604 nnoremap <leader><space> :noh<cr>:call clearmatches()<cr> |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
605 |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
606 " Switch between FR and US keyboard layouts. |
119 | 607 nnoremap <C-l>f :setlocal keymap=french<cr> |
608 nnoremap <C-l>u :setlocal keymap=<cr> | |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
609 |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
610 " Toggle spell check according to current keyboard layout. |
119 | 611 nnoremap <C-l>s :call <SID>ToggleSpellCheck()<cr> |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
612 |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
613 " Simple way to close a buffer without closing the window. |
347
4d73159f56ca
Use pathogen as a sub-repo, plus a few Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
332
diff
changeset
|
614 nnoremap <leader>d :bprevious<cr>:bdelete #<cr> |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
615 |
119 | 616 " Use sane regexes. |
617 nnoremap / /\v | |
618 vnoremap / /\v | |
619 | |
289
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
620 " Next/previous quickfix and location messages. |
303
01ec865443b6
Update NERDTree macros and tweak more Vim stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
294
diff
changeset
|
621 " This is meant to be similar to ]c and [c for the diff navigation. |
289
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
622 nnoremap ]q :cnext<cr>zvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
623 nnoremap [q :cprevious<cr>zvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
624 nnoremap ]l :lnext<cr>zvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
625 nnoremap [l :lprevious<cr>zvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
626 |
304
50fbd059a6a1
More Vim customizations.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
627 " Same with change and jump lists. |
367 | 628 nnoremap ]e g,zz |
629 nnoremap [e g;zz | |
304
50fbd059a6a1
More Vim customizations.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
630 nnoremap ]j <C-I> |
50fbd059a6a1
More Vim customizations.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
631 nnoremap [j <C-O> |
289
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
632 |
367 | 633 " Copy the current buffer's info. |
386
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
634 nnoremap <leader>cp :let @+ = expand('%:p')<cr>:echo @+<cr> |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
635 nnoremap <leader>cf :let @+ = expand('%:h')<cr>:echo @+<cr> |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
636 nnoremap <leader>cw :let @+ = getcwd()<cr>:echo @+<cr> |
367 | 637 |
303
01ec865443b6
Update NERDTree macros and tweak more Vim stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
294
diff
changeset
|
638 " Make the diff navigation also center things. |
289
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
639 nnoremap ]c ]czvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
640 nnoremap [c [czvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
641 |
103
a755319f124e
Added mappings for substitutions.
Ludovic Chabant <ludovic@chabant.com>
parents:
101
diff
changeset
|
642 " Quick search and replace. |
119 | 643 function! s:VSetSearch() |
294
8bc056d80c39
Remove unused stuff, add grepping, shorter status line.
Ludovic Chabant <ludovic@chabant.com>
parents:
291
diff
changeset
|
644 let temp = @@ |
8bc056d80c39
Remove unused stuff, add grepping, shorter status line.
Ludovic Chabant <ludovic@chabant.com>
parents:
291
diff
changeset
|
645 norm! gvy |
8bc056d80c39
Remove unused stuff, add grepping, shorter status line.
Ludovic Chabant <ludovic@chabant.com>
parents:
291
diff
changeset
|
646 let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') |
8bc056d80c39
Remove unused stuff, add grepping, shorter status line.
Ludovic Chabant <ludovic@chabant.com>
parents:
291
diff
changeset
|
647 let @@ = temp |
119 | 648 endfunction |
649 vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR><c-o> | |
650 vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR><c-o> | |
118
c1ff96232138
New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents:
114
diff
changeset
|
651 |
206 | 652 " Keep search matches in the middle of the window. |
289
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
653 nnoremap n nzvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
654 nnoremap N Nzvzz |
206 | 655 |
430
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
656 " Writing mode. |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
657 autocmd! User GoyoEnter nested call ludo#on_goyo_enter() |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
658 autocmd! User GoyoLeave nested call ludo#on_goyo_leave() |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
659 nmap <leader>p :call ludo#writingmode()<CR> |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
660 |
379
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
661 " YCM mappings. |
420 | 662 if s:HasPlugin('youcompleteme') |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
663 augroup VimRC_YouCompleteMe |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
664 autocmd! |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
665 autocmd FileType cpp nnoremap <Leader>jj :YcmCompleter GoToImprecise<cr>zv |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
666 autocmd FileType cpp nnoremap <Leader>jd :YcmCompleter GoToDefinition<cr>zv |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
667 autocmd FileType cpp nnoremap <Leader>jh :YcmCompleter GoToDeclaration<cr>zv |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
668 autocmd FileType cpp nnoremap <Leader>ji :YcmCompleter GoToInclude<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
669 autocmd FileType cpp nnoremap <Leader>jc :YcmCompleter GetDoc<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
670 autocmd FileType cpp nnoremap <Leader>je :YcmShowDetailedDiagnostic<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
671 augroup END |
420 | 672 endif |
397
c32b9b172314
Specify YCM/OmniSharp mappings only for specific file types.
Ludovic Chabant <ludovic@chabant.com>
parents:
392
diff
changeset
|
673 |
c32b9b172314
Specify YCM/OmniSharp mappings only for specific file types.
Ludovic Chabant <ludovic@chabant.com>
parents:
392
diff
changeset
|
674 " OmniSharp mappings |
420 | 675 if s:HasPlugin('OmniSharp') |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
676 augroup VimRC_OmniSharp |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
677 autocmd! |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
678 autocmd FileType cs setlocal omnifunc=OmniSharp#Complete |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
679 autocmd BufEnter,TextChanged,InsertLeave *.cs SyntasticCheck |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
680 autocmd CursorHold *.cs call OmniSharp#TypeLookupWithoutDocumentation() |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
681 autocmd FileType cs nnoremap <Leader>jj :OmniSharpGotoDefinition<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
682 autocmd FileType cs nnoremap <Leader>x :OmniSharpFixIssue<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
683 autocmd FileType cs nnoremap <Leader>fx :OmniSharpFixUsings<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
684 autocmd FileType cs nnoremap <Leader>tt :OmniSharpTypeLookup<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
685 autocmd FileType cs nnoremap <Leader>dc :OmniSharpDocumentation<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
686 augroup END |
420 | 687 endif |
379
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
688 |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
689 " ProjectRoot mappings |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
690 let s:no_auto_projectroot_buftypes = [ |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
691 \'help', 'nofile', 'quickfix'] |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
692 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
693 function! s:AutoProjectRootCD() abort |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
694 try |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
695 if index(s:no_auto_projectroot_buftypes, &buftype) == -1 |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
696 ProjectRootCD |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
697 endif |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
698 catch |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
699 " Silently ignore invalid buffers |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
700 endtry |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
701 endfunction |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
702 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
703 augroup VimRC_ProjectRoot |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
704 autocmd! |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
705 autocmd BufEnter * call <SID>AutoProjectRootCD() |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
706 augroup END |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
707 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
708 nnoremap <leader>cd :ProjectRootCD<cr> |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
709 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
710 " Ctrl-P mappings. |
420 | 711 if s:HasPlugin('ctrlp') |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
712 nnoremap <silent> <C-p> :CtrlP<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
713 nnoremap <silent> <C-o> :CtrlPBuffer<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
714 nnoremap <silent> <C-u> :CtrlPTag<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
715 nnoremap <silent> <C-y> :CtrlPBufTag<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
716 nnoremap <silent> <Tab> :CtrlPMRUFiles<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
717 nnoremap <silent> <F8> :CtrlPBookmarkDir<cr> |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
718 endif |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
719 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
720 " FZF mappings. |
420 | 721 if s:HasPlugin('fzf') |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
722 if exists('*fzf#run') |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
723 nnoremap <silent> <C-p> :Files<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
724 nnoremap <silent> <C-o> :Buffers<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
725 nnoremap <Tab> :History<cr> |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
726 |
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
727 " Replace the default `Tags` command, which requires Perl, with |
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
728 " something I can use, based on Python. |
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
729 command! -bang -nargs=* Tags call ludo#run_fzf_tags(<q-args>, <bang>0) |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
730 else |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
731 call ludo#error( |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
732 \"FZF is installed and enabled, but the Vim plugin ". |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
733 \"isn't loaded... add it to your `vimrc-local-pre`.") |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
734 endif |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
735 endif |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
736 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
737 " }}} |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
738 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
739 " Folding {{{ |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
740 |
367 | 741 " Start with one level of open. |
742 set foldlevel=1 | |
743 | |
385 | 744 " Don't fold too much. |
745 set foldnestmax=2 | |
746 | |
287
44c9d65cfa74
Readjust some Vim config stuff around folding.
Ludovic Chabant <ludovic@chabant.com>
parents:
286
diff
changeset
|
747 " Folds are defined by markers in the text. |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
748 set foldmethod=marker"{{{"}}} |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
749 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
750 " Toggle folds with <space>. |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
751 nnoremap <space> za |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
752 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
753 " Create folds with <space> (in visual mode). |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
754 vnoremap <space> zf |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
755 |
413
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
756 " See http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text |
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
757 " Don't screw up folds when inserting text that might affect them, until |
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
758 " leaving insert mode. Foldmethod is local to the window. Protect against |
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
759 " screwing up folding when switching between windows. |
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
760 autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif |
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
761 autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif |
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
762 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
763 " }}} |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
764 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
765 " Abbreviations {{{ |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
766 |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
767 iabbrev @@ ludovic@chabant.com |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
768 iabbrev ccopy Copyright ©2011 Ludovic Chabant, all rights reserved. |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
769 iabbrev ssig --<cr>l u d o .<cr>. 8 0 17 80 |
0 | 770 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
771 " }}} |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
772 |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
773 " Functions {{{ |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
774 |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
775 function! s:ToggleSpellCheck() abort |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
776 if &spell ==? 'nospell' |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
777 if &keymap ==? 'french' |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
778 setlocal spell spelllang=fr_fr |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
779 else |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
780 setlocal spell spelllang=en_us,en_ca |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
781 endif |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
782 else |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
783 setlocal spell nospell |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
784 endif |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
785 endfunction |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
786 |
160 | 787 function! s:StripTrailingWhitespaces() abort |
788 let l = line(".") | |
789 let c = col(".") | |
790 %s/\s\+$//e | |
791 call cursor(l, c) | |
792 endfunction | |
793 | |
176 | 794 function! s:ToggleNERDTree() abort |
795 NERDTreeToggle | |
796 endfunction | |
797 | |
798 function! s:FindInNERDTree() abort | |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
799 ProjectRootExe NERDTreeFind |
332 | 800 normal zz |
176 | 801 endfunction |
802 | |
413
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
803 function! s:ToggleCppFolding() abort |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
804 if (&foldmethod == "syntax") |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
805 setlocal foldmethod=manual |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
806 setlocal nofoldenable |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
807 else |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
808 setlocal foldmethod=syntax |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
809 setlocal foldenable |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
810 endif |
413
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
811 endfunction |
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
812 |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
813 " }}} |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
814 |
171
7559d8bc39bb
Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
815 " Local override {{{ |
7559d8bc39bb
Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
816 |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
817 let s:local_vimrc = ludo#localpath('vimrc-local') |
430
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
818 if filereadable(s:local_vimrc) |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
819 execute 'source' s:local_vimrc |
171
7559d8bc39bb
Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
820 endif |
7559d8bc39bb
Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
821 |
7559d8bc39bb
Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
822 " }}} |
7559d8bc39bb
Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
823 |