From 686585441863e344d10390ee83dc1c15f1f28b90 Mon Sep 17 00:00:00 2001 From: voidarc Date: Fri, 13 Nov 2026 09:22:37 +0000 Subject: [PATCH] semi working asyncomplete --- modules/features/vim/default.nix | 15 ++++--- modules/features/vim/vimrc | 72 +++++++++++++++++--------------- 2 files changed, 49 insertions(+), 38 deletions(-) diff --git a/modules/features/vim/default.nix b/modules/features/vim/default.nix index a1d89b0..e226c30 100644 --- a/modules/features/vim/default.nix +++ b/modules/features/vim/default.nix @@ -9,12 +9,17 @@ perSystem = {pkgs, ...}: { packages.vim = inputs.wrappers.wrappers.vim.wrap { inherit pkgs; + runtimePkgs = with pkgs; [ + nixd + lua-language-server + ]; plugins = with pkgs.vimPlugins; [ - # vim-lsp - # vim-lsp-settings - # asyncomplete-vim - # asyncomplete-lsp-vim - ale + vim-lsp + asyncomplete-vim + asyncomplete-lsp-vim + asyncomplete-file-vim + vim-vsnip + vim-vsnip-integ ]; vimrc = builtins.readFile ./vimrc; }; diff --git a/modules/features/vim/vimrc b/modules/features/vim/vimrc index 4deef7b..c640cd6 100644 --- a/modules/features/vim/vimrc +++ b/modules/features/vim/vimrc @@ -13,50 +13,56 @@ set softtabstop=2 set number set relativenumber set cursorline - " Make cursorlinenum a different color + +" Make cursorlinenum a different color augroup colorAutoCmds - autocmd! - autocmd ColorScheme * highlight CursorLineNr cterm=bold guifg=#cba6f7 + autocmd! + autocmd ColorScheme * highlight CursorLineNr cterm=bold guifg=#cba6f7 augroup END +" Searching stuff set ignorecase set smartcase set hlsearch set incsearch +" asyncomplete navigation +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" + +let g:vsnip_integ_debug = 1 + +let g:asyncomplete_auto_popup = 1 + +" Snippet expansion +imap vsnip#expandable() ? '(vsnip-expand)' : '' +smap vsnip#expandable() ? '(vsnip-expand)' : '' + +" Snippet placeholder navigation +imap vsnip#available(1) ? '(vsnip-expand-or-jump)' : '' +smap vsnip#available(1) ? '(vsnip-expand-or-jump)' : '' + " Set different cursor shapes depending on mode let &t_SI = "\e[6 q" let &t_EI = "\e[2 q" augroup cursorCmds -au! -autocmd VimEnter * silent !echo -ne "\e[2 q" + au! + autocmd VimEnter * silent !echo -ne "\e[2 q" augroup END -" Completion menu -"inoremap pumvisible() ? "\" : "\" -"inoremap pumvisible() ? "\" : "\" -"inoremap pumvisible() ? asyncomplete#close_popup() : "\" - -set omnifunc=ale#completion#OmniFunc -nnoremap K ALEHover -nnoremap gd ALEGoToDefinition -nnoremap gr ALEFindReferences -nnoremap ca ALECodeAc -let g:ale_completion_enabled = 1 - -autocmd User lsp_setup call lsp#register_server({ - \ 'name': 'nixd', - \ 'cmd': ['nixd'], - \ 'allowlist': ['nix'], - \ }) - -let g:ale_linters = { -\ 'nix': ['nixd'], -\} - -let g:ale_fixers = { -\ 'nix': ['alejandra'], -\} - -let g:ale_fix_on_save = 1 - +set omnifunc=lsp#complete +if executable("nixd") + autocmd User lsp_setup call lsp#register_server({ + \ 'name': 'nixd', + \ 'cmd': ['nixd'], + \ 'allowlist': ['nix'], + \ }) +endif +if executable("lua-language-server") + autocmd User lsp_setup call lsp#register_server({ + \ 'name': 'lua_ls', + \ 'cmd': ['lua-language-server'], + \ 'allowlist': ['lua'], + \ }) +endif