]>
Commit | Line | Data |
---|---|---|
b100af91 BB |
1 | set nocompatible |
2 | ||
0e40ccc4 BB |
3 | " |
4 | " Basics | |
5 | " | |
6 | ||
b100af91 BB |
7 | set number |
8 | set ruler | |
9 | syntax on | |
10 | ||
11 | " Set encoding | |
12 | set encoding=utf-8 | |
13 | ||
14 | " Whitespace stuff | |
15 | set nowrap | |
16 | set tabstop=2 | |
17 | set shiftwidth=2 | |
18 | set softtabstop=2 | |
19 | set expandtab | |
20 | set list listchars=tab:\ \ ,trail:ยท | |
21 | ||
22 | " Searching | |
23 | set hlsearch | |
24 | set incsearch | |
25 | set ignorecase | |
26 | set smartcase | |
27 | ||
28 | " Tab completion | |
29 | set wildmode=list:longest,list:full | |
30 | set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/* | |
31 | ||
32 | " Status bar | |
33 | set laststatus=2 | |
34 | ||
0e40ccc4 BB |
35 | " allow backspacing over everything in insert mode |
36 | set backspace=indent,eol,start | |
b100af91 | 37 | |
0e40ccc4 BB |
38 | " Show (partial) command in the status line |
39 | set showcmd | |
b100af91 BB |
40 | |
41 | " Remember last location in file | |
42 | if has("autocmd") | |
43 | au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | |
44 | \| exe "normal g'\"" | endif | |
45 | endif | |
46 | ||
0e40ccc4 BB |
47 | " |
48 | " File Type Config | |
49 | " | |
b100af91 BB |
50 | |
51 | " make uses real tabs | |
52 | au FileType make set noexpandtab | |
53 | ||
54 | " Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby | |
55 | au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby | |
56 | ||
b100af91 BB |
57 | " make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ ) |
58 | au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79 | |
59 | ||
6e876679 BB |
60 | " snes syntax highlighting |
61 | au BufNewFile,BufRead *.asm,*.s set filetype=snes" | |
62 | ||
b100af91 BB |
63 | " load the plugin and indent settings for the detected filetype |
64 | filetype plugin indent on | |
32081fee | 65 | filetype plugin on |
d9b5e620 | 66 | set omnifunc=syntaxcomplete#Complete |
b100af91 | 67 | |
0e40ccc4 BB |
68 | " Directories for swp files |
69 | set backupdir=~/.vim/.backup | |
70 | set directory=~/.vim/.backup | |
71 | ||
72 | " Include local vimrc | |
73 | if filereadable(expand("~/.vimrc.local")) | |
74 | source ~/.vimrc.local | |
75 | endif | |
76 | ||
77 | " | |
78 | " Tool Configs | |
79 | " | |
80 | ||
81 | " CTags | |
82 | map <Leader>rt :!ctags --extra=+f -R *<CR><CR> | |
83 | map <C-\> :tnext<CR> | |
84 | ||
b100af91 BB |
85 | " Opens an edit command with the path of the currently edited file filled in |
86 | " Normal mode: <Leader>e | |
87 | map <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 | |
91 | map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR> | |
92 | ||
0e40ccc4 BB |
93 | " % to bounce from do to end etc. |
94 | runtime! macros/matchit.vim | |
b100af91 | 95 | |
0e40ccc4 BB |
96 | " Dank Mono Italics |
97 | highlight Keyword cterm=italic | |
b100af91 | 98 | |
0e40ccc4 BB |
99 | " FZF config |
100 | set rtp+=/usr/local/opt/fzf | |
b100af91 | 101 | |
0e40ccc4 BB |
102 | " Inserts the path of the currently edited file into a command |
103 | noremap <C-P> :FZF <CR> | |
b100af91 | 104 | |
0e40ccc4 | 105 | " ALE config |
d2cf7ebb BB |
106 | let g:ale_linter_aliases = {'svelte': ['css', 'javascript']} |
107 | let g:ale_linters = { | |
108 | \'javascript': ['eslint'], | |
109 | \'svelte': ['stylelint', 'eslint'] | |
110 | \} | |
111 | let g:ale_fixers = { | |
112 | \'javascript': ['eslint'], | |
113 | \'svelte': ['eslint'] | |
114 | \} | |
115 | let g:ale_fix_on_save = 1 | |
b100af91 | 116 | |
0e40ccc4 BB |
117 | " |
118 | " A E S T H E T I C S | |
119 | " | |
b100af91 | 120 | |
0e40ccc4 BB |
121 | " Color Column |
122 | let &colorcolumn="80,150" | |
b100af91 | 123 | |
0e40ccc4 BB |
124 | " Default color scheme |
125 | set termguicolors | |
126 | color rbdr | |
b100af91 | 127 | |
0e40ccc4 BB |
128 | " Map colors to vim colors |
129 | let g:fzf_colors = | |
130 | \ { 'fg': ['fg', 'Normal'], | |
131 | \ 'bg': ['bg', 'Normal'], | |
132 | \ 'hl': ['fg', 'Comment'], | |
133 | \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], | |
134 | \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], | |
135 | \ 'hl+': ['fg', 'Statement'], | |
136 | \ 'info': ['fg', 'PreProc'], | |
137 | \ 'border': ['fg', 'Ignore'], | |
138 | \ 'prompt': ['fg', 'Conditional'], | |
139 | \ 'pointer': ['fg', 'Exception'], | |
140 | \ 'marker': ['fg', 'Keyword'], | |
141 | \ 'spinner': ['fg', 'Label'], | |
142 | \ 'header': ['fg', 'Comment'] } | |
b100af91 | 143 | |
0e40ccc4 BB |
144 | " |
145 | " Editing Shortcuts | |
146 | " | |
b100af91 | 147 | |
b100af91 BB |
148 | " Folding Settings |
149 | set foldmethod=syntax | |
150 | set foldnestmax=10 | |
151 | set nofoldenable | |
152 | set foldlevel=1 | |
321ecaca | 153 | |
7da00f60 | 154 | " Relative numbers |
b4df7438 BB |
155 | autocmd FocusLost * :set norelativenumber |
156 | autocmd InsertEnter * :set norelativenumber | |
7da00f60 BB |
157 | autocmd InsertLeave * :set relativenumber |
158 | autocmd CursorMoved * :set relativenumber | |
159 | ||
160 | function! NumberToggle() | |
161 | if(&relativenumber == 1) | |
b4df7438 | 162 | set norelativenumber |
7da00f60 BB |
163 | else |
164 | set relativenumber | |
165 | endif | |
166 | endfunction | |
167 | ||
168 | nnoremap <C-n> :call NumberToggle()<cr> | |
35771083 | 169 | |
138316b6 BB |
170 | |
171 | " Move things up and down using Ctrl + Shift | |
172 | nnoremap <C-S-j> :m .+1<CR>== | |
173 | nnoremap <C-S-k> :m .-2<CR>== | |
174 | inoremap <C-S-j> <Esc>:m .+1<CR>==gi | |
175 | inoremap <C-S-k> <Esc>:m .-2<CR>==gi | |
176 | vnoremap <C-S-j> :m '>+1<CR>gv=gv | |
177 | vnoremap <C-S-k> :m '<-2<CR>gv=gv | |
3293278c | 178 | |
3293278c | 179 | " |
0e40ccc4 | 180 | " Plug Config |
3293278c BB |
181 | " |
182 | ||
0e40ccc4 BB |
183 | call plug#begin('~/.vim/plugged') |
184 | ||
3293278c BB |
185 | " Syntaxes |
186 | Plug 'rbdr/api-notation.vim' | |
187 | Plug 'elzr/vim-json' | |
188 | Plug 'mustache/vim-mode' | |
189 | Plug 'othree/yajs.vim' | |
190 | Plug 'ARM9/snes-syntax-vim' | |
191 | Plug 'posva/vim-vue' | |
192 | Plug 'leafOfTree/vim-svelte-plugin' | |
193 | Plug 'bumaociyuan/vim-swift' | |
194 | Plug 'udalov/kotlin-vim' | |
195 | ||
196 | " Editing | |
197 | Plug 'jiangmiao/auto-pairs' | |
0e40ccc4 | 198 | Plug 'tpope/vim-endwise' |
3293278c BB |
199 | Plug 'michaeljsmith/vim-indent-object' |
200 | ||
201 | " Tools | |
202 | Plug 'editorconfig/editorconfig-vim' | |
0e40ccc4 | 203 | Plug 'dense-analysis/ale' |
3293278c BB |
204 | Plug 'vim-scripts/LargeFile' |
205 | Plug 'tpope/vim-fugitive' | |
206 | Plug 'milkypostman/vim-togglelist' | |
207 | Plug 'jremmen/vim-ripgrep' | |
208 | Plug 'lifepillar/vim-mucomplete' | |
209 | ||
210 | " List ends here. Plugins become visible to Vim after this call. | |
211 | call plug#end() |