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