]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - vimrc
Updates powerline installation data
[rbdr/dotfiles] / vimrc
... / ...
CommitLineData
1set nocompatible
2
3set number
4set ruler
5syntax on
6
7" Set encoding
8set encoding=utf-8
9
10" Whitespace stuff
11set nowrap
12set tabstop=2
13set shiftwidth=2
14set softtabstop=2
15set expandtab
16set list listchars=tab:\ \ ,trail:ยท
17
18" Searching
19set hlsearch
20set incsearch
21set ignorecase
22set smartcase
23
24" Tab completion
25set wildmode=list:longest,list:full
26set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*
27
28" Status bar
29set laststatus=2
30
31" Without setting this, ZoomWin restores windows in a way that causes
32" equalalways behavior to be triggered the next time CommandT is used.
33" This is likely a bludgeon to solve some other issue, but it works
34set noequalalways
35
36" NERDTree configuration
37let NERDTreeIgnore=['\.pyc$', '\.rbc$', '\~$']
38map <Leader>n :NERDTreeToggle<CR>
39
40" CTags
41map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
42map <C-\> :tnext<CR>
43
44" Remember last location in file
45if has("autocmd")
46 au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
47 \| exe "normal g'\"" | endif
48endif
49
50function s:setupWrapping()
51 set wrap
52 set wrapmargin=2
53 set textwidth=72
54endfunction
55
56function s:setupMarkup()
57 call s:setupWrapping()
58 map <buffer> <Leader>p :Hammer<CR>
59endfunction
60
61" make uses real tabs
62au FileType make set noexpandtab
63
64" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
65au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby
66
67" md, markdown, and mk are markdown and define buffer-local preview
68au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup()
69
70" add json syntax highlighting
71au BufNewFile,BufRead *.json set ft=javascript
72
73au BufRead,BufNewFile *.txt call s:setupWrapping()
74
75" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
76au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
77
78" allow backspacing over everything in insert mode
79set backspace=indent,eol,start
80
81" load the plugin and indent settings for the detected filetype
82filetype plugin indent on
83filetype plugin on
84
85" Opens an edit command with the path of the currently edited file filled in
86" Normal mode: <Leader>e
87map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
88
89" Opens a tab edit command with the path of the currently edited file filled in
90" Normal mode: <Leader>t
91map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
92
93" Inserts the path of the currently edited file into a command
94" Command mode: Ctrl+P
95cmap <C-P> <C-R>=expand("%:p:h") . "/" <CR>
96
97" Unimpaired configuration
98" Bubble single lines
99nmap <C-Up> [e
100nmap <C-Down> ]e
101" Bubble multiple lines
102vmap <C-Up> [egv
103vmap <C-Down> ]egv
104
105" Enable syntastic syntax checking
106let g:syntastic_enable_signs=1
107let g:syntastic_quiet_warnings=1
108
109" gist-vim defaults
110if has("mac")
111 let g:gist_clip_command = 'pbcopy'
112elseif has("unix")
113 let g:gist_clip_command = 'xclip -selection clipboard'
114endif
115let g:gist_detect_filetype = 1
116let g:gist_open_browser_after_post = 1
117
118" Use modeline overrides
119set modeline
120set modelines=10
121
122" Default color scheme
123set t_Co=256
124color molokai
125
126" Directories for swp files
127set backupdir=~/.vim/.backup
128set directory=~/.vim/.backup
129
130" Turn off jslint errors by default
131let g:JSLintHighlightErrorLine = 0
132
133" MacVIM shift+arrow-keys behavior (required in .vimrc)
134let macvim_hig_shift_movement = 1
135
136" % to bounce from do to end etc.
137runtime! macros/matchit.vim
138
139" Show (partial) command in the status line
140set showcmd
141
142" Include user's local vim config
143if filereadable(expand("~/.vimrc.local"))
144 source ~/.vimrc.local
145endif
146
147" Mapping for TagBar
148nmap <F8> :TagbarToggle<CR>
149let g:tagbar_ctags_bin="/usr/local/bin/ctags"
150
151" Color Column
152set colorcolumn=81
153
154" Add Pathogen
155call pathogen#infect()
156
157" Folding Settings
158set foldmethod=syntax
159set foldnestmax=10
160set nofoldenable
161set foldlevel=1
162
163" powerline stuff
164python from powerline.vim import setup as powerline_setup
165python powerline_setup()
166python del powerline_setup
167
168" Fix CtrlP root folder and add some ignores
169let g:ctrlp_working_path_mode = 0
170let g:ctrlp_custom_ignore = '\v[\/](\.(git|hg|svn)|node_modules|DS_Store)$'
171let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']
172
173" Relative numbers
174autocmd FocusLost * :set number
175autocmd InsertEnter * :set number
176autocmd InsertLeave * :set relativenumber
177autocmd CursorMoved * :set relativenumber
178
179function! NumberToggle()
180 if(&relativenumber == 1)
181 set number
182 else
183 set relativenumber
184 endif
185endfunction
186
187nnoremap <C-n> :call NumberToggle()<cr>
188
189" Find file and Find stuff to quickfix.
190command -nargs=1 Qff :cexpr system('find . \| ag <f-args>') | copen
191
192function! ToggleCWindow()
193 if exists("g:qwindow")
194 cclose
195 unlet g:qwindow
196 else
197 copen
198 let g:qwindow = 1
199 endif
200endfunction
201nnoremap <C-h> :call ToggleCWindow()<cr>