annotate vim/vimrc @ 287:44c9d65cfa74

Readjust some Vim config stuff around folding. Don't remove trailing space in C++ files because other people don't.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 20 Feb 2015 11:45:54 -0800
parents a29080fb35d9
children 25b672f0f6bd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
1 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
2 "
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
3 " Ludovic Chabant's ~/.vimrc
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
4 "
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
5 " http://ludovic.chabant.com
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
6 "
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
7 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
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
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
11 " Use Vim settings, rather then Vi settings (much better!).
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
12 " This must be first, because it changes other options as a side effect.
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
13 set nocompatible
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
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
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
22 " Get the platform we're running on.
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
23 if has("win32") || has("win64") || has("dos32")
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
24 let s:vim_platform = "windows"
286
a29080fb35d9 Add support for local Vim bundle.
Ludovic Chabant <ludovic@chabant.com>
parents: 284
diff changeset
25 let s:path_sep = "\\"
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
26 else
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
27 let s:vim_platform = "unix"
286
a29080fb35d9 Add support for local Vim bundle.
Ludovic Chabant <ludovic@chabant.com>
parents: 284
diff changeset
28 let s:path_sep = '/'
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
29 endif
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
30
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
31 " Get our vim directory.
95
b96ff0dd0137 Fixed the generated vimrc's runtimepath.
Ludovic Chabant <ludovic@chabant.com>
parents: 83
diff changeset
32 let s:vim_home = expand("<sfile>:h")
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
33
127
1f709d7e03c6 Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
34 " 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
35 syntax off
1f709d7e03c6 Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
36 filetype off
1f709d7e03c6 Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
37
18
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
38 " Disable some plugins.
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
39 let g:pathogen_disabled = []
45
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
40 call add(g:pathogen_disabled, 'vimroom')
76
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
41 call add(g:pathogen_disabled, 'minibufexpl')
127
1f709d7e03c6 Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
42 call add(g:pathogen_disabled, 'ragtag')
18
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
43
286
a29080fb35d9 Add support for local Vim bundle.
Ludovic Chabant <ludovic@chabant.com>
parents: 284
diff changeset
44 " Potentially add the local bundle directory.
a29080fb35d9 Add support for local Vim bundle.
Ludovic Chabant <ludovic@chabant.com>
parents: 284
diff changeset
45 if isdirectory(s:vim_home.s:path_sep.'local')
a29080fb35d9 Add support for local Vim bundle.
Ludovic Chabant <ludovic@chabant.com>
parents: 284
diff changeset
46 execute 'set runtimepath+='.s:vim_home.s:path_sep.'local'
a29080fb35d9 Add support for local Vim bundle.
Ludovic Chabant <ludovic@chabant.com>
parents: 284
diff changeset
47 endif
a29080fb35d9 Add support for local Vim bundle.
Ludovic Chabant <ludovic@chabant.com>
parents: 284
diff changeset
48
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
49 " Load pathogen.
286
a29080fb35d9 Add support for local Vim bundle.
Ludovic Chabant <ludovic@chabant.com>
parents: 284
diff changeset
50 "call pathogen#infect()
a29080fb35d9 Add support for local Vim bundle.
Ludovic Chabant <ludovic@chabant.com>
parents: 284
diff changeset
51 call pathogen#runtime_append_all_bundles()
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
52
10
00cac5ebf546 Added default window size. Added buffer keyboard shortcuts.
ludovicchabant
parents: 6
diff changeset
53 " 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
54 if has("gui_running") && !exists('g:resourcing_vimrc')
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
55 set guioptions=-t
235
ceb3f44fa2fc Update sub-repos, make Vim maximized by default.
Ludovic Chabant <ludovic@chabant.com>
parents: 233
diff changeset
56 set lines=999
ceb3f44fa2fc Update sub-repos, make Vim maximized by default.
Ludovic Chabant <ludovic@chabant.com>
parents: 233
diff changeset
57 set columns=999
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
58 endif
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
59
59
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
60 " }}}
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 " General Settings {{{
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
63
135
db9d5fe86723 Enable modelines.
Ludovic Chabant <ludovic@chabant.com>
parents: 131
diff changeset
64 " Restrict modelines.
db9d5fe86723 Enable modelines.
Ludovic Chabant <ludovic@chabant.com>
parents: 131
diff changeset
65 set modelines=1
18
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
66
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
67 " Don't unload abandoned buffers.
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
68 set hidden
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
69
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
70 " Show line numbers.
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
71 set number
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
72
18
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
73 " 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
74 set showmode
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
75 set showcmd
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
76
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
77 " Keep the cursor off the top/bottom edges.
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
78 set scrolloff=3
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
79
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
80 " Smart auto-indenting.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
81 set autoindent
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
82 set smartindent
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
83
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
84 " Use confirmation dialog.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
85 set confirm
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
86
76
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
87 " Don't use annoying sounds.
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
88 set visualbell
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
89
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
90 " Remember lots of commands.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
91 set history=1000
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
92
76
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
93 " Try to reduce flickering.
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
94 set lazyredraw
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
95
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
96 " Show matching braces but not for too long.
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
97 set showmatch
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
98 set matchtime=2
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
99
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
100 " Show soft-broken/wrapped lines with a prefix.
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
101 set showbreak=→
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
102
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
103 " Use incremental search, with highlighting,
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
104 " case-insensitive unless we actually type some
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
105 " mixed-case stuff.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
106 set incsearch
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
107 set hlsearch
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
108 set ignorecase
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
109 set smartcase
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
110
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
111 " Always show window status lines.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
112 set laststatus=2
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
113
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
114 " Enable using the mouse like some everyday guy.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
115 set mouse=a
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
116
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
117 " Show interesting stuff at the bottom of the window.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
118 set showcmd
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
119 set ruler
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
120
76
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
121 " 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
122 set splitbelow
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
123 set splitright
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
124
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
125 " Don't pollute the hard-drive with *~ files. Only
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
126 " create them in hidden backup/temp directories while
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
127 " we edit the file, and then get rid of it.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
128 set nobackup
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
129 set writebackup
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
130 execute('set backupdir='.s:vim_home.'/backup')
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
131 execute('set directory='.s:vim_home.'/temp')
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
132
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
133 " Better command-line completion, but don't show some
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
134 " stuff we don't care about.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
135 set wildmenu
193
ae53d68033d9 Enable fugitive and some CtrlP extensions, include a new one of my own.
Ludovic Chabant <ludovic@chabant.com>
parents: 191
diff changeset
136 set wildignore+=.DS_Store,Thumbs.db,*.so,*.dll,*.exe,*.lib,*.pdb,*.pyc,*.pyo
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
137
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
138 " Always display the tab-page line.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
139 set showtabline=2
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
140
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
141 " Set the file-formats.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
142 set ffs=unix,mac,dos
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
143
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
144 " Tabs and indenting are 4 characters, and tabs behave like
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
145 " spaces during editing. They're smart, too, and when you
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
146 " press <TAB> it actually inserts a soft-tab so everything's
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
147 " indented the same.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
148 set tabstop=4
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
149 set shiftwidth=4
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
150 set softtabstop=4
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
151 set smarttab
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
152 set expandtab
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
153
18
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
154 " Default encoding
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
155 set encoding=utf-8
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
156
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
157 " Clipboard buffer.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
158 set clipboard=unnamed
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
159
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
160 " Smoot terminal experience.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
161 set ttyfast
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
162
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
163 " Allow backspacing over anything.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
164 set backspace=indent,eol,start
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
165
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
166 " Going left and right let you go to other lines.
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
167 set whichwrap+=<,>,h,l
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
168
93
822fc8b4405f Invisible characters in vimrc.
Ludovic Chabant <ludovic@chabant.com>
parents: 92
diff changeset
169 " How to show invisible characters
822fc8b4405f Invisible characters in vimrc.
Ludovic Chabant <ludovic@chabant.com>
parents: 92
diff changeset
170 set listchars=eol:$,tab:>-,trail:-,extends:>,precedes:<,nbsp:%,conceal:.
822fc8b4405f Invisible characters in vimrc.
Ludovic Chabant <ludovic@chabant.com>
parents: 92
diff changeset
171
80
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
172 " Nice auto-complete menu.
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
173 set completeopt=longest,menuone,preview
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
174
121
c6f0172aac8d Add nice column indicators in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 119
diff changeset
175 " Column indicators.
c6f0172aac8d Add nice column indicators in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 119
diff changeset
176 set colorcolumn=72,79
c6f0172aac8d Add nice column indicators in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 119
diff changeset
177
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
178 " And now, for some system-dependent settings:
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
179 " - font to use
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
180 if s:vim_platform == "windows"
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
181 set guifont=Consolas:h12
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
182 else
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
183 set guifont=Monaco:h12
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
184 endif
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
185
45
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
186 " Syntax highlighting.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
187 syntax on
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
188
18
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
189 " 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
190 if !exists('g:resourcing_vimrc')
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
191 cd ~/
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
192 endif
18
cec2213f938c Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 13
diff changeset
193
45
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
194 " Default color scheme.
47
ee3d235ca3fb Added solarized.
Ludovic Chabant <ludovic@chabant.com>
parents: 45
diff changeset
195 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
196 set background=dark
47
ee3d235ca3fb Added solarized.
Ludovic Chabant <ludovic@chabant.com>
parents: 45
diff changeset
197 else
ee3d235ca3fb Added solarized.
Ludovic Chabant <ludovic@chabant.com>
parents: 45
diff changeset
198 set background=dark
217
6ee245fa8a3d Proper colors in iTerm2, and now using solarized for a change.
Ludovic Chabant <ludovic@chabant.com>
parents: 213
diff changeset
199 let g:solarized_termcolors = 256
269
faa1f3bf14f6 Use translated colors.
Ludovic Chabant <ludovic@chabant.com>
parents: 267
diff changeset
200 let g:solarized_termtrans = 1
47
ee3d235ca3fb Added solarized.
Ludovic Chabant <ludovic@chabant.com>
parents: 45
diff changeset
201 endif
217
6ee245fa8a3d Proper colors in iTerm2, and now using solarized for a change.
Ludovic Chabant <ludovic@chabant.com>
parents: 213
diff changeset
202 colorscheme solarized
6
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
203
f8792d288397 Big vimrc update.
ludovicchabant
parents: 0
diff changeset
204 " Enable file type detection.
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
205 filetype indent plugin on
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
206
59
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
207 " }}}
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
208
76
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
209 " Auto-Commands {{{
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
210
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
211 " 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
212 augroup CursorLine
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
213 au!
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
214 au WinLeave * set nocursorline
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
215 au WinEnter * set cursorline
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
216 augroup END
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
217
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
218 " }}}
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
219
59
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
220 " Plugin Settings {{{
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
221
178
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
222 " Ctrl-P {{{
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
223
80
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
224 " We'll set our own mappings.
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
225 let g:ctrlp_map = ''
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
226
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
227 " 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
228 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
229
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
230 " Ctrl-P should however ignore some stuff.
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
231 let g:ctrlp_custom_ignore = {
233
073e7e47dbeb Change CtrlP ignored dirs.
Ludovic Chabant <ludovic@chabant.com>
parents: 219
diff changeset
232 \ 'dir': '\v[\/](\.git|\.hg|\.svn|venv|static|node_modules|_cache|_counter)$'
80
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
233 \ }
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
234
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
235 " Make Ctrl-P cache stuff in our temp directory.
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
236 let g:ctrlp_cache_dir = s:vim_home.'/cache'
10
00cac5ebf546 Added default window size. Added buffer keyboard shortcuts.
ludovicchabant
parents: 6
diff changeset
237
197
4d34bf15a478 Don't clear CtrlP cache on exit, fix Windows issues.
Ludovic Chabant <ludovic@chabant.com>
parents: 193
diff changeset
238 " Remember things.
4d34bf15a478 Don't clear CtrlP cache on exit, fix Windows issues.
Ludovic Chabant <ludovic@chabant.com>
parents: 193
diff changeset
239 let g:ctrlp_clear_cache_on_ext = 0
4d34bf15a478 Don't clear CtrlP cache on exit, fix Windows issues.
Ludovic Chabant <ludovic@chabant.com>
parents: 193
diff changeset
240
193
ae53d68033d9 Enable fugitive and some CtrlP extensions, include a new one of my own.
Ludovic Chabant <ludovic@chabant.com>
parents: 191
diff changeset
241 " Enable some cool extensions.
240
3a6b11d16a2a Simpler registration for CtrlP extensions.
Ludovic Chabant <ludovic@chabant.com>
parents: 235
diff changeset
242 let g:ctrlp_extensions = [
266
de3ef7fbcfc1 Add CtrlP's bookmarkdir extension.
Ludovic Chabant <ludovic@chabant.com>
parents: 252
diff changeset
243 \'tag', 'buffertag', 'quickfix', 'mixed', 'bookmarkdir',
240
3a6b11d16a2a Simpler registration for CtrlP extensions.
Ludovic Chabant <ludovic@chabant.com>
parents: 235
diff changeset
244 \'autoignore', 'projectjump'
3a6b11d16a2a Simpler registration for CtrlP extensions.
Ludovic Chabant <ludovic@chabant.com>
parents: 235
diff changeset
245 \]
193
ae53d68033d9 Enable fugitive and some CtrlP extensions, include a new one of my own.
Ludovic Chabant <ludovic@chabant.com>
parents: 191
diff changeset
246
178
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
247 " }}}
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
248
213
769869e61101 Renamed autotags to gutentags.
Ludovic Chabant <ludovic@chabant.com>
parents: 212
diff changeset
249 " Gutentags {{{
206
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
250
213
769869e61101 Renamed autotags to gutentags.
Ludovic Chabant <ludovic@chabant.com>
parents: 212
diff changeset
251 let g:gutentags_exclude = ['venv', 'build', 'static', 'node_modules']
769869e61101 Renamed autotags to gutentags.
Ludovic Chabant <ludovic@chabant.com>
parents: 212
diff changeset
252 let g:gutentags_cache_dir = s:vim_home.'/tags'
218
b87391429145 Use the `ctagsrc` file with Gutentags.
Ludovic Chabant <ludovic@chabant.com>
parents: 217
diff changeset
253 let g:gutentags_options_file = s:vim_home.'/ctagsrc'
206
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
254
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
255 " }}}
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
256
178
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
257 " Syntastic {{{
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
258
219
738c1a3ad786 Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents: 218
diff changeset
259 " 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
260 " 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
261 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
262 let g:syntastic_python_python_exec = 'python3'
738c1a3ad786 Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents: 218
diff changeset
263
738c1a3ad786 Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents: 218
diff changeset
264 " }}}
738c1a3ad786 Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents: 218
diff changeset
265
738c1a3ad786 Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents: 218
diff changeset
266 " Supertab {{{
738c1a3ad786 Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents: 218
diff changeset
267
738c1a3ad786 Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents: 218
diff changeset
268 let g:SuperTabDefaultCompletionType = "<c-n>"
738c1a3ad786 Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents: 218
diff changeset
269 let g:SuperTabLongestHighlight = 1
738c1a3ad786 Update Python settings for Syntastic, new settings for Supertab.
Ludovic Chabant <ludovic@chabant.com>
parents: 218
diff changeset
270 let g:SuperTabCrMapping = 1
178
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
271
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
272 " }}}
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
273
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
274 " Lawrencium {{{
118
c1ff96232138 New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents: 114
diff changeset
275
127
1f709d7e03c6 Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
276 " Custom Mercurial commands highlighting in Lawrencium.
118
c1ff96232138 New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents: 114
diff changeset
277 let g:lawrencium_hg_commands_file_types = {
c1ff96232138 New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents: 114
diff changeset
278 \'clog': 'hggraphlog'
c1ff96232138 New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents: 114
diff changeset
279 \}
c1ff96232138 New settings for Lawrencium.
Ludovic Chabant <ludovic@chabant.com>
parents: 114
diff changeset
280
127
1f709d7e03c6 Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
281 " Make the annotate window better in Lawrencium.
206
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
282 let g:lawrencium_annotate_width_offset = 1
127
1f709d7e03c6 Better Python dev in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
283
59
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
284 " }}}
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
285
178
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
286 " Gundo {{{
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
287
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
288 let g:gundo_map_move_older = '<Down>'
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
289 let g:gundo_map_move_newer = '<Up>'
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
290
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
291 " }}}
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
292
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
293 " YankRing {{{
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
294
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
295 let g:yankring_replace_n_pkey = '<C-K>'
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
296 let g:yankring_replace_p_pkey = '<C-J>'
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
297
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
298 " }}}
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
299
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
300 " Python-Mode {{{
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
301
204
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
302 let g:pymode = 1
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
303 let g:pymode_python = 'disable'
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
304 let g:pymode_syntax_all = 1
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
305 let g:pymode_syntax_print_as_function = 1
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
306 let g:pymode_syntax_space_errors = 1
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
307 let g:pymode_run = 0
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
308 let g:pymode_lint = 0
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
309 let g:pymode_trim_whitespaces = 0
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
310 let g:pymode_virtualenv = 0
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
311 let g:pymode_folding = 1
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
312
212
da7af1f2823c Property detect Python support in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 210
diff changeset
313 if !has('+python')
204
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
314 let g:pymode = 0
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
315 endif
178
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
316
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
317 " }}}
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
318
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
319 " }}}
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
320
73
39a7e05637d8 Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents: 67
diff changeset
321 " File-Specific Settings {{{
39a7e05637d8 Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents: 67
diff changeset
322
204
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
323 " Automatically change the current working directory based on a project
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
324 " I'm in.
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
325 augroup VimRCAutoCWD
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
326 au!
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
327 autocmd BufEnter * call s:SetProjectRootCwd()
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
328 augroup END
176
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
329
204
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
330 augroup VimRCFileType_markdown
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
331 au!
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
332 autocmd FileType text,markdown setlocal textwidth=80
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
333 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
334 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
335 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
336 autocmd FileType markdown nnoremap <buffer> <localleader>4 mzI####<space><esc>`z5l
176
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
337
204
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
338 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
339 autocmd BufRead,BufNewFile */_content/**/*.html set ft=piecrustmarkdown
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
340 augroup END
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
341
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
342 augroup VimRCFileType_php
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
343 au!
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
344 " Who the hell changes my matchpairs?
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
345 autocmd FileType php setlocal matchpairs-=<:>
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
346 augroup END
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
347
204
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
348 augroup VimRCFileType_c
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
349 au!
287
44c9d65cfa74 Readjust some Vim config stuff around folding.
Ludovic Chabant <ludovic@chabant.com>
parents: 286
diff changeset
350 autocmd FileType c,c++,cpp setlocal foldmethod=syntax
204
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
351 augroup END
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
352
204
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
353 augroup VimRCFileType_css
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
354 au!
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
355 autocmd BufNewFile,BufRead *.less setlocal filetype=less
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
356 autocmd Filetype less,css setlocal foldmethod=marker
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
357 autocmd Filetype less,css setlocal foldmarker={,}
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
358 autocmd Filetype less,css setlocal iskeyword+=-
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
359 autocmd Filetype less,css setlocal omnifunc=csscomplete#CompleteCSS
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
360 augroup END
160
5997455e475b Whitespace cleaning.
Ludovic Chabant <ludovic@chabant.com>
parents: 157
diff changeset
361
204
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
362 augroup VimRCFileType_python
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
363 au!
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
364 autocmd FileType python setlocal define=\\v^\\s*(def\|class)\\s+
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
365 "autocmd FileType python if exists('python_space_error_highlight')|unlet python_space_error_highlight|endif
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
366 augroup END
160
5997455e475b Whitespace cleaning.
Ludovic Chabant <ludovic@chabant.com>
parents: 157
diff changeset
367
204
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
368 augroup VimRCTrailingWhitespaces
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
369 au!
287
44c9d65cfa74 Readjust some Vim config stuff around folding.
Ludovic Chabant <ludovic@chabant.com>
parents: 286
diff changeset
370 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
371 augroup END
73
39a7e05637d8 Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents: 67
diff changeset
372
39a7e05637d8 Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents: 67
diff changeset
373 " }}}
39a7e05637d8 Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents: 67
diff changeset
374
59
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
375 " Mappings {{{
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
376
42
6b831735c092 Added french keymap support.
Ludovic Chabant <ludovic@chabant.com>
parents: 18
diff changeset
377 let mapleader=","
43
25e8b2fffd50 Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 42
diff changeset
378
76
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
379 " Visual line navigation
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
380 noremap <up> g<up>
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
381 noremap <down> g<down>
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
382 noremap <home> g<home>
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
383 noremap <end> g<end>
990968329a9b Disabled minibufexpl for a while.
Ludovic Chabant <ludovic@chabant.com>
parents: 73
diff changeset
384
169
4947d1f99b72 Better tab/buffer navigation.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
385 " Tab navigation
178
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
386 noremap <C-Tab> :tabnext<cr>
94bf0bd0a788 Updated sub-repos.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
387 noremap <C-S-Tab> :tabprevious<cr>
169
4947d1f99b72 Better tab/buffer navigation.
Ludovic Chabant <ludovic@chabant.com>
parents: 163
diff changeset
388
80
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
389 " Window navigation
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
390 nnoremap <C-up> :wincmd k<cr>
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
391 nnoremap <C-down> :wincmd j<cr>
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
392 nnoremap <C-left> :wincmd h<cr>
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
393 nnoremap <C-right> :wincmd l<cr>
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
394
176
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
395 " Switch buffers.
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
396 nnoremap <F2> :execute ("buffer " . bufname("#"))<cr>
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
397
176
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
398 " NERDTree.
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
399 nnoremap <F3> :call <SID>ToggleNERDTree()<cr>
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
400 nnoremap <F4> :call <SID>FindInNERDTree()<cr>
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
401
157
7fd22eb11789 Added `tagbar` for Vim, with keyboard shortcut.
Ludovic Chabant <ludovic@chabant.com>
parents: 155
diff changeset
402 " Tagbar.
176
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
403 nnoremap <F5> :TagbarToggle<cr>
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
404 nnoremap <F6> :TagbarOpenAutoClose<cr>
157
7fd22eb11789 Added `tagbar` for Vim, with keyboard shortcut.
Ludovic Chabant <ludovic@chabant.com>
parents: 155
diff changeset
405
186
01304e9b4c19 Re-add Gundo mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 185
diff changeset
406 " Gundo.
01304e9b4c19 Re-add Gundo mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 185
diff changeset
407 nnoremap <F7> :GundoToggle<cr>
01304e9b4c19 Re-add Gundo mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 185
diff changeset
408
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
409 " Common typos.
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
410 nnoremap ; :
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
411
80
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
412 " Split windows
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
413 nnoremap <leader>s :split<cr>
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
414 nnoremap <leader>v :vsplit<cr>
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
415
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
416 " Easier things to type
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
417 nnoremap <leader>w :w<cr>
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
418 nnoremap <leader>q :q<cr>
119
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
419 nnoremap <leader>hh :Hg
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
420 nnoremap <leader>hg :Hg!
112
9495034e7dc4 New mappings in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 103
diff changeset
421 nnoremap <leader>hs :Hgstatus<cr>
9495034e7dc4 New mappings in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 103
diff changeset
422 nnoremap <leader>hv :Hgvdiff<cr>
80
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
423
114
ccc3902408d2 Fix the hash key in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 113
diff changeset
424 " Make the hash-key not suck.
ccc3902408d2 Fix the hash key in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 113
diff changeset
425 inoremap # X<BS>#
ccc3902408d2 Fix the hash key in Vim.
Ludovic Chabant <ludovic@chabant.com>
parents: 113
diff changeset
426
80
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
427 " Toggle invisible characters
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
428 nnoremap <leader>i :set list!<cr>
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
429
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
430 " Clear search matches
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
431 nnoremap <leader><space> :noh<cr>:call clearmatches()<cr>
43
25e8b2fffd50 Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 42
diff changeset
432
80
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
433 " Ctrl-P mappings.
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
434 nnoremap <silent> <C-p> :CtrlP<cr>
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
435 nnoremap <silent> <C-o> :CtrlPBuffer<cr>
193
ae53d68033d9 Enable fugitive and some CtrlP extensions, include a new one of my own.
Ludovic Chabant <ludovic@chabant.com>
parents: 191
diff changeset
436 nnoremap <silent> <C-u> :CtrlPTag<cr>
ae53d68033d9 Enable fugitive and some CtrlP extensions, include a new one of my own.
Ludovic Chabant <ludovic@chabant.com>
parents: 191
diff changeset
437 nnoremap <silent> <C-y> :CtrlPQuickfix<cr>
176
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
438 nnoremap <silent> <Tab> :CtrlPMRUFiles<cr>
267
70c081735745 Fix mapping.
Ludovic Chabant <ludovic@chabant.com>
parents: 266
diff changeset
439 nnoremap <silent> <F9> :CtrlPBookmarkDir<cr>
73
39a7e05637d8 Added 80 chars limit to text/markdown files.
Ludovic Chabant <ludovic@chabant.com>
parents: 67
diff changeset
440
45
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
441 " Switch between FR and US keyboard layouts.
119
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
442 nnoremap <C-l>f :setlocal keymap=french<cr>
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
443 nnoremap <C-l>u :setlocal keymap=<cr>
45
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
444
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
445 " Toggle spell check according to current keyboard layout.
119
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
446 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
447
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
448 " Simple way to close a buffer without closing the window.
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
449 nnoremap <leader>bd :bprevious<cr>:bdelete #<cr>
43
25e8b2fffd50 Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 42
diff changeset
450
103
a755319f124e Added mappings for substitutions.
Ludovic Chabant <ludovic@chabant.com>
parents: 101
diff changeset
451 " File-type switching.
83
a54180045075 Vimrc changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 80
diff changeset
452 nnoremap <leader>ftmd :set ft=markdown<cr>
80
121bef55252f Added more VIM plugins (ctrlp, easymotion, powerline).
Ludovic Chabant <ludovic@chabant.com>
parents: 76
diff changeset
453
119
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
454 " Use sane regexes.
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
455 nnoremap / /\v
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
456 vnoremap / /\v
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
457
103
a755319f124e Added mappings for substitutions.
Ludovic Chabant <ludovic@chabant.com>
parents: 101
diff changeset
458 " Quick search and replace.
119
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
459 function! s:VSetSearch()
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
460 let temp = @@
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
461 norm! gvy
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
462 let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
463 let @@ = temp
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
464 endfunction
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
465 vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR><c-o>
6dbbf36a523d VIM changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 118
diff changeset
466 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
467
206
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
468 " Jump to tags by keeping things better in view. Option for jumping to a tag
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
469 " in a split window where everything is folded except what you need to see.
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
470 function! JumpToTag()
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
471 execute "normal! \<c-]>zz"
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
472 endfunction
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
473 function! JumpToTagInSplit()
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
474 execute "normal! \<c-w>v\<c-]>zMzvzz"
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
475 endfunction
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
476 nnoremap <c-]> :silent! call JumpToTag()<cr>
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
477 nnoremap <c-\> :silent! call JumpToTagInSplit()<cr>
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
478
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
479 " Keep search matches in the middle of the window.
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
480 nnoremap n nzzzv
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
481 nnoremap N Nzzzv
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
482
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
483 " Same when jumping around
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
484 nnoremap g; g;zz
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
485 nnoremap g, g,zz
dae926f52b9a Some Vim tweaks.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
486
59
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
487 " }}}
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
488
204
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
489 " Folding {{{
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
490
287
44c9d65cfa74 Readjust some Vim config stuff around folding.
Ludovic Chabant <ludovic@chabant.com>
parents: 286
diff changeset
491 " Folds are defined by markers in the text.
44c9d65cfa74 Readjust some Vim config stuff around folding.
Ludovic Chabant <ludovic@chabant.com>
parents: 286
diff changeset
492 set foldmethod=marker
204
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
493
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
494 " Toggle folds with <space>.
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
495 nnoremap <space> za
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
496
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
497 " Create folds with <space> (in visual mode).
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
498 vnoremap <space> zf
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
499
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
500 " }}}
4bd15b5afcfc Some cleanup and improvements to `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 201
diff changeset
501
59
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
502 " Abbreviations {{{
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
503
43
25e8b2fffd50 Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 42
diff changeset
504 iabbrev @@ ludovic@chabant.com
25e8b2fffd50 Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 42
diff changeset
505 iabbrev ccopy Copyright &copy;2011 Ludovic Chabant, all rights reserved.
25e8b2fffd50 Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 42
diff changeset
506 iabbrev ssig --<cr>l u d o .<cr>. 8 0 17 80
0
9dbf340c7956 Initial commit
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
507
59
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
508 " }}}
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
509
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
510 " Status Line {{{
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
511
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
512 set statusline=%f " Path.
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
513 set statusline+=%m " Modified flag.
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
514 set statusline+=%r " Readonly flag.
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
515 set statusline+=%w " Preview window flag.
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
516
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
517 set statusline+=\ " Space.
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
518
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
519 set statusline+=%#redbar# " Highlight the following as a warning.
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
520 set statusline+=%{SyntasticStatuslineFlag()} " Syntastic errors.
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
521 set statusline+=%* " Reset highlighting.
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
522
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
523 set statusline+=%= " Right align.
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
524
201
0db3b41793ee Add AutoTags indicator to the statusline.
Ludovic Chabant <ludovic@chabant.com>
parents: 197
diff changeset
525 " Tag file generation indicator.
213
769869e61101 Renamed autotags to gutentags.
Ludovic Chabant <ludovic@chabant.com>
parents: 212
diff changeset
526 set statusline+=%{gutentags#statusline('[TAGS]')}
201
0db3b41793ee Add AutoTags indicator to the statusline.
Ludovic Chabant <ludovic@chabant.com>
parents: 197
diff changeset
527 set statusline+=\ " Space.
0db3b41793ee Add AutoTags indicator to the statusline.
Ludovic Chabant <ludovic@chabant.com>
parents: 197
diff changeset
528
61
8c80aa9bd387 Re-enabled lawrencium status-line.
Ludovic Chabant <ludovic@chabant.com>
parents: 59
diff changeset
529 " Mercurial information.
8c80aa9bd387 Re-enabled lawrencium status-line.
Ludovic Chabant <ludovic@chabant.com>
parents: 59
diff changeset
530 set statusline+=%{lawrencium#statusline('[',']')}
8c80aa9bd387 Re-enabled lawrencium status-line.
Ludovic Chabant <ludovic@chabant.com>
parents: 59
diff changeset
531 set statusline+=\ " Space.
8c80aa9bd387 Re-enabled lawrencium status-line.
Ludovic Chabant <ludovic@chabant.com>
parents: 59
diff changeset
532
59
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
533 " File format, encoding and type. Ex: "(unix/utf-8/python)"
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
534 set statusline+=(
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
535 set statusline+=%{&ff} " Format (unix/DOS).
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
536 set statusline+=/
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
537 set statusline+=%{strlen(&fenc)?&fenc:&enc} " Encoding (utf-8).
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
538 set statusline+=/
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
539 set statusline+=%{&ft} " Type (python).
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
540 set statusline+=)
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
541
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
542 " Line and column position and counts.
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
543 set statusline+=\ (line\ %l\/%L,\ col\ %03c)
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
544
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
545 " }}}
6df571869f4a Added statusline and fold-related mappings.
Ludovic Chabant <ludovic@chabant.com>
parents: 55
diff changeset
546
45
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
547 " Functions {{{
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
548
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
549 function! s:ToggleSpellCheck() abort
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
550 if &spell ==? 'nospell'
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
551 if &keymap ==? 'french'
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
552 setlocal spell spelllang=fr_fr
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
553 else
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
554 setlocal spell spelllang=en_us,en_ca
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
555 endif
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
556 else
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
557 setlocal spell nospell
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
558 endif
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
559 endfunction
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
560
160
5997455e475b Whitespace cleaning.
Ludovic Chabant <ludovic@chabant.com>
parents: 157
diff changeset
561 function! s:StripTrailingWhitespaces() abort
5997455e475b Whitespace cleaning.
Ludovic Chabant <ludovic@chabant.com>
parents: 157
diff changeset
562 let l = line(".")
5997455e475b Whitespace cleaning.
Ludovic Chabant <ludovic@chabant.com>
parents: 157
diff changeset
563 let c = col(".")
5997455e475b Whitespace cleaning.
Ludovic Chabant <ludovic@chabant.com>
parents: 157
diff changeset
564 %s/\s\+$//e
5997455e475b Whitespace cleaning.
Ludovic Chabant <ludovic@chabant.com>
parents: 157
diff changeset
565 let @/=''
5997455e475b Whitespace cleaning.
Ludovic Chabant <ludovic@chabant.com>
parents: 157
diff changeset
566 call cursor(l, c)
5997455e475b Whitespace cleaning.
Ludovic Chabant <ludovic@chabant.com>
parents: 157
diff changeset
567 endfunction
5997455e475b Whitespace cleaning.
Ludovic Chabant <ludovic@chabant.com>
parents: 157
diff changeset
568
176
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
569 function! s:FindProjectRoot(cur, marker) abort
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
570 let l:cur = a:cur
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
571 let l:previous_cur = ''
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
572 let l:slash = '/'
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
573 if has('win32')
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
574 let l:slash = '\\'
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
575 endif
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
576 while l:cur != l:previous_cur
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
577 let l:marker_path = l:cur . l:slash . a:marker
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
578 if glob(l:marker_path) != ''
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
579 return fnamemodify(l:cur, ':p')
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
580 endif
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
581 let l:previous_cur = l:cur
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
582 let l:cur = fnamemodify(l:cur, ':h')
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
583 endwhile
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
584 return ''
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
585 endfunction
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
586
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
587 function! s:SetProjectRootCwd() abort
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
588 let l:cur_file_dir = expand('%:p:h', 1)
284
8d04d41d4903 Don't change the cwd when no project root markers have been found.
Ludovic Chabant <ludovic@chabant.com>
parents: 269
diff changeset
589 if l:cur_file_dir =~ '\v^(\w+:)?(//|\\\\)'
8d04d41d4903 Don't change the cwd when no project root markers have been found.
Ludovic Chabant <ludovic@chabant.com>
parents: 269
diff changeset
590 " Don't do shit on filenames coming from the network or something.
176
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
591 return
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
592 endif
284
8d04d41d4903 Don't change the cwd when no project root markers have been found.
Ludovic Chabant <ludovic@chabant.com>
parents: 269
diff changeset
593 let l:found_root = 0
176
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
594 let l:root = l:cur_file_dir
185
0ed6642b8db8 Fixed a bug in `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 183
diff changeset
595 let l:markers = []
0ed6642b8db8 Fixed a bug in `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 183
diff changeset
596 if exists('g:ctrlp_root_markers')
0ed6642b8db8 Fixed a bug in `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 183
diff changeset
597 let l:markers += g:ctrlp_root_markers
0ed6642b8db8 Fixed a bug in `vimrc`.
Ludovic Chabant <ludovic@chabant.com>
parents: 183
diff changeset
598 endif
176
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
599 let l:markers += ['.git', '.hg', '.svn', '.bzr', '_darcs']
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
600 for marker in l:markers
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
601 let l:proj_root = s:FindProjectRoot(l:cur_file_dir, marker)
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
602 if l:proj_root != ''
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
603 let l:root = l:proj_root
284
8d04d41d4903 Don't change the cwd when no project root markers have been found.
Ludovic Chabant <ludovic@chabant.com>
parents: 269
diff changeset
604 let l:found_root = 1
176
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
605 break
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
606 endif
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
607 endfor
284
8d04d41d4903 Don't change the cwd when no project root markers have been found.
Ludovic Chabant <ludovic@chabant.com>
parents: 269
diff changeset
608 if l:found_root
8d04d41d4903 Don't change the cwd when no project root markers have been found.
Ludovic Chabant <ludovic@chabant.com>
parents: 269
diff changeset
609 execute 'lcd!' fnameescape(l:root)
8d04d41d4903 Don't change the cwd when no project root markers have been found.
Ludovic Chabant <ludovic@chabant.com>
parents: 269
diff changeset
610 endif
176
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
611 endfunction
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
612
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
613 function! s:ToggleNERDTree() abort
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
614 let l:was_open = nerdtree#isTreeOpen()
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
615 NERDTreeToggle
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
616 if !l:was_open
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
617 wincmd p
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
618 NERDTreeCWD
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
619 wincmd p
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
620 NERDTreeFind
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
621 endif
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
622 endfunction
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
623
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
624 function! s:FindInNERDTree() abort
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
625 if !nerdtree#isTreeOpen()
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
626 call s:ToggleNERDTree()
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
627 else
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
628 if getbufvar('%', 'NERDTreeType') != ''
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
629 wincmd p
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
630 else
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
631 NERDTreeFind
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
632 endif
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
633 endif
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
634 endfunction
c6a072353606 Vim config changes:
Ludovic Chabant <ludovic@chabant.com>
parents: 173
diff changeset
635
45
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
636 " }}}
aac6188ab4d6 Added vimroom plugin (disabled by default).
Ludovic Chabant <ludovic@chabant.com>
parents: 43
diff changeset
637
171
7559d8bc39bb Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents: 169
diff changeset
638 " Local override {{{
7559d8bc39bb Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents: 169
diff changeset
639
191
896acf280e7a Make local Vim config consistent with Mercurial local config.
Ludovic Chabant <ludovic@chabant.com>
parents: 186
diff changeset
640 let s:local_vimrc = s:vim_home.'/vimrc-local'
171
7559d8bc39bb Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents: 169
diff changeset
641 if filereadable(s:local_vimrc)
7559d8bc39bb Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents: 169
diff changeset
642 execute 'source' s:local_vimrc
7559d8bc39bb Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents: 169
diff changeset
643 endif
7559d8bc39bb Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents: 169
diff changeset
644
7559d8bc39bb Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents: 169
diff changeset
645 " }}}
7559d8bc39bb Added local override of Vim settings.
Ludovic Chabant <ludovic@chabant.com>
parents: 169
diff changeset
646