Migrate init.vim to Vim9 script as well
This commit is contained in:
parent
fc59f3cf4c
commit
a17be94d77
1 changed files with 34 additions and 37 deletions
|
@ -1,43 +1,39 @@
|
||||||
|
vim9script
|
||||||
set encoding=utf-8
|
set encoding=utf-8
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
|
|
||||||
function! s:ensure_dir(dir)
|
def EnsureDir(dir: string): void
|
||||||
if filewritable(a:dir) != 2
|
if filewritable(dir) != 2
|
||||||
call mkdir(a:dir, "p", 0700)
|
mkdir(dir, "p", 0700)
|
||||||
endif
|
endif
|
||||||
endfunction
|
enddef
|
||||||
|
|
||||||
if exists('+packpath')
|
# These are really clever - minpac will actually be loaded on the fly only
|
||||||
" 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.
|
||||||
" 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()
|
||||||
command! PackUpdate source $XDG_CONFIG_HOME/vim/plugins.vim | call minpac#update()
|
command! PackClean source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#clean()
|
||||||
command! PackClean source $XDG_CONFIG_HOME/vim/plugins.vim | call minpac#clean()
|
command! PackStatus source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#status()
|
||||||
command! PackStatus source $XDG_CONFIG_HOME/vim/plugins.vim | call minpac#status()
|
|
||||||
|
|
||||||
" If the pack directory doesn't exist, we haven't installed any packages yet,
|
# If the pack directory doesn't exist, we haven't installed any packages yet,
|
||||||
" so let's call PackUpdate.
|
# so let's call PackUpdate.
|
||||||
if !isdirectory($XDG_CACHE_HOME . '/vim/pack')
|
if !isdirectory($XDG_CACHE_HOME .. '/vim/pack')
|
||||||
PackUpdate
|
PackUpdate
|
||||||
endif
|
|
||||||
else
|
|
||||||
" If we're on a version of Vim that doesn't have packages, we have to load a
|
|
||||||
" plugin manager (vim-plug) on every boot.
|
|
||||||
source $XDG_CONFIG_HOME/vim/plugins.vim
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
augroup transparent_term
|
augroup transparent_term
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE
|
autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
set background=dark
|
set background=dark
|
||||||
let g:gruvbox_italic=1
|
g:gruvbox_italic = 1
|
||||||
let g:gruvbox_improved_strings=1
|
g:gruvbox_improved_strings = 1
|
||||||
let g:gruvbox_improved_warnings=1
|
g:gruvbox_improved_warnings = 1
|
||||||
|
|
||||||
if has('gui_running') || has('termguicolors')
|
if has('gui_running') || has('termguicolors')
|
||||||
set termguicolors
|
set termguicolors
|
||||||
silent! packadd gruvbox
|
silent! packadd gruvbox
|
||||||
let g:airline_theme = 'gruvbox'
|
g:airline_theme = 'gruvbox'
|
||||||
colorscheme gruvbox
|
colorscheme gruvbox
|
||||||
else
|
else
|
||||||
colorscheme inkpot
|
colorscheme inkpot
|
||||||
|
@ -57,6 +53,7 @@ set linebreak showbreak=↩
|
||||||
set modelines=5
|
set modelines=5
|
||||||
set showcmd
|
set showcmd
|
||||||
set wildmode=longest,full
|
set wildmode=longest,full
|
||||||
|
silent! set wildoptions+=pum
|
||||||
|
|
||||||
set tabstop=2 shiftwidth=2
|
set tabstop=2 shiftwidth=2
|
||||||
|
|
||||||
|
@ -70,8 +67,8 @@ else
|
||||||
set number
|
set number
|
||||||
endif
|
endif
|
||||||
|
|
||||||
for s:dir in ['backup', 'swap', 'undo']
|
for dir in ['backup', 'swap', 'undo']
|
||||||
call s:ensure_dir($XDG_STATE_HOME . '/vim/' . s:dir)
|
EnsureDir($XDG_STATE_HOME .. '/vim/' .. dir)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
set backupdir=.,$XDG_STATE_HOME/vim/backup
|
set backupdir=.,$XDG_STATE_HOME/vim/backup
|
||||||
|
@ -81,22 +78,22 @@ if exists('+undofile')
|
||||||
set undodir=$XDG_STATE_HOME/vim/undo
|
set undodir=$XDG_STATE_HOME/vim/undo
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:airline_powerline_fonts = 1
|
g:airline_powerline_fonts = 1
|
||||||
let g:airline#extensions#battery#enabled = 1
|
g:airline#extensions#battery#enabled = 1
|
||||||
|
|
||||||
let g:csv_no_conceal = 1
|
g:csv_no_conceal = 1
|
||||||
|
|
||||||
let vim_svelte_plugin_use_typescript = 1
|
g:vim_svelte_plugin_use_typescript = 1
|
||||||
|
|
||||||
let g:LatexBox_Folding = 1
|
g:LatexBox_Folding = 1
|
||||||
let g:NERDTreeHijackNetrw = 1
|
g:NERDTreeHijackNetrw = 1
|
||||||
|
|
||||||
let g:ale_set_balloons = 1
|
g:ale_set_balloons = 1
|
||||||
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
|
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
|
||||||
nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
||||||
|
|
||||||
let g:mucomplete#can_complete = {
|
g:mucomplete#can_complete = {
|
||||||
\'default': {
|
default: {
|
||||||
\'omni': {t -> strlen(&l:omnifunc) > 0 && t =~# '\m\k\%(\k\|\.\)$'}
|
omni: (t) => strlen(&l:omnifunc) > 0 && t =~# '\m\k\%(\k\|\.\)$'
|
||||||
\}
|
}
|
||||||
\}
|
}
|
||||||
|
|
Loading…
Reference in a new issue