]> git.r.bdr.sh - rbdr/dotfiles/blame - vimrc
Use ALE instead of syntastic
[rbdr/dotfiles] / vimrc
CommitLineData
b100af91
BB
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
b100af91
BB
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
6e876679
BB
73" snes syntax highlighting
74au BufNewFile,BufRead *.asm,*.s set filetype=snes"
75
b100af91
BB
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
32081fee 81filetype plugin on
d9b5e620 82set omnifunc=syntaxcomplete#Complete
b100af91
BB
83
84" Opens an edit command with the path of the currently edited file filled in
85" Normal mode: <Leader>e
86map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
87
88" Opens a tab edit command with the path of the currently edited file filled in
89" Normal mode: <Leader>t
90map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
91
b100af91
BB
92" Unimpaired configuration
93" Bubble single lines
94nmap <C-Up> [e
95nmap <C-Down> ]e
96" Bubble multiple lines
97vmap <C-Up> [egv
98vmap <C-Down> ]egv
99
b100af91
BB
100" gist-vim defaults
101if has("mac")
102 let g:gist_clip_command = 'pbcopy'
103elseif has("unix")
104 let g:gist_clip_command = 'xclip -selection clipboard'
105endif
106let g:gist_detect_filetype = 1
107let g:gist_open_browser_after_post = 1
108
109" Use modeline overrides
110set modeline
111set modelines=10
112
113" Default color scheme
114set t_Co=256
551714b7 115color molokai
b100af91
BB
116
117" Directories for swp files
dad27356
BB
118set backupdir=~/.vim/.backup
119set directory=~/.vim/.backup
b100af91
BB
120
121" Turn off jslint errors by default
122let g:JSLintHighlightErrorLine = 0
123
124" MacVIM shift+arrow-keys behavior (required in .vimrc)
125let macvim_hig_shift_movement = 1
126
127" % to bounce from do to end etc.
128runtime! macros/matchit.vim
129
130" Show (partial) command in the status line
131set showcmd
132
133" Include user's local vim config
134if filereadable(expand("~/.vimrc.local"))
135 source ~/.vimrc.local
136endif
137
138" Mapping for TagBar
139nmap <F8> :TagbarToggle<CR>
3a1cd689 140let g:tagbar_ctags_bin="/usr/local/bin/ctags"
b100af91 141
b100af91 142" Color Column
9fbf161b 143let &colorcolumn="80,150"
b100af91
BB
144
145" Add Pathogen
146call pathogen#infect()
147
148" Folding Settings
149set foldmethod=syntax
150set foldnestmax=10
151set nofoldenable
152set foldlevel=1
321ecaca 153
3a1cd689
BB
154" Fix CtrlP root folder and add some ignores
155let g:ctrlp_working_path_mode = 0
07c693d2 156let g:ctrlp_custom_ignore = '\v[\/](\.(git|hg|svn)|node_modules|DS_Store)$'
551714b7 157let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']
7da00f60
BB
158
159" Relative numbers
b4df7438
BB
160autocmd FocusLost * :set norelativenumber
161autocmd InsertEnter * :set norelativenumber
7da00f60
BB
162autocmd InsertLeave * :set relativenumber
163autocmd CursorMoved * :set relativenumber
164
165function! NumberToggle()
166 if(&relativenumber == 1)
b4df7438 167 set norelativenumber
7da00f60
BB
168 else
169 set relativenumber
170 endif
171endfunction
172
173nnoremap <C-n> :call NumberToggle()<cr>
35771083 174
f9b5f766
BB
175" Dank Mono Italics
176highlight Keyword cterm=italic
c87eeb57
BB
177
178" FZF config
179set rtp+=/usr/local/opt/fzf
180
181" Inserts the path of the currently edited file into a command
182noremap <C-P> :FZF <CR>
183
184" Map colors to vim colors
185let g:fzf_colors =
186\ { 'fg': ['fg', 'Normal'],
187 \ 'bg': ['bg', 'Normal'],
188 \ 'hl': ['fg', 'Comment'],
189 \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
190 \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
191 \ 'hl+': ['fg', 'Statement'],
192 \ 'info': ['fg', 'PreProc'],
193 \ 'border': ['fg', 'Ignore'],
194 \ 'prompt': ['fg', 'Conditional'],
195 \ 'pointer': ['fg', 'Exception'],
196 \ 'marker': ['fg', 'Keyword'],
197 \ 'spinner': ['fg', 'Label'],
198 \ 'header': ['fg', 'Comment'] }