]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - vimrc
Add FZF config to vim. Simplify syntastic
[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" NERDTree configuration
32let NERDTreeIgnore=['\.pyc$', '\.rbc$', '\~$']
33map <Leader>n :NERDTreeToggle<CR>
34
35" CTags
36map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
37map <C-\> :tnext<CR>
38
39" Remember last location in file
40if has("autocmd")
41 au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
42 \| exe "normal g'\"" | endif
43endif
44
45function s:setupWrapping()
46 set wrap
47 set wrapmargin=2
48 set textwidth=72
49endfunction
50
51function s:setupMarkup()
52 call s:setupWrapping()
53 map <buffer> <Leader>p :Hammer<CR>
54endfunction
55
56" make uses real tabs
57au FileType make set noexpandtab
58
59" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
60au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby
61
62" md, markdown, and mk are markdown and define buffer-local preview
63au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup()
64
65" add json syntax highlighting
66au BufNewFile,BufRead *.json set ft=javascript
67
68au BufRead,BufNewFile *.txt call s:setupWrapping()
69
70" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
71au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
72
73" snes syntax highlighting
74au BufNewFile,BufRead *.asm,*.s set filetype=snes"
75
76" allow backspacing over everything in insert mode
77set backspace=indent,eol,start
78
79" load the plugin and indent settings for the detected filetype
80filetype plugin indent on
81filetype plugin on
82
83" Opens an edit command with the path of the currently edited file filled in
84" Normal mode: <Leader>e
85map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
86
87" Opens a tab edit command with the path of the currently edited file filled in
88" Normal mode: <Leader>t
89map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
90
91" Unimpaired configuration
92" Bubble single lines
93nmap <C-Up> [e
94nmap <C-Down> ]e
95" Bubble multiple lines
96vmap <C-Up> [egv
97vmap <C-Down> ]egv
98
99" gist-vim defaults
100if has("mac")
101 let g:gist_clip_command = 'pbcopy'
102elseif has("unix")
103 let g:gist_clip_command = 'xclip -selection clipboard'
104endif
105let g:gist_detect_filetype = 1
106let g:gist_open_browser_after_post = 1
107
108" Use modeline overrides
109set modeline
110set modelines=10
111
112" Default color scheme
113set t_Co=256
114color molokai
115
116" Directories for swp files
117set backupdir=~/.vim/.backup
118set directory=~/.vim/.backup
119
120" Turn off jslint errors by default
121let g:JSLintHighlightErrorLine = 0
122
123" MacVIM shift+arrow-keys behavior (required in .vimrc)
124let macvim_hig_shift_movement = 1
125
126" % to bounce from do to end etc.
127runtime! macros/matchit.vim
128
129" Show (partial) command in the status line
130set showcmd
131
132" Include user's local vim config
133if filereadable(expand("~/.vimrc.local"))
134 source ~/.vimrc.local
135endif
136
137" Mapping for TagBar
138nmap <F8> :TagbarToggle<CR>
139let g:tagbar_ctags_bin="/usr/local/bin/ctags"
140
141" Color Column
142let &colorcolumn="80,150"
143
144" Add Pathogen
145call pathogen#infect()
146
147" Folding Settings
148set foldmethod=syntax
149set foldnestmax=10
150set nofoldenable
151set foldlevel=1
152
153" Fix CtrlP root folder and add some ignores
154let g:ctrlp_working_path_mode = 0
155let g:ctrlp_custom_ignore = '\v[\/](\.(git|hg|svn)|node_modules|DS_Store)$'
156let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']
157
158" Relative numbers
159autocmd FocusLost * :set norelativenumber
160autocmd InsertEnter * :set norelativenumber
161autocmd InsertLeave * :set relativenumber
162autocmd CursorMoved * :set relativenumber
163
164function! NumberToggle()
165 if(&relativenumber == 1)
166 set norelativenumber
167 else
168 set relativenumber
169 endif
170endfunction
171
172nnoremap <C-n> :call NumberToggle()<cr>
173
174" Syntastic stuff
175let g:syntastic_javascript_checkers = ['eslint']
176let g:syntastic_always_populate_loc_list = 1
177let g:syntastic_check_on_open = 1
178let g:syntastic_check_on_wq = 1
179let g:syntastic_error_symbol = "X"
180let g:syntastic_warning_symbol = "!"
181
182" Dank Mono Italics
183highlight Keyword cterm=italic
184
185" FZF config
186set rtp+=/usr/local/opt/fzf
187
188" Inserts the path of the currently edited file into a command
189noremap <C-P> :FZF <CR>
190
191" Map colors to vim colors
192let g:fzf_colors =
193\ { 'fg': ['fg', 'Normal'],
194 \ 'bg': ['bg', 'Normal'],
195 \ 'hl': ['fg', 'Comment'],
196 \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
197 \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
198 \ 'hl+': ['fg', 'Statement'],
199 \ 'info': ['fg', 'PreProc'],
200 \ 'border': ['fg', 'Ignore'],
201 \ 'prompt': ['fg', 'Conditional'],
202 \ 'pointer': ['fg', 'Exception'],
203 \ 'marker': ['fg', 'Keyword'],
204 \ 'spinner': ['fg', 'Label'],
205 \ 'header': ['fg', 'Comment'] }