]>
Commit | Line | Data |
---|---|---|
b100af91 BB |
1 | set nocompatible |
2 | ||
3 | set number | |
4 | set ruler | |
5 | syntax on | |
6 | ||
7 | " Set encoding | |
8 | set encoding=utf-8 | |
9 | ||
10 | " Whitespace stuff | |
11 | set nowrap | |
12 | set tabstop=2 | |
13 | set shiftwidth=2 | |
14 | set softtabstop=2 | |
15 | set expandtab | |
16 | set list listchars=tab:\ \ ,trail:ยท | |
17 | ||
18 | " Searching | |
19 | set hlsearch | |
20 | set incsearch | |
21 | set ignorecase | |
22 | set smartcase | |
23 | ||
24 | " Tab completion | |
25 | set wildmode=list:longest,list:full | |
26 | set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/* | |
27 | ||
28 | " Status bar | |
29 | set laststatus=2 | |
30 | ||
b100af91 BB |
31 | " NERDTree configuration |
32 | let NERDTreeIgnore=['\.pyc$', '\.rbc$', '\~$'] | |
33 | map <Leader>n :NERDTreeToggle<CR> | |
34 | ||
35 | " CTags | |
36 | map <Leader>rt :!ctags --extra=+f -R *<CR><CR> | |
37 | map <C-\> :tnext<CR> | |
38 | ||
39 | " Remember last location in file | |
40 | if has("autocmd") | |
41 | au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | |
42 | \| exe "normal g'\"" | endif | |
43 | endif | |
44 | ||
45 | function s:setupWrapping() | |
46 | set wrap | |
47 | set wrapmargin=2 | |
48 | set textwidth=72 | |
49 | endfunction | |
50 | ||
51 | function s:setupMarkup() | |
52 | call s:setupWrapping() | |
53 | map <buffer> <Leader>p :Hammer<CR> | |
54 | endfunction | |
55 | ||
56 | " make uses real tabs | |
57 | au FileType make set noexpandtab | |
58 | ||
59 | " Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby | |
60 | au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby | |
61 | ||
62 | " md, markdown, and mk are markdown and define buffer-local preview | |
63 | au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup() | |
64 | ||
65 | " add json syntax highlighting | |
66 | au BufNewFile,BufRead *.json set ft=javascript | |
67 | ||
68 | au BufRead,BufNewFile *.txt call s:setupWrapping() | |
69 | ||
70 | " make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ ) | |
71 | au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79 | |
72 | ||
6e876679 BB |
73 | " snes syntax highlighting |
74 | au BufNewFile,BufRead *.asm,*.s set filetype=snes" | |
75 | ||
b100af91 BB |
76 | " allow backspacing over everything in insert mode |
77 | set backspace=indent,eol,start | |
78 | ||
79 | " load the plugin and indent settings for the detected filetype | |
80 | filetype plugin indent on | |
32081fee | 81 | filetype plugin on |
d9b5e620 | 82 | set 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 | |
86 | map <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 | |
90 | map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR> | |
91 | ||
b100af91 BB |
92 | " Unimpaired configuration |
93 | " Bubble single lines | |
94 | nmap <C-Up> [e | |
95 | nmap <C-Down> ]e | |
96 | " Bubble multiple lines | |
97 | vmap <C-Up> [egv | |
98 | vmap <C-Down> ]egv | |
99 | ||
b100af91 BB |
100 | " gist-vim defaults |
101 | if has("mac") | |
102 | let g:gist_clip_command = 'pbcopy' | |
103 | elseif has("unix") | |
104 | let g:gist_clip_command = 'xclip -selection clipboard' | |
105 | endif | |
106 | let g:gist_detect_filetype = 1 | |
107 | let g:gist_open_browser_after_post = 1 | |
108 | ||
109 | " Use modeline overrides | |
110 | set modeline | |
111 | set modelines=10 | |
112 | ||
113 | " Default color scheme | |
d2114c7b BB |
114 | set termguicolors |
115 | color rbdr | |
b100af91 BB |
116 | |
117 | " Directories for swp files | |
dad27356 BB |
118 | set backupdir=~/.vim/.backup |
119 | set directory=~/.vim/.backup | |
b100af91 BB |
120 | |
121 | " Turn off jslint errors by default | |
122 | let g:JSLintHighlightErrorLine = 0 | |
123 | ||
124 | " MacVIM shift+arrow-keys behavior (required in .vimrc) | |
125 | let macvim_hig_shift_movement = 1 | |
126 | ||
127 | " % to bounce from do to end etc. | |
128 | runtime! macros/matchit.vim | |
129 | ||
130 | " Show (partial) command in the status line | |
131 | set showcmd | |
132 | ||
133 | " Include user's local vim config | |
134 | if filereadable(expand("~/.vimrc.local")) | |
135 | source ~/.vimrc.local | |
136 | endif | |
137 | ||
138 | " Mapping for TagBar | |
139 | nmap <F8> :TagbarToggle<CR> | |
3a1cd689 | 140 | let g:tagbar_ctags_bin="/usr/local/bin/ctags" |
b100af91 | 141 | |
b100af91 | 142 | " Color Column |
9fbf161b | 143 | let &colorcolumn="80,150" |
b100af91 | 144 | |
b100af91 BB |
145 | " Folding Settings |
146 | set foldmethod=syntax | |
147 | set foldnestmax=10 | |
148 | set nofoldenable | |
149 | set foldlevel=1 | |
321ecaca | 150 | |
3a1cd689 BB |
151 | " Fix CtrlP root folder and add some ignores |
152 | let g:ctrlp_working_path_mode = 0 | |
07c693d2 | 153 | let g:ctrlp_custom_ignore = '\v[\/](\.(git|hg|svn)|node_modules|DS_Store)$' |
551714b7 | 154 | let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files'] |
7da00f60 BB |
155 | |
156 | " Relative numbers | |
b4df7438 BB |
157 | autocmd FocusLost * :set norelativenumber |
158 | autocmd InsertEnter * :set norelativenumber | |
7da00f60 BB |
159 | autocmd InsertLeave * :set relativenumber |
160 | autocmd CursorMoved * :set relativenumber | |
161 | ||
162 | function! NumberToggle() | |
163 | if(&relativenumber == 1) | |
b4df7438 | 164 | set norelativenumber |
7da00f60 BB |
165 | else |
166 | set relativenumber | |
167 | endif | |
168 | endfunction | |
169 | ||
170 | nnoremap <C-n> :call NumberToggle()<cr> | |
35771083 | 171 | |
f9b5f766 BB |
172 | " Dank Mono Italics |
173 | highlight Keyword cterm=italic | |
c87eeb57 BB |
174 | |
175 | " FZF config | |
176 | set rtp+=/usr/local/opt/fzf | |
177 | ||
178 | " Inserts the path of the currently edited file into a command | |
179 | noremap <C-P> :FZF <CR> | |
180 | ||
181 | " Map colors to vim colors | |
182 | let g:fzf_colors = | |
183 | \ { 'fg': ['fg', 'Normal'], | |
184 | \ 'bg': ['bg', 'Normal'], | |
185 | \ 'hl': ['fg', 'Comment'], | |
186 | \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], | |
187 | \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], | |
188 | \ 'hl+': ['fg', 'Statement'], | |
189 | \ 'info': ['fg', 'PreProc'], | |
190 | \ 'border': ['fg', 'Ignore'], | |
191 | \ 'prompt': ['fg', 'Conditional'], | |
192 | \ 'pointer': ['fg', 'Exception'], | |
193 | \ 'marker': ['fg', 'Keyword'], | |
194 | \ 'spinner': ['fg', 'Label'], | |
195 | \ 'header': ['fg', 'Comment'] } | |
d2114c7b BB |
196 | |
197 | " ALE config | |
198 | let g:ale_linters = {'javascript': ['eslint']} | |
138316b6 BB |
199 | |
200 | " Move things up and down using Ctrl + Shift | |
201 | nnoremap <C-S-j> :m .+1<CR>== | |
202 | nnoremap <C-S-k> :m .-2<CR>== | |
203 | inoremap <C-S-j> <Esc>:m .+1<CR>==gi | |
204 | inoremap <C-S-k> <Esc>:m .-2<CR>==gi | |
205 | vnoremap <C-S-j> :m '>+1<CR>gv=gv | |
206 | vnoremap <C-S-k> :m '<-2<CR>gv=gv | |
3293278c BB |
207 | |
208 | " Plug configuration | |
209 | call plug#begin('~/.vim/plugged') | |
210 | ||
211 | " | |
212 | " Plugin List | |
213 | " | |
214 | ||
215 | " Syntaxes | |
216 | Plug 'rbdr/api-notation.vim' | |
217 | Plug 'elzr/vim-json' | |
218 | Plug 'mustache/vim-mode' | |
219 | Plug 'othree/yajs.vim' | |
220 | Plug 'ARM9/snes-syntax-vim' | |
221 | Plug 'posva/vim-vue' | |
222 | Plug 'leafOfTree/vim-svelte-plugin' | |
223 | Plug 'bumaociyuan/vim-swift' | |
224 | Plug 'udalov/kotlin-vim' | |
225 | ||
226 | " Editing | |
227 | Plug 'jiangmiao/auto-pairs' | |
228 | " Plug 'tpope/vim-endwise.git' | |
229 | Plug 'michaeljsmith/vim-indent-object' | |
230 | ||
231 | " Tools | |
232 | Plug 'editorconfig/editorconfig-vim' | |
233 | Plug 'w0rp/ale' | |
234 | Plug 'vim-scripts/LargeFile' | |
235 | Plug 'tpope/vim-fugitive' | |
236 | Plug 'milkypostman/vim-togglelist' | |
237 | Plug 'jremmen/vim-ripgrep' | |
238 | Plug 'lifepillar/vim-mucomplete' | |
239 | ||
240 | " List ends here. Plugins become visible to Vim after this call. | |
241 | call plug#end() |