Mercurial > dotfiles
annotate vim/vimrc @ 444:71d7734148ed
Add support for ALE.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 07 May 2018 22:14:56 -0700 |
parents | 4ca0b1413199 |
children | 05ab0353cd6e |
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 | |
443
4ca0b1413199
Some new cool Vim things.
Ludovic Chabant <ludovic@chabant.com>
parents:
442
diff
changeset
|
143 set formatoptions=croqn1j |
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 | |
442
decee05a5595
Weird, Neovim doesn't have `guifont`?
Ludovic Chabant <ludovic@chabant.com>
parents:
441
diff
changeset
|
188 if !has('nvim') |
decee05a5595
Weird, Neovim doesn't have `guifont`?
Ludovic Chabant <ludovic@chabant.com>
parents:
441
diff
changeset
|
189 if ludo#platform() == "windows" |
decee05a5595
Weird, Neovim doesn't have `guifont`?
Ludovic Chabant <ludovic@chabant.com>
parents:
441
diff
changeset
|
190 set guifont=InputMono:h11,Hack:h12,Consolas:h12 |
decee05a5595
Weird, Neovim doesn't have `guifont`?
Ludovic Chabant <ludovic@chabant.com>
parents:
441
diff
changeset
|
191 else |
decee05a5595
Weird, Neovim doesn't have `guifont`?
Ludovic Chabant <ludovic@chabant.com>
parents:
441
diff
changeset
|
192 set guifont=InputMono:h11,Hack:h12,Monaco:h12 |
decee05a5595
Weird, Neovim doesn't have `guifont`?
Ludovic Chabant <ludovic@chabant.com>
parents:
441
diff
changeset
|
193 endif |
6 | 194 endif |
195 | |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
196 " Syntax highlighting. |
0 | 197 syntax on |
198 | |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
199 " 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
|
200 if !exists('g:resourcing_vimrc') |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
201 cd ~/ |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
202 endif |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
203 |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
204 " Default color scheme. |
47 | 205 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
|
206 set background=dark |
47 | 207 else |
208 set background=dark | |
314 | 209 let g:solarized_termcolors = 256 |
210 let g:solarized_termtrans = 1 | |
47 | 211 endif |
217
6ee245fa8a3d
Proper colors in iTerm2, and now using solarized for a change.
Ludovic Chabant <ludovic@chabant.com>
parents:
213
diff
changeset
|
212 colorscheme solarized |
6 | 213 |
214 " Enable file type detection. | |
0 | 215 filetype indent plugin on |
216 | |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
217 " }}} |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
218 |
76
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
219 " Auto-Commands {{{ |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
220 |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
221 " 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
|
222 augroup CursorLine |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
223 au! |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
224 au WinLeave * set nocursorline |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
225 au WinEnter * set cursorline |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
226 augroup END |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
227 |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
228 " }}} |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
229 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
230 " Plugin Settings {{{ |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
231 |
309
5b7acab16766
Make NERDTree ignore stuff, and other Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
232 " NERDTree {{{ |
5b7acab16766
Make NERDTree ignore stuff, and other Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
233 |
320 | 234 let NERDTreeRespectWildIgnore = 1 |
309
5b7acab16766
Make NERDTree ignore stuff, and other Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
235 |
5b7acab16766
Make NERDTree ignore stuff, and other Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
236 " }}} |
5b7acab16766
Make NERDTree ignore stuff, and other Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
237 |
430
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
238 " Ack {{{ |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
239 |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
240 if executable('ag') |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
241 let g:ackprg = 'ag --vimgrep' |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
242 endif |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
243 |
440
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
244 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
|
245 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
|
246 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
|
247 |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
248 " }}} |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
249 |
178 | 250 " Ctrl-P {{{ |
251 | |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
252 " We'll set our own mappings. |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
253 let g:ctrlp_map = '' |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
254 |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
255 " 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
|
256 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
|
257 |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
258 " Ctrl-P should however ignore some stuff. |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
259 let g:ctrlp_custom_ignore = { |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
260 \ 'dir': '\v[\/](\.git|\.hg|\.svn|venv|static|node_modules|_cache|_counter)$' |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
261 \ } |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
262 |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
263 " 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
|
264 let g:ctrlp_cache_dir = ludo#localpath('cache') |
10
00cac5ebf546
Added default window size. Added buffer keyboard shortcuts.
ludovicchabant
parents:
6
diff
changeset
|
265 |
197
4d34bf15a478
Don't clear CtrlP cache on exit, fix Windows issues.
Ludovic Chabant <ludovic@chabant.com>
parents:
193
diff
changeset
|
266 " Remember things. |
386
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
267 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
|
268 |
317 | 269 " Don't include some stuff in the most recently used list. |
270 let g:ctrlp_mruf_exclude = 'hg\-editor\-\d+\.txt' | |
271 | |
193
ae53d68033d9
Enable fugitive and some CtrlP extensions, include a new one of my own.
Ludovic Chabant <ludovic@chabant.com>
parents:
191
diff
changeset
|
272 " Enable some cool extensions. |
240
3a6b11d16a2a
Simpler registration for CtrlP extensions.
Ludovic Chabant <ludovic@chabant.com>
parents:
235
diff
changeset
|
273 let g:ctrlp_extensions = [ |
266
de3ef7fbcfc1
Add CtrlP's bookmarkdir extension.
Ludovic Chabant <ludovic@chabant.com>
parents:
252
diff
changeset
|
274 \'tag', 'buffertag', 'quickfix', 'mixed', 'bookmarkdir', |
288
25b672f0f6bd
Remove `projectjump` CtrlP plugin, just use the bookmarks.
Ludovic Chabant <ludovic@chabant.com>
parents:
287
diff
changeset
|
275 \'autoignore' |
240
3a6b11d16a2a
Simpler registration for CtrlP extensions.
Ludovic Chabant <ludovic@chabant.com>
parents:
235
diff
changeset
|
276 \] |
193
ae53d68033d9
Enable fugitive and some CtrlP extensions, include a new one of my own.
Ludovic Chabant <ludovic@chabant.com>
parents:
191
diff
changeset
|
277 |
367 | 278 " Use PyMatch to go faster. |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
279 if (has('python3') || has('python')) && s:HasPlugin('ctrlp-py-matcher') |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
280 let g:ctrlp_match_func = {'match': 'pymatcher#PyMatch'} |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
281 let g:ctrlp_max_files = 0 |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
282 let g:ctrlp_lazy_update = 350 |
367 | 283 endif |
284 | |
178 | 285 " }}} |
286 | |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
287 " FZF {{{ |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
288 |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
289 if ludo#platform() == 'mac' |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
290 if filereadable('/usr/local/opt/fzf/plugin/fzf.vim') |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
291 " FZF installed via Homebrew. |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
292 source /usr/local/opt/fzf/plugin/fzf.vim |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
293 endif |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
294 endif |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
295 |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
296 let g:fzf_action = { |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
297 \'ctrl-t': 'tab split', |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
298 \'ctrl-v': 'vsplit', |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
299 \'ctrl-x': 'split', |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
300 \} |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
301 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
302 " }}} |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
303 |
213
769869e61101
Renamed autotags to gutentags.
Ludovic Chabant <ludovic@chabant.com>
parents:
212
diff
changeset
|
304 " Gutentags {{{ |
206 | 305 |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
306 let g:gutentags_cache_dir = ludo#localpath('tags') |
373 | 307 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
|
308 let g:gutentags_ctags_extra_args = ['--options='.ludo#localpath('ctagsrc')] |
420 | 309 let g:gutentags_ctags_exclude_wildignore = 0 |
206 | 310 |
440
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
311 augroup GutentagsStatusLineRefresher |
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
312 autocmd! |
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
313 autocmd User GutentagsUpdating call lightline#update() |
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
314 autocmd User GutentagsUpdated call lightline#update() |
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
315 augroup END |
4b816faa06e2
Remove CtrlP, add statusline refresh.
Ludovic Chabant <ludovic@chabant.com>
parents:
439
diff
changeset
|
316 |
206 | 317 " }}} |
318 | |
178 | 319 " Syntastic {{{ |
320 | |
314 | 321 let g:syntastic_auto_loc_list = 2 |
305
a333541a5c74
Syntastic config changes.
Ludovic Chabant <ludovic@chabant.com>
parents:
304
diff
changeset
|
322 let g:syntastic_check_on_open = 1 |
a333541a5c74
Syntastic config changes.
Ludovic Chabant <ludovic@chabant.com>
parents:
304
diff
changeset
|
323 let g:syntastic_check_on_wq = 0 |
a333541a5c74
Syntastic config changes.
Ludovic Chabant <ludovic@chabant.com>
parents:
304
diff
changeset
|
324 |
219
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
325 " 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
|
326 " 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
|
327 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
|
328 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
|
329 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
|
330 |
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
331 " }}} |
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
332 |
444 | 333 " ALE {{{ |
334 | |
335 let g:ale_sign_error = '✗' | |
336 let g:ale_sign_warning = 'âš ' | |
337 | |
338 " }}} | |
339 | |
219
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
340 " Supertab {{{ |
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
341 |
308 | 342 let g:SuperTabDefaultCompletionType = "context" |
343 let g:SuperTabLongestEnhanced = 1 | |
344 let g:SuperTabLongestHighlight = 0 | |
219
738c1a3ad786
Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents:
218
diff
changeset
|
345 let g:SuperTabCrMapping = 1 |
178 | 346 |
347 " }}} | |
348 | |
349 " Lawrencium {{{ | |
118
c1ff96232138
New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents:
114
diff
changeset
|
350 |
127
1f709d7e03c6
Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
118
diff
changeset
|
351 " Custom Mercurial commands highlighting in Lawrencium. |
118
c1ff96232138
New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents:
114
diff
changeset
|
352 let g:lawrencium_hg_commands_file_types = { |
c1ff96232138
New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents:
114
diff
changeset
|
353 \'clog': 'hggraphlog' |
c1ff96232138
New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents:
114
diff
changeset
|
354 \} |
c1ff96232138
New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents:
114
diff
changeset
|
355 |
127
1f709d7e03c6
Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
118
diff
changeset
|
356 " Make the annotate window better in Lawrencium. |
206 | 357 let g:lawrencium_annotate_width_offset = 1 |
127
1f709d7e03c6
Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
118
diff
changeset
|
358 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
359 " }}} |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
360 |
178 | 361 " Gundo {{{ |
362 | |
363 let g:gundo_map_move_older = '<Down>' | |
364 let g:gundo_map_move_newer = '<Up>' | |
365 | |
366 " }}} | |
367 | |
368 " YankRing {{{ | |
369 | |
370 let g:yankring_replace_n_pkey = '<C-K>' | |
371 let g:yankring_replace_p_pkey = '<C-J>' | |
372 | |
373 " }}} | |
374 | |
375 " Python-Mode {{{ | |
376 | |
419
c4077384f55f
Use `InputMono` or `Hack` if they're installed.
Ludovic Chabant <ludovic@chabant.com>
parents:
414
diff
changeset
|
377 let g:pymode = 0 |
352
9580765366a4
Fix some python indenting stuff in vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
349
diff
changeset
|
378 let g:pymode_python = 'python3' |
307
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
379 |
314 | 380 let g:pymode_syntax = 0 |
307
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
381 let g:pymode_syntax_all = 0 |
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
382 let g:pymode_syntax_builtin_objs = 1 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
383 let g:pymode_syntax_print_as_function = 1 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
384 let g:pymode_syntax_space_errors = 1 |
307
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
385 |
352
9580765366a4
Fix some python indenting stuff in vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
349
diff
changeset
|
386 let g:pymode_indent = 0 |
9580765366a4
Fix some python indenting stuff in vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
349
diff
changeset
|
387 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
388 let g:pymode_run = 0 |
307
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
389 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
390 let g:pymode_lint = 0 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
391 let g:pymode_trim_whitespaces = 0 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
392 let g:pymode_folding = 1 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
393 |
307
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
394 let g:pymode_doc = 1 |
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
395 let g:pymode_doc_bind = 'K' |
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
396 |
b09d451f3516
Okay let's try PythonMode again.
Ludovic Chabant <ludovic@chabant.com>
parents:
306
diff
changeset
|
397 let g:pymode_virtualenv = 0 |
178 | 398 |
314 | 399 let g:pymode_rope = 0 |
400 | |
178 | 401 " }}} |
402 | |
379
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
403 " Lightline {{{ |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
404 let g:lightline = { |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
405 \'colorscheme': 'solarized', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
406 \'active': { |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
407 \ '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
|
408 \ ['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
|
409 \ ['ctrlpmark'] ], |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
410 \ 'right': [ ['lineinfo'], |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
411 \ ['percent'], |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
412 \ ['fileformat', 'fileencoding', 'filetype'], |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
413 \ ['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
|
414 \ }, |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
415 \'component_function': { |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
416 \ 'fugitive': '_LightlineFugitive', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
417 \ 'lawrencium': '_LightlineLawrencium', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
418 \ 'ctrlpmark': '_LightlineCtrlPMark', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
419 \ }, |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
420 \'component_expand': { |
444 | 421 \ 'syntastic': '_LightlineLinter', |
379
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
422 \ 'ycm_errs': '_LightlineYcmErrors', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
423 \ 'ycm_warns': '_LightlineYcmWarnings', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
424 \ 'gutentags': '_LightlineGutentags', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
425 \ }, |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
426 \'component_type': { |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
427 \ 'syntastic': 'error', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
428 \ 'ycm_errs': 'error', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
429 \ 'ycm_warns': 'warning', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
430 \ 'gutentags': 'warning', |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
431 \ }, |
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 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
434 function! _LightlineFugitive() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
435 return fugitive#head() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
436 endfunction |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
437 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
438 function! _LightlineLawrencium() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
439 return lawrencium#statusline() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
440 endfunction |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
441 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
442 function! _LightlineCtrlPMark() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
443 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
|
444 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
|
445 return lightline#concatenate( |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
446 \['WAT?', g:lightline.ctrlp_prev, |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
447 \ g:lightline.ctrlp_item, |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
448 \ g:lightline.ctrlp_next], |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
449 \0) |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
450 else |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
451 return '' |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
452 endif |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
453 endfunction |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
454 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
455 function! _LightlineGutentags() |
430
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
456 return gutentags#statusline('', '', '♨') |
379
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 |
444 | 459 if s:HasPlugin('syntastic') |
460 function! _LightlineLinter() | |
461 return SyntasticStatuslineFlag() | |
462 endfunction | |
463 else | |
464 function! _LightlineLinter() abort | |
465 let l:counts = ale#statusline#Count(bufnr('')) | |
466 | |
467 let l:all_errors = l:counts.error + l:counts.style_error | |
468 let l:all_non_errors = l:counts.total - l:all_errors | |
469 | |
470 return l:counts.total == 0 ? 'OK' : printf( | |
471 \ '%dW %dE', | |
472 \ all_non_errors, | |
473 \ all_errors | |
474 \) | |
475 endfunction | |
476 endif | |
379
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
477 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
478 function! _LightlineYcmErrors() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
479 let l:cnt = youcompleteme#GetErrorCount() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
480 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
|
481 endfunction |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
482 |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
483 function! _LightlineYcmWarnings() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
484 let l:cnt = youcompleteme#GetWarningCount() |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
485 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
|
486 endfunction |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
487 " }}} |
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
488 |
386
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
489 " YouCompleteMe {{{ |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
490 |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
491 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
|
492 |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
493 " }}} |
b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
381
diff
changeset
|
494 |
178 | 495 " }}} |
496 | |
73
39a7e05637d8
Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents:
67
diff
changeset
|
497 " File-Specific Settings {{{ |
39a7e05637d8
Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents:
67
diff
changeset
|
498 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
499 augroup VimRCFileType_markdown |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
500 au! |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
501 autocmd FileType text,markdown setlocal textwidth=80 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
502 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
|
503 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
|
504 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
|
505 autocmd FileType markdown nnoremap <buffer> <localleader>4 mzI####<space><esc>`z5l |
176 | 506 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
507 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
|
508 autocmd BufRead,BufNewFile */_content/**/*.html set ft=piecrustmarkdown |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
509 augroup END |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
510 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
511 augroup VimRCFileType_php |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
512 au! |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
513 " Who the hell changes my matchpairs? |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
514 autocmd FileType php setlocal matchpairs-=<:> |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
515 augroup END |
83 | 516 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
517 augroup VimRCFileType_c |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
518 au! |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
519 autocmd FileType c,c++,cpp setlocal foldmethod=syntax |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
520 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
|
521 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
|
522 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
|
523 augroup END |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
524 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
525 augroup VimRCFileType_csharp |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
526 au! |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
527 autocmd BufNewFile,BufRead *.xaml setlocal filetype=xml |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
528 autocmd FileType cs setlocal foldmethod=syntax |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
529 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
|
530 autocmd FileType cs setlocal synmaxcol=200 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
531 augroup END |
83 | 532 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
533 augroup VimRCFileType_css |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
534 au! |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
535 autocmd BufNewFile,BufRead *.less setlocal filetype=less |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
536 autocmd Filetype less,css setlocal foldmethod=marker |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
537 autocmd Filetype less,css setlocal foldmarker={,} |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
538 autocmd Filetype less,css setlocal iskeyword+=- |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
539 autocmd Filetype less,css setlocal omnifunc=csscomplete#CompleteCSS |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
540 augroup END |
160 | 541 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
542 augroup VimRCTrailingWhitespaces |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
543 au! |
287
44c9d65cfa74
Readjust some Vim config stuff around folding.
Ludovic Chabant <ludovic@chabant.com>
parents:
286
diff
changeset
|
544 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
|
545 augroup END |
73
39a7e05637d8
Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents:
67
diff
changeset
|
546 |
39a7e05637d8
Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents:
67
diff
changeset
|
547 " }}} |
39a7e05637d8
Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents:
67
diff
changeset
|
548 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
549 " Mappings {{{ |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
550 |
42
6b831735c092
Added french keymap support.
Ludovic Chabant <ludovic@chabant.com>
parents:
18
diff
changeset
|
551 let mapleader="," |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
552 |
76
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
553 " Visual line navigation |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
554 noremap <up> g<up> |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
555 noremap <down> g<down> |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
556 noremap <home> g<home> |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
557 noremap <end> g<end> |
990968329a9b
Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents:
73
diff
changeset
|
558 |
367 | 559 noremap <S-up> 20<up> |
560 noremap <S-down> 20<down> | |
561 | |
169
4947d1f99b72
Better tab/buffer navigation.
Ludovic Chabant <ludovic@chabant.com>
parents:
163
diff
changeset
|
562 " Tab navigation |
178 | 563 noremap <C-Tab> :tabnext<cr> |
564 noremap <C-S-Tab> :tabprevious<cr> | |
304
50fbd059a6a1
More Vim customizations.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
565 nnoremap <leader>t :tabnew<cr> |
169
4947d1f99b72
Better tab/buffer navigation.
Ludovic Chabant <ludovic@chabant.com>
parents:
163
diff
changeset
|
566 |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
567 " Window navigation |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
568 nnoremap <C-up> :wincmd k<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
569 nnoremap <C-down> :wincmd j<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
570 nnoremap <C-left> :wincmd h<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
571 nnoremap <C-right> :wincmd l<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
572 |
176 | 573 " Switch buffers. |
420 | 574 nnoremap <F1> :execute ("buffer " . bufname("#"))<cr> |
83 | 575 |
176 | 576 " NERDTree. |
420 | 577 nnoremap <F2> :call <SID>ToggleNERDTree()<cr> |
578 nnoremap <C-F2> :call <SID>FindInNERDTree()<cr> | |
443
4ca0b1413199
Some new cool Vim things.
Ludovic Chabant <ludovic@chabant.com>
parents:
442
diff
changeset
|
579 nnoremap <leader>e :e %:h<cr> |
83 | 580 |
157
7fd22eb11789
Added `tagbar` for Vim, with keyboard shortcut.
Ludovic Chabant <ludovic@chabant.com>
parents:
155
diff
changeset
|
581 " Tagbar. |
420 | 582 nnoremap <F3> :TagbarToggle<cr> |
583 nnoremap <C-F3> :TagbarOpenAutoClose<cr> | |
157
7fd22eb11789
Added `tagbar` for Vim, with keyboard shortcut.
Ludovic Chabant <ludovic@chabant.com>
parents:
155
diff
changeset
|
584 |
186
01304e9b4c19
Re-add Gundo mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
185
diff
changeset
|
585 " Gundo. |
420 | 586 nnoremap <F4> :GundoToggle<cr> |
587 | |
588 " F5 to F8 are available for context-dependent mappings. | |
589 | |
590 " Jump to tags by keeping things better in view. Option for jumping to a tag | |
591 " in a split window where everything is folded except what you need to see. | |
592 " Note that if a tag search yield multiple possible results, we will still run | |
593 " some of that `zvzz` stuff, but that's OK, the main point is to not mess up | |
594 " the result selection window either. | |
595 " | |
596 " Go back after checking out a tag. | |
597 nnoremap <F9> :pop<CR> | |
598 " Go check out a tag. | |
599 nnoremap <F10> g<C-]>zvzz | |
600 " Go check out a tag in a split window. | |
601 nnoremap <S-F10> <C-W>vg<C-]>zMzvzz | |
602 " Move to previous matching tag. | |
603 nnoremap <C-F9> :tprevious<CR> | |
604 " Move to next matching tag. | |
605 nnoremap <C-F10> :tnext<CR> | |
186
01304e9b4c19
Re-add Gundo mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
185
diff
changeset
|
606 |
83 | 607 " Common typos. |
608 nnoremap ; : | |
609 | |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
610 " Split windows |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
611 nnoremap <leader>s :split<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
612 nnoremap <leader>v :vsplit<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
613 |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
614 " Easier things to type |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
615 nnoremap <leader>w :w<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
616 nnoremap <leader>q :q<cr> |
119 | 617 nnoremap <leader>hh :Hg |
618 nnoremap <leader>hg :Hg! | |
112 | 619 nnoremap <leader>hs :Hgstatus<cr> |
620 nnoremap <leader>hv :Hgvdiff<cr> | |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
621 |
114
ccc3902408d2
Fix the hash key in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
113
diff
changeset
|
622 " Make the hash-key not suck. |
ccc3902408d2
Fix the hash key in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
113
diff
changeset
|
623 inoremap # X<BS># |
ccc3902408d2
Fix the hash key in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents:
113
diff
changeset
|
624 |
80
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
625 " Toggle invisible characters |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
626 nnoremap <leader>i :set list!<cr> |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
627 |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
628 " Clear search matches |
121bef55252f
Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
629 nnoremap <leader><space> :noh<cr>:call clearmatches()<cr> |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
630 |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
631 " Switch between FR and US keyboard layouts. |
119 | 632 nnoremap <C-l>f :setlocal keymap=french<cr> |
633 nnoremap <C-l>u :setlocal keymap=<cr> | |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
634 |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
635 " Toggle spell check according to current keyboard layout. |
119 | 636 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
|
637 |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
638 " 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
|
639 nnoremap <leader>d :bprevious<cr>:bdelete #<cr> |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
640 |
119 | 641 " Use sane regexes. |
642 nnoremap / /\v | |
643 vnoremap / /\v | |
644 | |
289
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
645 " 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
|
646 " 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
|
647 nnoremap ]q :cnext<cr>zvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
648 nnoremap [q :cprevious<cr>zvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
649 nnoremap ]l :lnext<cr>zvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
650 nnoremap [l :lprevious<cr>zvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
651 |
304
50fbd059a6a1
More Vim customizations.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
652 " Same with change and jump lists. |
367 | 653 nnoremap ]e g,zz |
654 nnoremap [e g;zz | |
304
50fbd059a6a1
More Vim customizations.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
655 nnoremap ]j <C-I> |
50fbd059a6a1
More Vim customizations.
Ludovic Chabant <ludovic@chabant.com>
parents:
303
diff
changeset
|
656 nnoremap [j <C-O> |
289
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
657 |
367 | 658 " 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
|
659 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
|
660 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
|
661 nnoremap <leader>cw :let @+ = getcwd()<cr>:echo @+<cr> |
367 | 662 |
443
4ca0b1413199
Some new cool Vim things.
Ludovic Chabant <ludovic@chabant.com>
parents:
442
diff
changeset
|
663 nnoremap F <Plug>(easymotion-prefix)s |
4ca0b1413199
Some new cool Vim things.
Ludovic Chabant <ludovic@chabant.com>
parents:
442
diff
changeset
|
664 |
303
01ec865443b6
Update NERDTree macros and tweak more Vim stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
294
diff
changeset
|
665 " Make the diff navigation also center things. |
289
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
666 nnoremap ]c ]czvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
667 nnoremap [c [czvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
668 |
103
a755319f124e
Added mappings for substitutions.
Ludovic Chabant <ludovic@chabant.com>
parents:
101
diff
changeset
|
669 " Quick search and replace. |
119 | 670 function! s:VSetSearch() |
294
8bc056d80c39
Remove unused stuff, add grepping, shorter status line.
Ludovic Chabant <ludovic@chabant.com>
parents:
291
diff
changeset
|
671 let temp = @@ |
8bc056d80c39
Remove unused stuff, add grepping, shorter status line.
Ludovic Chabant <ludovic@chabant.com>
parents:
291
diff
changeset
|
672 norm! gvy |
8bc056d80c39
Remove unused stuff, add grepping, shorter status line.
Ludovic Chabant <ludovic@chabant.com>
parents:
291
diff
changeset
|
673 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
|
674 let @@ = temp |
119 | 675 endfunction |
676 vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR><c-o> | |
677 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
|
678 |
206 | 679 " 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
|
680 nnoremap n nzvzz |
8b6ca7e40f37
Making jumping around in Vim nicer.
Ludovic Chabant <ludovic@chabant.com>
parents:
288
diff
changeset
|
681 nnoremap N Nzvzz |
206 | 682 |
430
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
683 " Writing mode. |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
684 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
|
685 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
|
686 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
|
687 |
379
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
688 " YCM mappings. |
420 | 689 if s:HasPlugin('youcompleteme') |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
690 augroup VimRC_YouCompleteMe |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
691 autocmd! |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
692 autocmd FileType cpp nnoremap <Leader>jj :YcmCompleter GoToImprecise<cr>zv |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
693 autocmd FileType cpp nnoremap <Leader>jd :YcmCompleter GoToDefinition<cr>zv |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
694 autocmd FileType cpp nnoremap <Leader>jh :YcmCompleter GoToDeclaration<cr>zv |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
695 autocmd FileType cpp nnoremap <Leader>ji :YcmCompleter GoToInclude<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
696 autocmd FileType cpp nnoremap <Leader>jc :YcmCompleter GetDoc<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
697 autocmd FileType cpp nnoremap <Leader>je :YcmShowDetailedDiagnostic<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
698 augroup END |
420 | 699 endif |
397
c32b9b172314
Specify YCM/OmniSharp mappings only for specific file types.
Ludovic Chabant <ludovic@chabant.com>
parents:
392
diff
changeset
|
700 |
c32b9b172314
Specify YCM/OmniSharp mappings only for specific file types.
Ludovic Chabant <ludovic@chabant.com>
parents:
392
diff
changeset
|
701 " OmniSharp mappings |
420 | 702 if s:HasPlugin('OmniSharp') |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
703 augroup VimRC_OmniSharp |
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 FileType cs setlocal omnifunc=OmniSharp#Complete |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
706 autocmd BufEnter,TextChanged,InsertLeave *.cs SyntasticCheck |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
707 autocmd CursorHold *.cs call OmniSharp#TypeLookupWithoutDocumentation() |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
708 autocmd FileType cs nnoremap <Leader>jj :OmniSharpGotoDefinition<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
709 autocmd FileType cs nnoremap <Leader>x :OmniSharpFixIssue<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
710 autocmd FileType cs nnoremap <Leader>fx :OmniSharpFixUsings<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
711 autocmd FileType cs nnoremap <Leader>tt :OmniSharpTypeLookup<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
712 autocmd FileType cs nnoremap <Leader>dc :OmniSharpDocumentation<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
713 augroup END |
420 | 714 endif |
379
58410650ce36
Add lightline and remove old scratch. Customize Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
373
diff
changeset
|
715 |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
716 " ProjectRoot mappings |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
717 let s:no_auto_projectroot_buftypes = [ |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
718 \'help', 'nofile', 'quickfix'] |
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 function! s:AutoProjectRootCD() abort |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
721 try |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
722 if index(s:no_auto_projectroot_buftypes, &buftype) == -1 |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
723 ProjectRootCD |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
724 endif |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
725 catch |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
726 " Silently ignore invalid buffers |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
727 endtry |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
728 endfunction |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
729 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
730 augroup VimRC_ProjectRoot |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
731 autocmd! |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
732 autocmd BufEnter * call <SID>AutoProjectRootCD() |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
733 augroup END |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
734 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
735 nnoremap <leader>cd :ProjectRootCD<cr> |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
736 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
737 " Ctrl-P mappings. |
420 | 738 if s:HasPlugin('ctrlp') |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
739 nnoremap <silent> <C-p> :CtrlP<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
740 nnoremap <silent> <C-o> :CtrlPBuffer<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
741 nnoremap <silent> <C-u> :CtrlPTag<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
742 nnoremap <silent> <C-y> :CtrlPBufTag<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
743 nnoremap <silent> <Tab> :CtrlPMRUFiles<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
744 nnoremap <silent> <F8> :CtrlPBookmarkDir<cr> |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
745 endif |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
746 |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
747 " FZF mappings. |
420 | 748 if s:HasPlugin('fzf') |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
749 if exists('*fzf#run') |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
750 nnoremap <silent> <C-p> :Files<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
751 nnoremap <silent> <C-o> :Buffers<cr> |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
752 nnoremap <Tab> :History<cr> |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
753 |
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
754 " 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
|
755 " 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
|
756 command! -bang -nargs=* Tags call ludo#run_fzf_tags(<q-args>, <bang>0) |
441
a3c6869085c1
Add shortcut for tags.
Ludovic Chabant <ludovic@chabant.com>
parents:
440
diff
changeset
|
757 nnoremap <silent> <C-u> :Tags<cr> |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
758 else |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
759 call ludo#error( |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
760 \"FZF is installed and enabled, but the Vim plugin ". |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
761 \"isn't loaded... add it to your `vimrc-local-pre`.") |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
762 endif |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
763 endif |
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
764 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
765 " }}} |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
766 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
767 " Folding {{{ |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
768 |
367 | 769 " Start with one level of open. |
770 set foldlevel=1 | |
771 | |
385 | 772 " Don't fold too much. |
773 set foldnestmax=2 | |
774 | |
287
44c9d65cfa74
Readjust some Vim config stuff around folding.
Ludovic Chabant <ludovic@chabant.com>
parents:
286
diff
changeset
|
775 " Folds are defined by markers in the text. |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
776 set foldmethod=marker"{{{"}}} |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
777 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
778 " Toggle folds with <space>. |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
779 nnoremap <space> za |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
780 |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
781 " Create folds with <space> (in visual mode). |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
782 vnoremap <space> zf |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
783 |
413
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
784 " 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
|
785 " 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
|
786 " 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
|
787 " 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
|
788 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
|
789 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
|
790 |
204
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
791 " }}} |
4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents:
201
diff
changeset
|
792 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
793 " Abbreviations {{{ |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
794 |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
795 iabbrev @@ ludovic@chabant.com |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
796 iabbrev ccopy Copyright ©2011 Ludovic Chabant, all rights reserved. |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
797 iabbrev ssig --<cr>l u d o .<cr>. 8 0 17 80 |
0 | 798 |
59
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
799 " }}} |
6df571869f4a
Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
55
diff
changeset
|
800 |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
801 " Functions {{{ |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
802 |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
803 function! s:ToggleSpellCheck() abort |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
804 if &spell ==? 'nospell' |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
805 if &keymap ==? 'french' |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
806 setlocal spell spelllang=fr_fr |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
807 else |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
808 setlocal spell spelllang=en_us,en_ca |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
809 endif |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
810 else |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
811 setlocal spell nospell |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
812 endif |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
813 endfunction |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
814 |
160 | 815 function! s:StripTrailingWhitespaces() abort |
816 let l = line(".") | |
817 let c = col(".") | |
818 %s/\s\+$//e | |
819 call cursor(l, c) | |
820 endfunction | |
821 | |
176 | 822 function! s:ToggleNERDTree() abort |
823 NERDTreeToggle | |
824 endfunction | |
825 | |
826 function! s:FindInNERDTree() abort | |
410
5bbd5963591c
Some Vim config tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents:
397
diff
changeset
|
827 ProjectRootExe NERDTreeFind |
332 | 828 normal zz |
176 | 829 endfunction |
830 | |
413
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
831 function! s:ToggleCppFolding() abort |
426
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
832 if (&foldmethod == "syntax") |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
833 setlocal foldmethod=manual |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
834 setlocal nofoldenable |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
835 else |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
836 setlocal foldmethod=syntax |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
837 setlocal foldenable |
67f14a8c2304
Improve Vim configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
424
diff
changeset
|
838 endif |
413
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
839 endfunction |
4a2468f72e44
Optimize C++ file editing with some folding tricks.
Ludovic Chabant <ludovic@chabant.com>
parents:
410
diff
changeset
|
840 |
45
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
841 " }}} |
aac6188ab4d6
Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents:
43
diff
changeset
|
842 |
171
7559d8bc39bb
Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
843 " Local override {{{ |
7559d8bc39bb
Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
844 |
435
b7682004288d
Move Vim stuff to autoload, add FZF tags lister.
Ludovic Chabant <ludovic@chabant.com>
parents:
430
diff
changeset
|
845 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
|
846 if filereadable(s:local_vimrc) |
71a080d4d83c
Vim stuff: Goyo writing mode, Ack with Ag.
Ludovic Chabant <ludovic@chabant.com>
parents:
426
diff
changeset
|
847 execute 'source' s:local_vimrc |
171
7559d8bc39bb
Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
848 endif |
7559d8bc39bb
Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
849 |
7559d8bc39bb
Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
850 " }}} |
7559d8bc39bb
Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
851 |