vim: Update config

This commit is contained in:
2024-02-23 21:44:56 +01:00
parent 53701526be
commit eaf1382493

View File

@@ -36,6 +36,10 @@ Plug 'reedes/vim-pencil', Cond(!exists('g:vscode'))
"" markdown
Plug 'suan/vim-instant-markdown', Cond(!exists('g:vscode'))
Plug 'dense-analysis/ale', Cond(!exists('g:vscode'))
Plug 'neoclide/coc.nvim', Cond(!exists('g:vscode'), {'branch': 'release'})
call plug#end()
filetype plugin indent on
@@ -98,7 +102,7 @@ set nowritebackup
" == swap ==
set swapfile
set updatecount=200
set updatetime=10000
set updatetime=300
" == undo ==
set undolevels=1000
@@ -144,6 +148,8 @@ set termguicolors
" === keybinds ===
set pastetoggle=<F11>
set signcolumn=yes
let maplocalleader = "ö"
let mapleader = "\<Space>"
" map <leader>w: w!<cr>
@@ -209,6 +215,10 @@ else
syntax enable
silent! colorscheme monokai
highlight Comment guifg=#64d86b
highlight SpecialComment guifg=#64d86b
highlight Todo guibg=#a9ebad
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
@@ -250,6 +260,8 @@ else
" == limelight ==
let g:limelight_default_coefficient = 0.5
let g:ale_linters = {'rust': ['rust-analyzer']}
" === functions ===
function! DeleteTrailingWS()
exe "normal mz"
@@ -269,6 +281,40 @@ else
let g:rustfmt_autosave = 1
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice.
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" https://stackoverflow.com/a/8585343
map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
endif