]> git.r.bdr.sh - rbdr/dotfiles/blame - vimrc
Fix some skhdrc configs
[rbdr/dotfiles] / vimrc
CommitLineData
b100af91
BB
1set nocompatible
2
0e40ccc4
BB
3"
4" Basics
5"
6
b100af91
BB
7set number
8set ruler
9syntax on
10
11" Set encoding
12set encoding=utf-8
13
14" Whitespace stuff
15set nowrap
16set tabstop=2
17set shiftwidth=2
18set softtabstop=2
19set expandtab
20set list listchars=tab:\ \ ,trail:ยท
21
22" Searching
23set hlsearch
24set incsearch
25set ignorecase
26set smartcase
27
28" Tab completion
29set wildmode=list:longest,list:full
30set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*
31
32" Status bar
33set laststatus=2
34
0e40ccc4
BB
35" allow backspacing over everything in insert mode
36set backspace=indent,eol,start
b100af91 37
0e40ccc4
BB
38" Show (partial) command in the status line
39set showcmd
b100af91
BB
40
41" Remember last location in file
42if has("autocmd")
43 au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
44 \| exe "normal g'\"" | endif
45endif
46
0e40ccc4
BB
47"
48" File Type Config
49"
b100af91
BB
50
51" make uses real tabs
52au FileType make set noexpandtab
53
54" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
55au 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/ )
58au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
59
6e876679
BB
60" snes syntax highlighting
61au BufNewFile,BufRead *.asm,*.s set filetype=snes"
62
b100af91
BB
63" load the plugin and indent settings for the detected filetype
64filetype plugin indent on
32081fee 65filetype plugin on
b100af91 66
0e40ccc4
BB
67" Directories for swp files
68set backupdir=~/.vim/.backup
69set directory=~/.vim/.backup
70
71" Include local vimrc
72if filereadable(expand("~/.vimrc.local"))
73 source ~/.vimrc.local
74endif
75
76"
77" Tool Configs
78"
79
80" CTags
81map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
82map <C-\> :tnext<CR>
83
b100af91
BB
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
0e40ccc4
BB
92" % to bounce from do to end etc.
93runtime! macros/matchit.vim
b100af91 94
0e40ccc4
BB
95" Dank Mono Italics
96highlight Keyword cterm=italic
b100af91 97
0e40ccc4 98" FZF config
c01804a4 99set rtp+=$FZF_VIM_PATH
b100af91 100
0e40ccc4
BB
101" Inserts the path of the currently edited file into a command
102noremap <C-P> :FZF <CR>
b100af91 103
e2ed7665
RBR
104let g:fzf_layout = { 'down': '40%' }
105
106" Auto Pairs
107let g:AutoPairsMultilineClose = 0
108
0e40ccc4 109" ALE config
d2cf7ebb
BB
110let g:ale_linter_aliases = {'svelte': ['css', 'javascript']}
111let g:ale_linters = {
112 \'javascript': ['eslint'],
113 \'svelte': ['stylelint', 'eslint']
114 \}
115let g:ale_fixers = {
116 \'javascript': ['eslint'],
117 \'svelte': ['eslint']
118 \}
119let g:ale_fix_on_save = 1
b100af91 120
7160dbcf
RBR
121" Svelte Config
122let g:vim_svelte_plugin_use_typescript = 1
123
e2ed7665
RBR
124" Deoplete config
125let g:deoplete#enable_at_startup = 1
126inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
127inoremap <expr><S-tab> pumvisible() ? "\<c-p>" : "\<tab>"
128
0e40ccc4
BB
129"
130" A E S T H E T I C S
131"
b100af91 132
0e40ccc4
BB
133" Color Column
134let &colorcolumn="80,150"
b100af91 135
0e40ccc4
BB
136" Default color scheme
137set termguicolors
138color rbdr
b100af91 139
0e40ccc4
BB
140" Map colors to vim colors
141let g:fzf_colors =
142\ { 'fg': ['fg', 'Normal'],
143 \ 'bg': ['bg', 'Normal'],
144 \ 'hl': ['fg', 'Comment'],
145 \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
146 \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
147 \ 'hl+': ['fg', 'Statement'],
148 \ 'info': ['fg', 'PreProc'],
149 \ 'border': ['fg', 'Ignore'],
150 \ 'prompt': ['fg', 'Conditional'],
151 \ 'pointer': ['fg', 'Exception'],
152 \ 'marker': ['fg', 'Keyword'],
153 \ 'spinner': ['fg', 'Label'],
154 \ 'header': ['fg', 'Comment'] }
b100af91 155
0e40ccc4
BB
156"
157" Editing Shortcuts
158"
b100af91 159
b100af91
BB
160" Folding Settings
161set foldmethod=syntax
162set foldnestmax=10
163set nofoldenable
164set foldlevel=1
321ecaca 165
7da00f60 166" Relative numbers
b4df7438
BB
167autocmd FocusLost * :set norelativenumber
168autocmd InsertEnter * :set norelativenumber
7da00f60
BB
169autocmd InsertLeave * :set relativenumber
170autocmd CursorMoved * :set relativenumber
171
172function! NumberToggle()
173 if(&relativenumber == 1)
b4df7438 174 set norelativenumber
7da00f60
BB
175 else
176 set relativenumber
177 endif
178endfunction
179
180nnoremap <C-n> :call NumberToggle()<cr>
35771083 181
138316b6
BB
182
183" Move things up and down using Ctrl + Shift
184nnoremap <C-S-j> :m .+1<CR>==
185nnoremap <C-S-k> :m .-2<CR>==
186inoremap <C-S-j> <Esc>:m .+1<CR>==gi
187inoremap <C-S-k> <Esc>:m .-2<CR>==gi
188vnoremap <C-S-j> :m '>+1<CR>gv=gv
189vnoremap <C-S-k> :m '<-2<CR>gv=gv
3293278c 190
0d9acf5f
RBR
191" Limelight / Goyo config
192
193autocmd! User GoyoEnter Limelight
194autocmd! User GoyoLeave Limelight!
195nnoremap <C-S-l> :Limelight!!<CR>==
196inoremap <C-S-l> <Esc>:Limelight!!<CR>==gi
197vnoremap <C-S-l> :<C-u>Limelight!!<CR>gv=gv
198nnoremap <C-S-g> :Goyo<CR>==
199inoremap <C-S-g> <Esc>:Goyo<CR>==gi
200vnoremap <C-S-g> :<C-u>Goyo<CR>gv=gv
201
3293278c 202"
0e40ccc4 203" Plug Config
3293278c
BB
204"
205
0e40ccc4
BB
206call plug#begin('~/.vim/plugged')
207
3293278c 208" Syntaxes
e2ed7665 209Plug 'https://gitlab.com/rbdr/api-notation.vim.git'
3293278c
BB
210Plug 'elzr/vim-json'
211Plug 'mustache/vim-mode'
212Plug 'othree/yajs.vim'
213Plug 'ARM9/snes-syntax-vim'
214Plug 'posva/vim-vue'
7160dbcf 215Plug 'leafgarland/typescript-vim'
3293278c
BB
216Plug 'leafOfTree/vim-svelte-plugin'
217Plug 'bumaociyuan/vim-swift'
218Plug 'udalov/kotlin-vim'
df16e19b 219Plug 'tikhomirov/vim-glsl'
40cd14f7 220Plug 'jparise/vim-graphql'
f645a26f 221Plug 'digitaltoad/vim-pug'
7160dbcf 222Plug 'https://git.sr.ht/~torresjrjr/gemini.vim'
382841ad 223Plug 'rust-lang/rust.vim'
8112cdd2 224Plug 'dart-lang/dart-vim-plugin'
3293278c
BB
225
226" Editing
0e40ccc4 227Plug 'tpope/vim-endwise'
4a9e14b0 228Plug 'rstacruz/vim-closer'
3293278c 229Plug 'michaeljsmith/vim-indent-object'
fde341f8 230Plug 'editorconfig/editorconfig-vim'
3293278c 231
0d9acf5f
RBR
232" Distraction free editing
233Plug 'junegunn/goyo.vim'
234Plug 'junegunn/limelight.vim'
235
3293278c
BB
236" Tools
237Plug 'editorconfig/editorconfig-vim'
0e40ccc4 238Plug 'dense-analysis/ale'
f645a26f 239Plug 'neoclide/coc.nvim', {'branch': 'release'}
3293278c
BB
240Plug 'vim-scripts/LargeFile'
241Plug 'tpope/vim-fugitive'
242Plug 'milkypostman/vim-togglelist'
243Plug 'jremmen/vim-ripgrep'
3293278c
BB
244
245" List ends here. Plugins become visible to Vim after this call.
246call plug#end()
19afe8a8
RBR
247
248if filereadable(expand('~/.vimrc.local'))
249 exe 'source' '~/.vimrc.local'
250endif