this repo has no description
1" vi: foldmethod=marker
2scriptencoding utf-8
3
4" Plugins {{{
5" Unload unneeded plugins {{{
6let g:loaded_netrwPlugin = 1 "$VIMRUNTIME/plugin/netrwPlugin.vim
7let g:loaded_2html_plugin = 1 "$VIMRUNTIME/plugin/tohtml.vim
8" }}}
9command! -bar PackUpdate call plugins#reload() | call minpac#update()
10command! -bar PackClean call plugins#reload() | call minpac#clean()
11
12set rtp+=/usr/local/opt/fzf
13set packpath^=~/.local/share/nvim
14" }}}
15" Identation {{{
16set tabstop=4 shiftwidth=0 expandtab
17
18set textwidth=80
19set nowrap linebreak formatoptions+=l
20" }}}
21" User interface {{{
22" set lazyredraw
23
24" Ignore case. If your code uses different casing to differentiate files, then
25" you need mental help
26set wildignorecase fileignorecase
27" Colors {{{
28syntax sync minlines=256
29
30set termguicolors
31colorscheme blame
32" }}}
33" Ignore all automatic files and folders {{{
34set wildignore+=*.o,*~,*/.git,*/tmp,*/node_modules,*/_build,*/deps,*/target
35" }}}
36" Display tabs and trailing spaces visually {{{
37set fillchars=vert:┃,fold:·
38set list listchars=tab:→\ ,trail:·,nbsp:␣,extends:↦,precedes:↤
39set conceallevel=2
40" }}}
41" Do not show current mode down the bottom {{{
42set noshowmode
43" }}}
44" Autowrite files when possible {{{
45set nohidden autowriteall
46" }}}
47" Keep cursor in the middle {{{
48set scrolloff=9999
49" }}}
50" Enable mouse suport {{{
51set mouse=a
52" }}}
53" Hypen is part of the keyword, if you want to substract then add spaces {{{
54set iskeyword+=-
55" }}}
56" Show 80 column {{{
57set colorcolumn=+1
58" }}}
59" Split in CORRECT places {{{
60set splitright splitbelow
61" }}}
62" Statusline {{{
63let &statusline = ''
64let &statusline .= ' '
65let &statusline .= '» %f%{statusline#modified()} «%<'
66let &statusline .= '%='
67let &statusline .= '%{statusline#quickfix()} %4c:%l'
68let &statusline .= ' '
69" }}}
70" }}}
71" Search {{{
72" Smart case searches
73set ignorecase smartcase inccommand=nosplit
74" }}}
75" Permanent undo {{{
76set undofile
77" }}}
78" Custom configurations {{{
79" Fuzzy file search {{{
80nnoremap <Space><Space> :<C-u>FZF<CR>
81" }}}
82" Git shortcuts {{{
83nnoremap U <nop>
84nnoremap Up :<C-u>Gina push<CR>
85nnoremap Us :<C-u>Gina status -s<CR>
86nnoremap Ud :<C-u>Gina diff<CR>
87nnoremap Ub :<C-u>Gina branch<CR>
88nnoremap UB :<C-u>Gina blame<CR>
89nnoremap Uc :<C-u>Gina commit<CR>
90nnoremap Uu :<C-u>Gina pull<CR>
91nnoremap Ug :<C-u>Gina log --graph<CR>
92nmap UU Uu
93
94cabbrev G Gina
95cabbrev G! Gina!
96" }}}
97" Asynchronous commands {{{
98command! -bang -nargs=* Make call asyncdo#run(<bang>0, &makeprg, <f-args>)
99command! -bang -nargs=* Grep call asyncdo#run(<bang>0, &grepprg, <f-args>)
100command! -bang -nargs=* LMake call asyncdo#lrun(<bang>0, &makeprg, <f-args>)
101command! -bang -nargs=* LGrep call asyncdo#lrun(<bang>0, &grepprg, <f-args>)
102" }}}
103" Expand abbreviations on enter {{{
104inoremap <CR> <C-]><CR>
105" }}}
106" Smart `0` {{{
107" `0` goes to the beginning of the text on first press and to the beginning
108" of the line on second press. It alternates afterwards.
109nnoremap <expr> 0 virtcol('.') - 1 <= indent('.') && col('.') > 1 ? '0' : '_'
110" }}}
111" File closing {{{
112nnoremap ZS :wa<CR>
113nnoremap ZA :qa<CR>
114nnoremap ZX :cq<CR>
115" }}}
116" Simplify switching to Command mode {{{
117nnoremap ; :
118vnoremap ; :
119nnoremap : ;
120vnoremap : ;
121nnoremap q; q:
122" }}}
123" Fix idiotic vim defaults {{{
124nnoremap Y y$
125" }}}
126" Folding {{{
127nnoremap <expr> <CR> foldlevel('.') ? 'za' : "\<CR>"
128" }}}
129" Scratchpad {{{
130command! Scratchify setlocal nobuflisted buftype=nofile bufhidden=delete
131command! Scratch enew | Scratchify
132command! SScratch new | Scratchify
133command! VScratch vnew | Scratchify
134command! TScratch tabnew | Scratchify
135" }}}
136" Format {{{
137nnoremap g= gg=Gg``
138noremap Q gq
139nnoremap gQ gggqG``
140
141command! Clean let _s = @/ | %s/\s\+$//e | let @/ = _s | set nohlsearch
142" }}}
143" Search {{{
144if executable('rg')
145 set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case
146 set grepformat=%f:%l:%c:%m,%f:%l%m,%f\ \ %l%m
147elseif executable('ag')
148 set grepprg=ag\ --nogroup\ --nocolor\ --vimgrep
149 set grepformat^=%f:%l:%c:%m
150endif
151
152" Quickly disable highligh
153nnoremap <Space>, :nohlsearch<CR>
154" }}}
155" Tabs {{{
156nnoremap ]w gt
157nnoremap [w gT
158" }}}
159" Terminal {{{
160nmap <C-q> <Esc>
161nnoremap <C-q>c :<C-u>term<CR>
162nnoremap <C-q>s :<C-u>split +term<CR>
163nnoremap <C-q>v :<C-u>vsplit +term<CR>
164nnoremap <C-q>t :<C-u>tabnew +term<CR>
165
166tnoremap <C-q> <C-\><C-n>
167
168if executable('nvr')
169 let $EDITOR = 'nvr -cc split -c "set bufhidden=delete" --remote-wait'
170endif
171" }}}
172" Split management {{{
173augroup align_windows
174 au!
175 au VimResized * wincmd =
176augroup END
177
178nmap <C-w>q <plug>(choosewin)
179nmap <C-_> <plug>(choosewin)
180" }}}
181" Startify {{{
182let g:startify_list_order = ['sessions', 'dir']
183let g:startify_session_dir = '~/.local/share/nvim/sessions/'
184let g:startify_session_autoload = 1
185let g:startify_session_persistence = 1
186
187let g:startify_change_to_dir = 0
188let g:startify_change_to_vcs_root = 1
189" }}}
190" Match up {{{
191let g:matchup_matchparen_status_offscreen = 0
192" }}}
193" HighlihtedYank {{{
194let g:highlightedyank_highlight_duration = 200
195" }}}
196" Snipe f/F/t/T {{{
197" let g:snipe_jump_tokens = 'asdfghklqwertyuiopzxcvbnm'
198let g:snipe_jump_tokens = 'fhghdjskal'
199
200nmap F <Plug>(snipe-F)
201nmap f <Plug>(snipe-f)
202nmap T <Plug>(snipe-T)
203nmap t <Plug>(snipe-t)
204" }}}
205" }}}
206" Completions {{{
207set complete=.,w,b,t,u
208set completeopt=menu,longest,noselect
209let g:echodoc_enable_at_startup = 1
210let g:cpty_awk_cmd = 'mawk -f'
211
212let g:lsp_servers = [
213 \ {
214 \ 'name': 'elixir-ls',
215 \ 'cmd': {server_info->[&shell, &shellcmdflag, 'env ERL_LIBS=/Users/hauleth/Workspace/JakeBecker/elixir-ls/lsp mix elixir_ls.language_server']},
216 \ 'whitelist': ['elixir'],
217 \ },
218 \ {
219 \ 'name': 'rls',
220 \ 'cmd': {server_info->['rustup', 'run', 'nightly', 'rls']},
221 \ 'whitelist': ['rust'],
222 \ },
223 \ {
224 \ 'name': 'vue-language-server',
225 \ 'cmd': {server_info->['vls']},
226 \ 'whitelist': ['vue'],
227 \ }
228 \ ]
229
230augroup lsp_servers
231 au!
232 au User lsp_setup call completion#lsp()
233augroup END
234" }}}
235
236nnoremap zS :echo 'hi<' . synIDattr(synID(line('.'),col('.'),1),'name') . '> trans<'
237 \ . synIDattr(synID(line('.'),col('.'),0),'name') . '> lo<'
238 \ . synIDattr(synIDtrans(synID(line('.'),col('.'),1)),'name') . '>'<CR>