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 set iskeyword+=_,$,@,%,#,- " none word dividers
10 set viminfo='1000,f1,:100,@100,/20
11 set modeline " make sure modeline support is enabled
12 set autoread " reload files (no local changes only)
14 " ---------------------------------------------------------------------------
15 " Pathogen Init (Bundles)
16 " ---------------------------------------------------------------------------
18 call pathogen#infect()
19 call pathogen#helptags()
20 filetype plugin indent on " enable plugins, detection and indenting in one step
22 " ---------------------------------------------------------------------------
24 " ---------------------------------------------------------------------------
26 if &t_Co > 2 || has("gui_running")
29 set t_AB=
\e[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm
30 set t_AF=
\e[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm
37 set background=dark " dark background
38 syntax enable " syntax highligting
39 set hlsearch " highlight all search matches
40 " Press <Space> to turn off highlighting and clear any message already displayed.
41 nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
43 " Define to-do color(s)
44 if !exists("autocmd_colorscheme_loaded")
45 let autocmd_colorscheme_loaded = 1
46 autocmd ColorScheme * highlight TodoRed ctermbg=LightRed guibg=#E01B1B ctermfg=White guifg=#002b37
49 " Solarized color-scheme
50 let g:solarized_termtrans=1 " Always use terminal's default bg color
53 " Auto-highlight TODO's
56 autocmd Syntax * call matchadd('TodoRed', '\W\zs\(TODO\)')
61 " ---------------------------------------------------------------------------
63 " ---------------------------------------------------------------------------
65 highlight Comment ctermfg=DarkGrey guifg=#444444
66 highlight StatusLineNC ctermfg=Black ctermbg=DarkGrey cterm=bold
67 highlight StatusLine ctermbg=Black ctermfg=LightGrey
69 " ----------------------------------------------------------------------------
70 " Highlight Trailing Whitespace
71 " ----------------------------------------------------------------------------
73 set list listchars=trail:.,tab:>.
74 highlight SpecialKey ctermfg=DarkGray ctermbg=Black
76 " ----------------------------------------------------------------------------
78 " ----------------------------------------------------------------------------
80 set nobackup " do not keep backups after close
81 set nowritebackup " do not keep a backup while working
82 set backupcopy=yes " keep attributes of original file
83 set backupskip=/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*
84 set directory=.,~/tmp,~/.vim/swap " swap file directory-order
86 " ----------------------------------------------------------------------------
88 " ----------------------------------------------------------------------------
90 set ruler " show the cursor position all the time
91 set showcmd " display incomplete commands
92 set nolazyredraw " turn off lazy redraw
93 set hidden " keep buffers loaded when hidden
94 set showmode " show mode at bottom of screen
95 set wildmenu " turn on wild menu
96 set wildmode=list:longest,full
97 set cmdheight=2 " command line height
98 set backspace=2 " allow backspacing over everything in insert mode
99 set whichwrap+=<,>,h,l,[,] " backspace and cursor keys wrap to
100 set shortmess=filtIoO " shorten messages
101 set report=0 " tell us about changes
102 set nostartofline " don't jump to the start of line when scrolling
103 set scrolloff=4 " vertcal padding
104 set sidescroll=40 " side-scrolling increment (for nowrap mode)
106 " ----------------------------------------------------------------------------
108 " ----------------------------------------------------------------------------
110 set showmatch " brackets/braces that is
111 set matchtime=5 " duration to show matching brace (1/10 sec)
112 set incsearch " do incremental searching
113 set laststatus=2 " always show the status line
114 set ignorecase " ignore case when searching
115 set smartcase " case-sensitive if search contains an uppercase character
116 set visualbell " shut the heck up
118 " ----------------------------------------------------------------------------
120 " ----------------------------------------------------------------------------
122 set autoindent " automatic indent new lines
123 set smartindent " be smart about it
124 set nowrap " do not wrap lines
125 set softtabstop=2 " yep, two
126 set shiftwidth=2 " ..
128 set expandtab " expand tabs to spaces
129 set nosmarttab " screw tabs
130 set formatoptions+=n " support for numbered/bullet lists
131 "set textwidth=110 " wrap at 110 chars by default
132 set virtualedit=block " allow virtual edit in visual block ..
134 " ----------------------------------------------------------------------------
135 " Filename exclusions
136 " ----------------------------------------------------------------------------
138 set wildignore+=.hg,.git,.svn " version control directories
139 set wildignore+=*.jpg,*.jpeg,*.bmp,*.gif,*.png " image files
140 set wildignore+=*.o,*.obj,*.exe,*.dll " compiled object files
141 set wildignore+=*.pyc " Python byte code
142 set wildignore+=*.sw? " Vim swap files
143 set wildignore+=.DS_Store " OSX junk
145 " ----------------------------------------------------------------------------
147 " ----------------------------------------------------------------------------
150 set tabpagemax=50 " open 50 tabs max
153 " ----------------------------------------------------------------------------
155 " ----------------------------------------------------------------------------
159 " <F2> to pastetoggle, to turn-off autoindent when pasting from system clipboard
160 nnoremap <F2> :set invpaste paste?<CR>
163 " disable default vim regex handling for searching
167 " reflow paragraph with Q in normal and visual mode
171 " sane movement with wrap turned on
180 inoremap <Down> <C-o>gj
181 inoremap <Up> <C-o>gk
183 " do not menu with left / right in command line
184 cnoremap <Left> <Space><BS><Left>
185 cnoremap <Right> <Space><BS><Right>
188 nnoremap <C-n> :bnext<CR>
189 nnoremap <C-p> :bprev<CR>
191 " easier split-window movement
192 nnoremap <C-h> <C-w>h
193 nnoremap <C-j> <C-w>j
194 nnoremap <C-k> <C-w>k
195 nnoremap <C-l> <C-w>l
197 " quickly edit/reload vimrc
198 nmap <silent> <leader>ev :edit $MYVIMRC<CR>
199 nmap <silent> <leader>sv :source $MYVIMRC<CR>
201 " ----------------------------------------------------------------------------
203 " ----------------------------------------------------------------------------
205 " jump to last position of buffer when opening
206 au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") |
207 \ exe "normal g'\"" | endif
209 " ----------------------------------------------------------------------------
211 " ----------------------------------------------------------------------------
213 if system('uname') =~ 'Darwin'
215 \ '/usr/local/bin:/usr/local/sbin:' .
217 \ '/opt/local/bin:/opt/local/sbin:' .
221 " ---------------------------------------------------------------------------
223 " ---------------------------------------------------------------------------
225 au Filetype sh,bash set ts=4 sts=4 sw=4 expandtab
228 " ---------------------------------------------------------------------------
229 " Strip all trailing whitespace in file
230 " ---------------------------------------------------------------------------
232 function! StripWhitespace ()
235 map <leader>s :call StripWhitespace ()<CR>
237 " ---------------------------------------------------------------------------
239 " ---------------------------------------------------------------------------
241 au Filetype gitcommit set tw=68 spell
242 au Filetype html,xml,xsl,rhtml source $HOME/.vim/scripts/closetag.vim
243 " don't use cindent for javascript
244 au FileType javascript setlocal nocindent
245 " Use Octopress syntax-highlighting for *.markdown files
246 au BufNewFile,BufRead *.markdown set filetype=octopress
248 " --------------------------------------------------------------------------
250 " --------------------------------------------------------------------------
252 let g:manpageview_pgm= 'man -P "/usr/bin/less -is"'
253 let $MANPAGER = '/usr/bin/less -is'
255 " --------------------------------------------------------------------------
257 " --------------------------------------------------------------------------
260 nnoremap <F5> :GundoToggle<CR>
263 noremap <leader>o <Esc>:CommandT<CR>
264 noremap <leader>O <Esc>:CommandTFlush<CR>
265 noremap <leader>m <Esc>:CommandTBuffer<CR>