Mercurial > dotfiles
annotate vim/vimrc @ 43:25e8b2fffd50
Changed some mappings.
Added some abbreviations.
Skipping lawrencium plugin while I'm writing it.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 24 Nov 2011 18:24:46 -0800 |
parents | 6b831735c092 |
children | aac6188ab4d6 |
rev | line source |
---|---|
6 | 1 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
2 " | |
0 | 3 " Ludovic Chabant's ~/.vimrc |
4 " | |
6 | 5 " http://ludovic.chabant.com |
6 " | |
7 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
0 | 8 |
9 " Use Vim settings, rather then Vi settings (much better!). | |
10 " This must be first, because it changes other options as a side effect. | |
11 set nocompatible | |
12 | |
6 | 13 " Set some important system-dependent variables. |
14 if has("win32") || has("win64") || has("dos32") | |
15 let $HOMEVIM = "vimfiles" | |
16 let $PLATFORM = "windows" | |
17 else | |
18 let $HOMEVIM = ".vim" | |
19 let $PLATFORM = "unix" | |
20 endif | |
21 | |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
22 " Disable some plugins. |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
23 let g:pathogen_disabled = [] |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
24 call add(g:pathogen_disabled, 'command-t') |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
25 call add(g:pathogen_disabled, 'lawrencium') |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
26 |
0 | 27 " Load pathogen. |
28 call pathogen#infect() | |
29 | |
10
00cac5ebf546
Added default window size. Added buffer keyboard shortcuts.
ludovicchabant
parents:
6
diff
changeset
|
30 " Hide the toolbar in MacVim/gVIM, and set a nice window size. |
0 | 31 if has("gui_running") |
32 set guioptions=-t | |
10
00cac5ebf546
Added default window size. Added buffer keyboard shortcuts.
ludovicchabant
parents:
6
diff
changeset
|
33 set lines=50 |
00cac5ebf546
Added default window size. Added buffer keyboard shortcuts.
ludovicchabant
parents:
6
diff
changeset
|
34 set columns=135 |
0 | 35 endif |
36 | |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
37 " Disable modelines. |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
38 set modelines=0 |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
39 |
6 | 40 " Don't unload abandoned buffers. |
41 set hidden | |
0 | 42 |
6 | 43 " Show line numbers. |
44 set number | |
45 | |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
46 " 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
|
47 set showmode |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
48 set showcmd |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
49 |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
50 " Keep the cursor off the top/bottom edges. |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
51 set scrolloff=3 |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
52 |
6 | 53 " Smart auto-indenting. |
0 | 54 set autoindent |
55 set smartindent | |
6 | 56 |
57 " Use confirmation dialog. | |
0 | 58 set confirm |
6 | 59 |
60 " Remember lots of commands. | |
0 | 61 set history=1000 |
6 | 62 |
63 " Use incremental search, with highlighting, | |
64 " case-insensitive unless we actually type some | |
65 " mixed-case stuff. | |
0 | 66 set incsearch |
67 set hlsearch | |
68 set ignorecase | |
69 set smartcase | |
6 | 70 |
71 " Always show window status lines. | |
0 | 72 set laststatus=2 |
6 | 73 |
74 " Enable using the mouse like some everyday guy. | |
0 | 75 set mouse=a |
6 | 76 |
77 " Show interesting stuff at the bottom of the window. | |
0 | 78 set showcmd |
79 set ruler | |
6 | 80 |
81 " Don't pollute the hard-drive with *~ files. Only | |
82 " create them in hidden backup/temp directories while | |
83 " we edit the file, and then get rid of it. | |
0 | 84 set nobackup |
85 set writebackup | |
6 | 86 set backupdir=~/$HOMEVIM/backup |
87 set directory=~/$HOMEVIM/temp | |
88 | |
89 " Better command-line completion, but don't show some | |
90 " stuff we don't care about. | |
0 | 91 set wildmenu |
92 set wildignore+=.DS_Store,Thumbs.db | |
6 | 93 |
94 " Always display the tab-page line. | |
0 | 95 set showtabline=2 |
6 | 96 |
97 " Show matching braces. | |
98 set showmatch | |
99 | |
100 " Set the file-formats. | |
0 | 101 set ffs=unix,mac,dos |
6 | 102 |
103 " Tabs and indenting are 4 characters, and tabs behave like | |
104 " spaces during editing. They're smart, too, and when you | |
105 " press <TAB> it actually inserts a soft-tab so everything's | |
106 " indented the same. | |
0 | 107 set tabstop=4 |
108 set shiftwidth=4 | |
109 set softtabstop=4 | |
110 set smarttab | |
111 set expandtab | |
6 | 112 |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
113 " Default encoding |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
114 set encoding=utf-8 |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
115 |
6 | 116 " Clipboard buffer. |
0 | 117 set clipboard=unnamed |
6 | 118 |
119 " Smoot terminal experience. | |
0 | 120 set ttyfast |
6 | 121 |
122 " Allow backspacing over anything. | |
0 | 123 set backspace=indent,eol,start |
124 | |
6 | 125 " Going left and right let you go to other lines. |
126 set whichwrap+=<,>,h,l | |
127 | |
128 " And now, for some system-dependent settings: | |
129 " - font to use | |
130 if $PLATFORM == "windows" | |
131 set guifont=Consolas:h12 | |
132 else | |
133 set guifont=Monaco:h12 | |
134 endif | |
135 | |
136 | |
0 | 137 " Syntax highlighting |
138 syntax on | |
139 | |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
140 " Change the current directory to the home directory. |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
141 cd ~/ |
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
142 |
6 | 143 " Default color scheme |
144 colorscheme peaksea | |
145 set background=dark | |
146 | |
147 " Enable file type detection. | |
0 | 148 filetype indent plugin on |
149 | |
10
00cac5ebf546
Added default window size. Added buffer keyboard shortcuts.
ludovicchabant
parents:
6
diff
changeset
|
150 " MiniBufExplorer |
00cac5ebf546
Added default window size. Added buffer keyboard shortcuts.
ludovicchabant
parents:
6
diff
changeset
|
151 " Navigate with CTRL+Tab/CTRL+Shift+Tab |
18
cec2213f938c
Removed some MiniBufExplorer mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
13
diff
changeset
|
152 let g:miniBufExplMapCTabSwitchBufs = 1 |
10
00cac5ebf546
Added default window size. Added buffer keyboard shortcuts.
ludovicchabant
parents:
6
diff
changeset
|
153 |
6 | 154 " Custom mappings. |
42
6b831735c092
Added french keymap support.
Ludovic Chabant <ludovic@chabant.com>
parents:
18
diff
changeset
|
155 let mapleader="," |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
156 |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
157 " Edit & source the VIMRC |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
158 nnoremap <leader>ev :vsplit $MYVIMRC<cr> |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
159 nnoremap <leader>sv :source $MYVIMRC<cr> |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
160 |
10
00cac5ebf546
Added default window size. Added buffer keyboard shortcuts.
ludovicchabant
parents:
6
diff
changeset
|
161 " MiniBufExplorer mappings |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
162 nnoremap <F2> :MiniBufExplorer<cr> |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
163 |
13 | 164 " Open NERDtree |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
165 nnoremap <F3> :NERDTreeToggle<cr> |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
166 |
42
6b831735c092
Added french keymap support.
Ludovic Chabant <ludovic@chabant.com>
parents:
18
diff
changeset
|
167 " Switch between FR and US keyboard layouts |
43
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
168 nnoremap <leader>fr :set keymap=french<cr> |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
169 nnoremap <leader>us :set keymap=<cr> |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
170 |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
171 " Abbreviations |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
172 iabbrev @@ ludovic@chabant.com |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
173 iabbrev ccopy Copyright ©2011 Ludovic Chabant, all rights reserved. |
25e8b2fffd50
Changed some mappings.
Ludovic Chabant <ludovic@chabant.com>
parents:
42
diff
changeset
|
174 iabbrev ssig --<cr>l u d o .<cr>. 8 0 17 80 |
0 | 175 |
176 " Temporary stuff | |
177 "let mapleader="," " Use , as Leader | |
178 "let gmapleader="," | |
179 "map Y y$ " Yank to the end of the line w/ Y | |
180 "map <leader>nt :tabnew<CR> " New tab w/ ,nt | |
181 "map <leader>f :FufFile<CR> " Find files with ,f | |
182 "nmap <leader>w :w!<cr> | |
183 "map <F3> :r !pbpaste<CR> | |
184 "map <F4> :setlocal spell spelllang=en_gb<CR> " Turn on spellcheck with <F4> | |
185 "map <F5> :set nospell<CR> | |
186 "set pastetoggle=<F6> | |
187 "map <F7> :set complete+=k<CR> | |
188 "map <S-F7> :set complete=-k<CR> | |
189 "map <F8> :YRShow<CR> " Show the YankRing w/ <F8> | |
190 "nnoremap <F3> :GundoToggle<CR> " Show the undo tree w/ <F3> | |
191 "nnoremap ; : | |
192 "autocmd BufRead,BufNewfile ~/notes/* set filetype=markdown " All files in ~/notes are Markdown | |
193 "au BufWinLeave *.html,*.css mkview | |
194 "au BufWinEnter *.html,*.css silent loadview | |
195 "au FileType mail set tw=65 " Thin width when writing mail in mutt | |
196 "au FocusLost * :wa " Saves file when vim loses focus | |
197 "if has('statusline') " Status line with git repo info | |
198 " set statusline=%<%f\ | |
199 " set statusline+=%w%h%m%r | |
200 " set statusline+=%{fugitive#statusline()} | |
201 " set statusline+=\ [%{&ff}/%Y] | |
202 " set statusline+=\ [%{getcwd()}] | |
203 " set statusline+=%=%-14.(Line:\ %l\ of\ %L\ [%p%%]\ -\ Col:\ %c%V%) | |
204 "endif | |
205 | |
206 " When started as "evim", evim.vim will already have done these settings. | |
207 "if v:progname =~? "evim" | |
208 " finish | |
209 "endif | |
210 | |
211 " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries | |
212 " let &guioptions = substitute(&guioptions, "t", "", "g") | |
213 | |
214 " Don't use Ex mode, use Q for formatting | |
215 "map Q gq | |
216 | |
217 " This is an alternative that also works in block mode, but the deleted | |
218 " text is lost and it only works for putting the current register. | |
219 "vnoremap p "_dp | |
220 | |
221 " Switch syntax highlighting on, when the terminal has colors | |
222 " Also switch on highlighting the last used search pattern. | |
223 "if &t_Co > 2 || has("gui_running") | |
224 " syntax on | |
225 " set hlsearch | |
226 "endif | |
227 | |
228 " Only do this part when compiled with support for autocommands. | |
229 "if has("autocmd") | |
230 | |
231 " Enable file type detection. | |
232 " Use the default filetype settings, so that mail gets 'tw' set to 72, | |
233 " 'cindent' is on in C files, etc. | |
234 " Also load indent files, to automatically do language-dependent indenting. | |
235 " filetype plugin indent on | |
236 | |
237 " Put these in an autocmd group, so that we can delete them easily. | |
238 " augroup vimrcEx | |
239 " au! | |
240 | |
241 " For all text files set 'textwidth' to 78 characters. | |
242 " autocmd FileType text setlocal textwidth=78 | |
243 | |
244 " When editing a file, always jump to the last known cursor position. | |
245 " Don't do it when the position is invalid or when inside an event handler | |
246 " (happens when dropping a file on gvim). | |
247 " autocmd BufReadPost * | |
248 " \ if line("'\"") > 0 && line("'\"") <= line("$") | | |
249 " \ exe "normal g`\"" | | |
250 " \ endif | |
251 | |
252 " augroup END | |
253 | |
254 "else | |
255 | |
256 " set autoindent " always set autoindenting on | |
257 | |
258 "endif " has("autocmd") | |
259 | |
260 "set fileformats=dos,unix " set fileformat to DOS by default | |
261 |