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