Mercurial > dotfiles
comparison vim/vimrc @ 59:6df571869f4a
Added statusline and fold-related mappings.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 08 Dec 2011 17:16:47 -0800 |
parents | a7932e0fa961 |
children | 8c80aa9bd387 |
comparison
equal
deleted
inserted
replaced
58:a6513d65eccf | 59:6df571869f4a |
---|---|
4 " | 4 " |
5 " http://ludovic.chabant.com | 5 " http://ludovic.chabant.com |
6 " | 6 " |
7 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | 7 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
8 | 8 |
9 " Global Setup {{{ | |
10 | |
9 " Use Vim settings, rather then Vi settings (much better!). | 11 " Use Vim settings, rather then Vi settings (much better!). |
10 " This must be first, because it changes other options as a side effect. | 12 " This must be first, because it changes other options as a side effect. |
11 set nocompatible | 13 set nocompatible |
12 | 14 |
13 " Set a variable that says we already sourced this file, for those few | 15 " Set a variable that says we already sourced this file, for those few |
37 if has("gui_running") && !exists('g:resourcing_vimrc') | 39 if has("gui_running") && !exists('g:resourcing_vimrc') |
38 set guioptions=-t | 40 set guioptions=-t |
39 set lines=50 | 41 set lines=50 |
40 set columns=135 | 42 set columns=135 |
41 endif | 43 endif |
44 | |
45 " }}} | |
46 | |
47 " General Settings {{{ | |
42 | 48 |
43 " Disable modelines. | 49 " Disable modelines. |
44 set modelines=0 | 50 set modelines=0 |
45 | 51 |
46 " Don't unload abandoned buffers. | 52 " Don't unload abandoned buffers. |
129 set backspace=indent,eol,start | 135 set backspace=indent,eol,start |
130 | 136 |
131 " Going left and right let you go to other lines. | 137 " Going left and right let you go to other lines. |
132 set whichwrap+=<,>,h,l | 138 set whichwrap+=<,>,h,l |
133 | 139 |
140 " Folds are defined by markers in the text. | |
141 set foldmethod=marker | |
142 | |
134 " And now, for some system-dependent settings: | 143 " And now, for some system-dependent settings: |
135 " - font to use | 144 " - font to use |
136 if $PLATFORM == "windows" | 145 if $PLATFORM == "windows" |
137 set guifont=Consolas:h12 | 146 set guifont=Consolas:h12 |
138 else | 147 else |
157 colorscheme solarized | 166 colorscheme solarized |
158 | 167 |
159 " Enable file type detection. | 168 " Enable file type detection. |
160 filetype indent plugin on | 169 filetype indent plugin on |
161 | 170 |
171 " }}} | |
172 | |
173 " Plugin Settings {{{ | |
174 | |
162 " Navigate MiniBufExplorer with CTRL+Tab/CTRL+Shift+Tab. | 175 " Navigate MiniBufExplorer with CTRL+Tab/CTRL+Shift+Tab. |
163 let g:miniBufExplMapCTabSwitchBufs = 1 | 176 let g:miniBufExplMapCTabSwitchBufs = 1 |
164 | 177 |
165 " Custom mappings. | 178 " }}} |
179 | |
180 " Mappings {{{ | |
181 | |
166 let mapleader="," | 182 let mapleader="," |
167 | 183 |
168 " Edit & source the VIMRC. | 184 " Edit & source the VIMRC. |
169 nnoremap <leader>ev :vsplit $MYVIMRC<cr> | 185 nnoremap <leader>ev :vsplit $MYVIMRC<cr> |
170 nnoremap <leader>sv :source $MYVIMRC<cr> | 186 nnoremap <leader>sv :source $MYVIMRC<cr> |
183 nnoremap <leader>sp :call <SID>ToggleSpellCheck()<cr> | 199 nnoremap <leader>sp :call <SID>ToggleSpellCheck()<cr> |
184 | 200 |
185 " Simple way to close a buffer without closing the window. | 201 " Simple way to close a buffer without closing the window. |
186 nnoremap <leader>bd :bprevious<cr>:bdelete #<cr> | 202 nnoremap <leader>bd :bprevious<cr>:bdelete #<cr> |
187 | 203 |
188 " Abbreviations | 204 " Toggle folds with <space> |
205 nnoremap <space> za | |
206 | |
207 " Create folds with <space> (in visual mode) | |
208 vnoremap <space> zf | |
209 | |
210 " }}} | |
211 | |
212 " Abbreviations {{{ | |
213 | |
189 iabbrev @@ ludovic@chabant.com | 214 iabbrev @@ ludovic@chabant.com |
190 iabbrev ccopy Copyright ©2011 Ludovic Chabant, all rights reserved. | 215 iabbrev ccopy Copyright ©2011 Ludovic Chabant, all rights reserved. |
191 iabbrev ssig --<cr>l u d o .<cr>. 8 0 17 80 | 216 iabbrev ssig --<cr>l u d o .<cr>. 8 0 17 80 |
217 | |
218 " }}} | |
219 | |
220 " Status Line {{{ | |
221 | |
222 set statusline=%f " Path. | |
223 set statusline+=%m " Modified flag. | |
224 set statusline+=%r " Readonly flag. | |
225 set statusline+=%w " Preview window flag. | |
226 | |
227 set statusline+=\ " Space. | |
228 | |
229 set statusline+=%#redbar# " Highlight the following as a warning. | |
230 set statusline+=%{SyntasticStatuslineFlag()} " Syntastic errors. | |
231 set statusline+=%* " Reset highlighting. | |
232 | |
233 set statusline+=%= " Right align. | |
234 | |
235 " File format, encoding and type. Ex: "(unix/utf-8/python)" | |
236 set statusline+=( | |
237 set statusline+=%{&ff} " Format (unix/DOS). | |
238 set statusline+=/ | |
239 set statusline+=%{strlen(&fenc)?&fenc:&enc} " Encoding (utf-8). | |
240 set statusline+=/ | |
241 set statusline+=%{&ft} " Type (python). | |
242 set statusline+=) | |
243 | |
244 " Line and column position and counts. | |
245 set statusline+=\ (line\ %l\/%L,\ col\ %03c) | |
246 | |
247 " }}} | |
192 | 248 |
193 " Functions {{{ | 249 " Functions {{{ |
194 | 250 |
195 function! s:ToggleSpellCheck() abort | 251 function! s:ToggleSpellCheck() abort |
196 if &spell ==? 'nospell' | 252 if &spell ==? 'nospell' |
241 " set statusline+=\ [%{&ff}/%Y] | 297 " set statusline+=\ [%{&ff}/%Y] |
242 " set statusline+=\ [%{getcwd()}] | 298 " set statusline+=\ [%{getcwd()}] |
243 " set statusline+=%=%-14.(Line:\ %l\ of\ %L\ [%p%%]\ -\ Col:\ %c%V%) | 299 " set statusline+=%=%-14.(Line:\ %l\ of\ %L\ [%p%%]\ -\ Col:\ %c%V%) |
244 "endif | 300 "endif |
245 | 301 |
246 " When started as "evim", evim.vim will already have done these settings. | |
247 "if v:progname =~? "evim" | |
248 " finish | |
249 "endif | |
250 | |
251 " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries | 302 " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries |
252 " let &guioptions = substitute(&guioptions, "t", "", "g") | 303 " let &guioptions = substitute(&guioptions, "t", "", "g") |
253 | 304 |
254 " Don't use Ex mode, use Q for formatting | 305 " Don't use Ex mode, use Q for formatting |
255 "map Q gq | 306 "map Q gq |