]> git.r.bdr.sh - rbdr/dotfiles/blob - vimrc
Remove prezto
[rbdr/dotfiles] / vimrc
1 set nocompatible
2
3 "
4 " Basics
5 "
6
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
35 " allow backspacing over everything in insert mode
36 set backspace=indent,eol,start
37
38 " Show (partial) command in the status line
39 set showcmd
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
47 "
48 " File Type Config
49 "
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
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
60 " snes syntax highlighting
61 au BufNewFile,BufRead *.asm,*.s set filetype=snes"
62
63 " load the plugin and indent settings for the detected filetype
64 filetype plugin indent on
65 filetype plugin on
66 set omnifunc=syntaxcomplete#Complete
67
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
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
93 " % to bounce from do to end etc.
94 runtime! macros/matchit.vim
95
96 " Dank Mono Italics
97 highlight Keyword cterm=italic
98
99 " FZF config
100 set rtp+=/usr/local/opt/fzf
101
102 " Inserts the path of the currently edited file into a command
103 noremap <C-P> :FZF <CR>
104
105 " ALE config
106 let g:ale_linters = {'javascript': ['eslint']}
107
108 "
109 " A E S T H E T I C S
110 "
111
112 " Color Column
113 let &colorcolumn="80,150"
114
115 " Default color scheme
116 set termguicolors
117 color rbdr
118
119 " Map colors to vim colors
120 let g:fzf_colors =
121 \ { 'fg': ['fg', 'Normal'],
122 \ 'bg': ['bg', 'Normal'],
123 \ 'hl': ['fg', 'Comment'],
124 \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
125 \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
126 \ 'hl+': ['fg', 'Statement'],
127 \ 'info': ['fg', 'PreProc'],
128 \ 'border': ['fg', 'Ignore'],
129 \ 'prompt': ['fg', 'Conditional'],
130 \ 'pointer': ['fg', 'Exception'],
131 \ 'marker': ['fg', 'Keyword'],
132 \ 'spinner': ['fg', 'Label'],
133 \ 'header': ['fg', 'Comment'] }
134
135 "
136 " Editing Shortcuts
137 "
138
139 " Folding Settings
140 set foldmethod=syntax
141 set foldnestmax=10
142 set nofoldenable
143 set foldlevel=1
144
145 " Relative numbers
146 autocmd FocusLost * :set norelativenumber
147 autocmd InsertEnter * :set norelativenumber
148 autocmd InsertLeave * :set relativenumber
149 autocmd CursorMoved * :set relativenumber
150
151 function! NumberToggle()
152 if(&relativenumber == 1)
153 set norelativenumber
154 else
155 set relativenumber
156 endif
157 endfunction
158
159 nnoremap <C-n> :call NumberToggle()<cr>
160
161
162 " Move things up and down using Ctrl + Shift
163 nnoremap <C-S-j> :m .+1<CR>==
164 nnoremap <C-S-k> :m .-2<CR>==
165 inoremap <C-S-j> <Esc>:m .+1<CR>==gi
166 inoremap <C-S-k> <Esc>:m .-2<CR>==gi
167 vnoremap <C-S-j> :m '>+1<CR>gv=gv
168 vnoremap <C-S-k> :m '<-2<CR>gv=gv
169
170 "
171 " Plug Config
172 "
173
174 call plug#begin('~/.vim/plugged')
175
176 " Syntaxes
177 Plug 'rbdr/api-notation.vim'
178 Plug 'elzr/vim-json'
179 Plug 'mustache/vim-mode'
180 Plug 'othree/yajs.vim'
181 Plug 'ARM9/snes-syntax-vim'
182 Plug 'posva/vim-vue'
183 Plug 'leafOfTree/vim-svelte-plugin'
184 Plug 'bumaociyuan/vim-swift'
185 Plug 'udalov/kotlin-vim'
186
187 " Editing
188 Plug 'jiangmiao/auto-pairs'
189 Plug 'tpope/vim-endwise'
190 Plug 'michaeljsmith/vim-indent-object'
191
192 " Tools
193 Plug 'editorconfig/editorconfig-vim'
194 Plug 'dense-analysis/ale'
195 Plug 'vim-scripts/LargeFile'
196 Plug 'tpope/vim-fugitive'
197 Plug 'milkypostman/vim-togglelist'
198 Plug 'jremmen/vim-ripgrep'
199 Plug 'lifepillar/vim-mucomplete'
200
201 " List ends here. Plugins become visible to Vim after this call.
202 call plug#end()