Mercurial > dotfiles
comparison vim/vimrc @ 45:aac6188ab4d6
Added vimroom plugin (disabled by default).
VIMRC not setting some GUI stuff on re-sourcing (to not screw up the window when I iterate on it).
Changed some mappings.
Added some function to toggle spell-checking depending on the keyboard map.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 29 Nov 2011 18:04:16 -0800 |
parents | 25e8b2fffd50 |
children | ee3d235ca3fb |
comparison
equal
deleted
inserted
replaced
44:263d5383be8a | 45:aac6188ab4d6 |
---|---|
8 | 8 |
9 " Use Vim settings, rather then Vi settings (much better!). | 9 " Use Vim settings, rather then Vi settings (much better!). |
10 " This must be first, because it changes other options as a side effect. | 10 " This must be first, because it changes other options as a side effect. |
11 set nocompatible | 11 set nocompatible |
12 | 12 |
13 " Set a variable that says we already sourced this file, for those few | |
14 " settings we don't want to re-apply. | |
15 if exists('g:sourced_vimrc') | |
16 let g:resourcing_vimrc = 1 | |
17 endif | |
18 let g:sourced_vimrc = 1 | |
19 | |
13 " Set some important system-dependent variables. | 20 " Set some important system-dependent variables. |
14 if has("win32") || has("win64") || has("dos32") | 21 if has("win32") || has("win64") || has("dos32") |
15 let $HOMEVIM = "vimfiles" | 22 let $HOMEVIM = "vimfiles" |
16 let $PLATFORM = "windows" | 23 let $PLATFORM = "windows" |
17 else | 24 else |
21 | 28 |
22 " Disable some plugins. | 29 " Disable some plugins. |
23 let g:pathogen_disabled = [] | 30 let g:pathogen_disabled = [] |
24 call add(g:pathogen_disabled, 'command-t') | 31 call add(g:pathogen_disabled, 'command-t') |
25 call add(g:pathogen_disabled, 'lawrencium') | 32 call add(g:pathogen_disabled, 'lawrencium') |
33 call add(g:pathogen_disabled, 'vimroom') | |
26 | 34 |
27 " Load pathogen. | 35 " Load pathogen. |
28 call pathogen#infect() | 36 call pathogen#infect() |
29 | 37 |
30 " Hide the toolbar in MacVim/gVIM, and set a nice window size. | 38 " Hide the toolbar in MacVim/gVIM, and set a nice window size. |
31 if has("gui_running") | 39 if has("gui_running") && !exists('g:resourcing_vimrc') |
32 set guioptions=-t | 40 set guioptions=-t |
33 set lines=50 | 41 set lines=50 |
34 set columns=135 | 42 set columns=135 |
35 endif | 43 endif |
36 | 44 |
132 else | 140 else |
133 set guifont=Monaco:h12 | 141 set guifont=Monaco:h12 |
134 endif | 142 endif |
135 | 143 |
136 | 144 |
137 " Syntax highlighting | 145 " Syntax highlighting. |
138 syntax on | 146 syntax on |
139 | 147 |
140 " Change the current directory to the home directory. | 148 " Change the current directory to the home directory. |
141 cd ~/ | 149 if !exists('g:resourcing_vimrc') |
142 | 150 cd ~/ |
143 " Default color scheme | 151 endif |
152 | |
153 " Default color scheme. | |
144 colorscheme peaksea | 154 colorscheme peaksea |
145 set background=dark | 155 set background=dark |
146 | 156 |
147 " Enable file type detection. | 157 " Enable file type detection. |
148 filetype indent plugin on | 158 filetype indent plugin on |
149 | 159 |
150 " MiniBufExplorer | 160 " Navigate MiniBufExplorer with CTRL+Tab/CTRL+Shift+Tab. |
151 " Navigate with CTRL+Tab/CTRL+Shift+Tab | |
152 let g:miniBufExplMapCTabSwitchBufs = 1 | 161 let g:miniBufExplMapCTabSwitchBufs = 1 |
153 | 162 |
154 " Custom mappings. | 163 " Custom mappings. |
155 let mapleader="," | 164 let mapleader="," |
156 | 165 |
157 " Edit & source the VIMRC | 166 " Edit & source the VIMRC. |
158 nnoremap <leader>ev :vsplit $MYVIMRC<cr> | 167 nnoremap <leader>ev :vsplit $MYVIMRC<cr> |
159 nnoremap <leader>sv :source $MYVIMRC<cr> | 168 nnoremap <leader>sv :source $MYVIMRC<cr> |
160 | 169 |
161 " MiniBufExplorer mappings | 170 " MiniBufExplorer mappings. |
162 nnoremap <F2> :MiniBufExplorer<cr> | 171 nnoremap <F2> :TMiniBufExplorer<cr> |
163 | 172 |
164 " Open NERDtree | 173 " Open NERDtree. |
165 nnoremap <F3> :NERDTreeToggle<cr> | 174 nnoremap <F3> :NERDTreeToggle<cr> |
166 | 175 |
167 " Switch between FR and US keyboard layouts | 176 " Switch between FR and US keyboard layouts. |
168 nnoremap <leader>fr :set keymap=french<cr> | 177 nnoremap <leader>fr :setlocal keymap=french<cr> |
169 nnoremap <leader>us :set keymap=<cr> | 178 nnoremap <leader>us :setlocal keymap=<cr> |
179 | |
180 " Toggle spell check according to current keyboard layout. | |
181 nnoremap <leader>sp :call <SID>ToggleSpellCheck()<cr> | |
182 | |
183 " Simple way to close a buffer without closing the window. | |
184 nnoremap <leader>bd :bprevious<cr>:bdelete #<cr> | |
170 | 185 |
171 " Abbreviations | 186 " Abbreviations |
172 iabbrev @@ ludovic@chabant.com | 187 iabbrev @@ ludovic@chabant.com |
173 iabbrev ccopy Copyright ©2011 Ludovic Chabant, all rights reserved. | 188 iabbrev ccopy Copyright ©2011 Ludovic Chabant, all rights reserved. |
174 iabbrev ssig --<cr>l u d o .<cr>. 8 0 17 80 | 189 iabbrev ssig --<cr>l u d o .<cr>. 8 0 17 80 |
190 | |
191 " Functions {{{ | |
192 | |
193 function! s:ToggleSpellCheck() abort | |
194 if &spell ==? 'nospell' | |
195 if &keymap ==? 'french' | |
196 setlocal spell spelllang=fr_fr | |
197 else | |
198 setlocal spell spelllang=en_us,en_ca | |
199 endif | |
200 else | |
201 setlocal spell nospell | |
202 endif | |
203 endfunction | |
204 | |
205 " }}} | |
175 | 206 |
176 " Temporary stuff | 207 " Temporary stuff |
177 "let mapleader="," " Use , as Leader | 208 "let mapleader="," " Use , as Leader |
178 "let gmapleader="," | 209 "let gmapleader="," |
179 "map Y y$ " Yank to the end of the line w/ Y | 210 "map Y y$ " Yank to the end of the line w/ Y |