1 " ---------------------------------------------------------------------------
3 " ---------------------------------------------------------------------------
5 set nocompatible " essential
6 set history=1000 " lots of command line history
7 set confirm " error files / jumping
8 set fileformats=unix,dos,mac " support these files
9 filetype plugin indent on " load filetype plugin
10 set iskeyword+=_,$,@,%,#,- " none word dividers
11 set viminfo='1000,f1,:100,@100,/20
12 set modeline " make sure modeline support is enabled
13 set autoread " reload files (no local changes only)
14 call pathogen#infect() " enable pathogen (plugin bundles)
16 " ---------------------------------------------------------------------------
18 " ---------------------------------------------------------------------------
20 if &t_Co > 2 || has("gui_running")
23 set t_AB=
\e[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm
24 set t_AF=
\e[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm
31 set hlsearch " Highlight all search matches
32 " Press Space to turn off highlighting and clear any message already displayed.
33 :nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
35 if !exists("autocmd_colorscheme_loaded")
36 let autocmd_colorscheme_loaded = 1
37 autocmd ColorScheme * highlight TodoRed ctermbg=LightRed guibg=#E01B1B ctermfg=White guifg=#002b37
39 " Solarized color-scheme
40 let g:solarized_termtrans=1 " Always use terminal's default bg color
42 " Auto-highlight to-do's
45 autocmd Syntax * call matchadd('TodoRed', '\W\zs\(TODO\)')
50 " ---------------------------------------------------------------------------
52 " ---------------------------------------------------------------------------
54 highlight Comment ctermfg=DarkGrey guifg=#444444
55 highlight StatusLineNC ctermfg=Black ctermbg=DarkGrey cterm=bold
56 highlight StatusLine ctermbg=Black ctermfg=LightGrey
58 " ----------------------------------------------------------------------------
59 " Highlight Trailing Whitespace
60 " ----------------------------------------------------------------------------
62 set list listchars=trail:.,tab:>.
63 highlight SpecialKey ctermfg=DarkGray ctermbg=Black
65 " ----------------------------------------------------------------------------
67 " ----------------------------------------------------------------------------
69 set nobackup " do not keep backups after close
70 set nowritebackup " do not keep a backup while working
71 set noswapfile " don't keep swp files either
72 set backupdir=$HOME/.vim/backup " store backups under ~/.vim/backup
73 set backupcopy=yes " keep attributes of original file
74 set backupskip=/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*
75 set directory=~/.vim/swap,~/tmp,. " keep swp files under ~/.vim/swap
77 " ----------------------------------------------------------------------------
79 " ----------------------------------------------------------------------------
81 set ruler " show the cursor position all the time
82 set noshowcmd " don't display incomplete commands
83 set nolazyredraw " turn off lazy redraw
84 "set number " line numbers
85 set wildmenu " turn on wild menu
86 set wildmode=list:longest,full
87 set ch=2 " command line height
88 set backspace=2 " allow backspacing over everything in insert mode
89 set whichwrap+=<,>,h,l,[,] " backspace and cursor keys wrap to
90 set shortmess=filtIoOA " shorten messages
91 set report=0 " tell us about changes
92 set nostartofline " don't jump to the start of line when scrolling
94 " ----------------------------------------------------------------------------
96 " ----------------------------------------------------------------------------
98 set showmatch " brackets/braces that is
99 set mat=5 " duration to show matching brace (1/10 sec)
100 set incsearch " do incremental searching
101 set laststatus=2 " always show the status line
102 set ignorecase " ignore case when searching
103 set smartcase " case-sensitive if search contains an uppercase character
104 set visualbell " shut the heck up
106 " ----------------------------------------------------------------------------
108 " ----------------------------------------------------------------------------
110 set autoindent " automatic indent new lines
111 set smartindent " be smart about it
112 "set nowrap " do not wrap lines
113 set softtabstop=2 " yep, two
114 set shiftwidth=2 " ..
116 set expandtab " expand tabs to spaces
117 set nosmarttab " screw tabs
118 set formatoptions+=n " support for numbered/bullet lists
119 set textwidth=80 " wrap at 80 chars by default
120 set virtualedit=block " allow virtual edit in visual block ..
122 " ----------------------------------------------------------------------------
124 " ----------------------------------------------------------------------------
127 set tabpagemax=50 " open 50 tabs max
130 " ----------------------------------------------------------------------------
132 " ----------------------------------------------------------------------------
134 " <F2> to pastetoggle, to turn-off autoindent when pasting from system clipboard
135 nnoremap <F2> :set invpaste paste?<CR>
139 "" <F8>/<Shift>-<F8> to navigation between buffers
142 nnoremap <F8> :sbnext<CR>
143 nnoremap <S-F8> :sbprevious<CR>
149 "map <A-F7> :copen<CR>
151 "" emacs movement keybindings in insert mode
157 " reflow paragraph with Q in normal and visual mode
161 "" sane movement with wrap turned on
170 "inoremap <Down> <C-o>gj
171 "inoremap <Up> <C-o>gk
173 "" do not menu with left / right in command line
174 "cnoremap <Left> <Space><BS><Left>
175 "cnoremap <Right> <Space><BS><Right>
177 " ----------------------------------------------------------------------------
179 " ----------------------------------------------------------------------------
181 " jump to last position of buffer when opening
182 au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") |
183 \ exe "normal g'\"" | endif
185 " don't use cindent for javascript
186 autocmd FileType javascript setlocal nocindent
188 " ----------------------------------------------------------------------------
190 " ----------------------------------------------------------------------------
192 "let g:LookupFile_TagExpr = '".ftags"'
193 "let g:LookupFile_MinPatLength = 2
194 "let g:LookupFile_ShowFiller = 0 " fix menu flashiness
195 "let g:LookupFile_PreservePatternHistory = 1 " preserve sorted history?
196 "let g:LookupFile_PreserveLastPattern = 0 " start with last pattern?
198 "nmap <unique> <silent> <D-f> <Plug>LookupFile
199 "imap <unique> <silent> <D-f> <C-O><Plug>LookupFile
201 " ----------------------------------------------------------------------------
203 " ----------------------------------------------------------------------------
205 if system('uname') =~ 'Darwin'
207 \ '/usr/local/bin:/usr/local/sbin:' .
209 \ '/opt/local/bin:/opt/local/sbin:' .
213 " ---------------------------------------------------------------------------
215 " ---------------------------------------------------------------------------
217 au Filetype sh,bash set ts=4 sts=4 sw=4 expandtab
220 " ---------------------------------------------------------------------------
222 " ---------------------------------------------------------------------------
224 "map ,f :tabnew <cfile><CR>
226 "map ,dt :tabnew %:h/<CR>
228 "" I use these commands in my TODO file
229 "map ,a o<ESC>:r!date +'\%A, \%B \%d, \%Y'<CR>:r!date +'\%A, \%B \%d, \%Y' \| sed 's/./-/g'<CR>A<CR><ESC>
232 "map ,x :s/^\[ \]/[x]/<CR>
233 "map ,X :s/^\[x\]/[ ]/<CR>
235 " ---------------------------------------------------------------------------
236 " Strip all trailing whitespace in file
237 " ---------------------------------------------------------------------------
239 function! StripWhitespace ()
242 map ,s :call StripWhitespace ()<CR>
244 " ---------------------------------------------------------------------------
246 " ---------------------------------------------------------------------------
248 au Filetype gitcommit set tw=68 spell
249 "au Filetype html,xml,xsl,rhtml source $HOME/.vim/scripts/closetag.vim
251 " --------------------------------------------------------------------------
253 " --------------------------------------------------------------------------
255 let g:manpageview_pgm= 'man -P "/usr/bin/less -is"'
256 let $MANPAGER = '/usr/bin/less -is'