Update COC settings
- Retheme
- Update language servers
- Improve keybinds
diff --git a/modules/neovim/coc/default.nix b/modules/neovim/coc/default.nix
index 44795b8..e174559 100644
--- a/modules/neovim/coc/default.nix
+++ b/modules/neovim/coc/default.nix
@@ -5,12 +5,17 @@
nixpkgs-minion,
home,
utils,
+ omnisharp-language-server,
...
}: {
programs.neovim = {
coc = {
enable = true;
settings = {
+ suggest.floatConfig = {
+ border = true;
+ rounded = true;
+ };
"suggest.noselect" = false;
"cSpell.checkOnlyEnabledfileTypes" = false;
"cSpell.dictionaryDefinitions" = [
@@ -21,17 +26,19 @@
];
"cSpell.dictionaries" = ["imperative"];
"git.enableGutters" = false; # We're using another plugin to do this
- "rust-analyzer.serverPath" = "${pkgs.rust-analyzer}/bin/rust-analyzer";
+ "rust-analyzer.server.path" = "${pkgs.rust-analyzer}/bin/rust-analyzer";
+ "omnisharp.path" = "${pkgs.omnisharp-roslyn}/bin/OmniSharp";
+ "markdownlint.config" = {
+ line-length = {
+ code_blocks = false;
+ tables = false;
+ };
+ };
languageserver = {
nix = {
command = "${pkgs.rnix-lsp}/bin/rnix-lsp";
filetypes = ["nix"];
};
- cs = {
- command = "${pkgs.omnisharp-roslyn}/bin/OmniSharp";
- filetypes = ["cs"];
- rootPatterns = ["*.csproj" ".vim/" ".git/" ".hg/"];
- };
};
};
};
@@ -49,33 +56,47 @@
# Spellchecker
nixpkgs-minion.legacyPackages.${system}.vimPlugins.coc-spell-checker
+ nixpkgs-minion.legacyPackages.${system}.vimPlugins.coc-omnisharp
# File explorer
coc-explorer
coc-git # TODO: Check if coc-git is still needed
# Snippet completion
- coc-snippets
+ ultisnips
vim-snippets
+ coc-ultisnips
+
+ # General utils
+ coc-pairs
];
extraConfig = lib.pipe [./keybinds.vim ./theme.vim] [
(map builtins.readFile)
(builtins.concatStringsSep "\n")
];
- extraPackages = with pkgs; [nodejs rustc go rust-analyzer texlab];
+ extraPackages = with pkgs; [
+ nodejs
+ rustc
+ go
+ rust-analyzer
+ texlab
+ omnisharp-roslyn
+ ];
};
home.file = lib.pipe ./snippets [
builtins.readDir
builtins.attrNames
(map
(f: {
- name = ".config/coc/ultisnips/${f}";
+ name = ".config/nvim/UltiSnips/${f}";
value = {
source = ./snippets + "/${f}";
- target = ".config/coc/ultisnips/${f}";
+ target = ".config/nvim/UltiSnips/${f}";
};
}))
builtins.listToAttrs
lib.traceValSeq
- ];
+ ] // {
+ ".config/coc/placeholder".text = "";
+ };
}
diff --git a/modules/neovim/coc/keybinds.vim b/modules/neovim/coc/keybinds.vim
index d3cf097..d92073b 100644
--- a/modules/neovim/coc/keybinds.vim
+++ b/modules/neovim/coc/keybinds.vim
@@ -8,6 +8,19 @@
nmap <silent> <Leader>fi <Plug>(coc-fix-current)
nmap <Leader>fe <Cmd>CocCommand explorer<CR>
+let g:UltiSnipsExpandTrigger="<NUL>"
+let g:UltiSnipsJumpForwardTrigger="<NUL>"
+let g:UltiSnipsJumpBackwardTrigger="<NUL>"
+inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : "\<CR>"
+inoremap <silent><expr> <Tab> coc#pum#visible() ? coc#pum#next(0) : UltiSnips#CanJumpForwards() ? "<C-R>=UltiSnips#JumpForwards()<cr>" : "\<Tab>"
+inoremap <silent><expr> <S-Tab> coc#pum#visible() ? coc#pum#prev(0) : UltiSnips#CanJumpBackwards() ? "<C-R>=UltiSnips#JumpBackwards()<cr>" : "\<S-Tab>"
+xnoremap <silent> <Tab> :call UltiSnips#SaveLastVisualSelection()<cr>gvs
+
+
+snoremap <nowait><silent> <Tab> <Esc>:call UltiSnips#JumpForwards()<cr>
+snoremap <nowait><silent> <S-Tab> <Esc>:call UltiSnips#JumpForwards()<cr>
+
+
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
diff --git a/modules/neovim/coc/theme.vim b/modules/neovim/coc/theme.vim
index 92506a4..dae527c 100644
--- a/modules/neovim/coc/theme.vim
+++ b/modules/neovim/coc/theme.vim
@@ -1,3 +1,13 @@
-highlight CocErrorSign ctermfg=168 guifg=#e06c75 ctermbg=NONE guibg=NONE
-highlight CocInfoSign ctermfg=75 guifg=#61afef ctermbg=NONE guibg=NONE
-highlight CocWarningSign ctermfg=180 guifg=#e5c07b ctermbg=NONE guibg=NONE
+call g:Highlight("DiagnosticInfo", g:blue, g:transparent)
+call g:Highlight("DiagnosticHint", g:blue, g:transparent)
+call g:Highlight("DiagnosticWarn", g:yellow, g:transparent)
+call g:Highlight("DiagnosticError", g:red, g:transparent)
+
+highlight DiagnosticUnderlineError guisp=#e06c75
+highlight DiagnosticUnderlineInfo guisp=#61afef
+highlight DiagnosticUnderlineHint guisp=#61afef
+highlight DiagnosticUnderlineWarn guisp=#e5c07b
+
+call g:Highlight("CocPumMenu", g:transparent, g:black)
+call g:Highlight("CocFloating", g:transparent, g:black)
+call g:Highlight("CocSearch", g:red, g:transparent)