vim/config/vim/init.vim

110 lines
2.5 KiB
VimL
Raw Normal View History

vim9script
2016-10-17 05:46:09 -04:00
set encoding=utf-8
scriptencoding utf-8
def EnsureDir(dir: string): void
mkdir(dir, "p", 0700)
enddef
# These are really clever - minpac will actually be loaded on the fly only
# when you need to update or clean your packages, rather than all the time.
command! PackUpdate source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#update()
2023-10-14 04:49:26 -04:00
command! PackClean source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#clean()
command! PackStatus source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#status()
# If the pack directory doesn't exist, we haven't installed any packages yet,
# so let's call PackUpdate.
if !isdirectory($XDG_CACHE_HOME .. '/vim/pack')
2023-10-14 04:49:26 -04:00
PackUpdate
2016-10-22 06:10:08 -04:00
endif
if has('gui_running') || has('termguicolors')
2023-10-14 04:49:26 -04:00
if $COLORTERM == 'truecolor'
&t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
&t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
endif
set termguicolors
endif
2016-10-22 06:10:08 -04:00
set background=dark
g:gruvbox_transp_bg = 1
g:gruvbox_italicize_strings = 0
g:gruvbox_filetype_hi_groups = 1
g:gruvbox_plugin_hi_groups = 1
colorscheme gruvbox8
inoremap jj <Esc>
2016-10-22 06:10:08 -04:00
nnoremap <C-t> :Files<CR>
packadd! editorconfig
if exists('+belloff')
2023-10-14 04:49:26 -04:00
set belloff+=ctrlg
endif
set completeopt+=menuone
set linebreak showbreak=
set modelines=5
set showcmd
set wildmode=longest,full
if has('patch-8.2.4325')
2023-10-14 04:49:26 -04:00
set wildoptions+=pum
endif
2016-10-22 06:10:08 -04:00
set tabstop=2 shiftwidth=2
if exists('+breakindent')
2023-10-14 04:49:26 -04:00
set breakindent breakindentopt=sbr
2016-10-22 06:10:08 -04:00
endif
if exists('+relativenumber')
2023-10-14 04:49:26 -04:00
set relativenumber
else
2023-10-14 04:49:26 -04:00
set number
endif
2022-07-02 03:01:58 -04:00
for dir_name in ['backup', 'swap', 'undo']
2023-10-14 04:49:26 -04:00
EnsureDir($XDG_STATE_HOME .. '/vim/' .. dir_name)
endfor
set backupdir=.,$XDG_STATE_HOME/vim/backup
set directory=.,$XDG_STATE_HOME/vim/swap
if exists('+undofile')
2023-10-14 04:49:26 -04:00
set undofile
set undodir=$XDG_STATE_HOME/vim/undo
endif
g:csv_no_conceal = 1
g:vim_svelte_plugin_use_typescript = 1
g:LatexBox_Folding = 1
g:NERDTreeHijackNetrw = 1
g:ale_set_balloons = 1
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
g:mucomplete#can_complete = {
2023-10-14 04:49:26 -04:00
default: {
omni: (t) => strlen(&l:omnifunc) > 0 && t =~# '\m\k\%(\k\|\.\)$'
}
}
import "./statusline.vim"
statusline.Init()
import "./lsp.vim"
lsp.LazyConfigure()
2023-10-09 21:00:33 -04:00
set formatexpr=lsp#lsp#FormatExpr()
set keywordprg=:LspHover
2023-10-09 21:00:33 -04:00
nnoremap gD <Cmd>LspGotoDeclaration<CR>
nnoremap gd <Cmd>LspGotoDefinition<CR>
nnoremap gi <Cmd>LspGotoImpl<CR>
2023-10-09 21:00:33 -04:00
nnoremap <C-k> <Cmd>LspShowSignature<CR>
nnoremap gr <Cmd>LspShowReferences<CR>
xnoremap <silent> <Leader>e <Cmd>LspSelectionExpand<CR>
xnoremap <silent> <Leader>s <Cmd>LspSelectionShrink<CR>