blob: 7704e74c26fdee4b6beaa00ab3ef754d86380661 [file] [log] [blame]
Skyler Grey252927a2022-10-18 22:18:15 +01001{ pkgs
2, system
3, lib
4, nixpkgs-minion
5, home
6, utils
7, omnisharp-language-server
8, ...
Skyler Greya7feb6e2022-08-26 06:51:55 +01009}: {
10 programs.neovim = {
11 coc = {
12 enable = true;
13 settings = {
Skyler Grey3d1b4502022-10-31 00:11:11 +000014 diagnostic.floatConfig = {
15 border = true;
16 rounded = true;
17 };
18 signature.floatConfig = {
19 border = true;
20 rounded = true;
21 };
22 hover.floatConfig = {
23 border = true;
24 rounded = true;
25 };
Skyler Greyf066b512022-10-31 00:02:48 +000026 suggest.floatConfig = {
27 border = true;
28 rounded = true;
29 };
Skyler Grey3d1b4502022-10-31 00:11:11 +000030 "suggest.noselect" = true;
Skyler Greya7feb6e2022-08-26 06:51:55 +010031 "cSpell.checkOnlyEnabledfileTypes" = false;
Skyler Grey0c024ef2022-10-31 00:17:14 +000032 "suggest.virtualText" = true;
Skyler Grey55f84552022-09-05 11:04:39 +010033 "cSpell.dictionaryDefinitions" = [
34 {
35 name = "imperative";
36 path = "${home.home.homeDirectory}/.local/share/cspell/dictionary.txt";
37 }
38 ];
Skyler Grey252927a2022-10-18 22:18:15 +010039 "cSpell.dictionaries" = [ "imperative" ];
Skyler Grey55f84552022-09-05 11:04:39 +010040 "git.enableGutters" = false; # We're using another plugin to do this
Skyler Greyf066b512022-10-31 00:02:48 +000041 "rust-analyzer.server.path" = "${pkgs.rust-analyzer}/bin/rust-analyzer";
Skyler Greyb2e68e42023-02-26 13:02:34 +000042 "rust-analyzer.lens.enable" = false;
43 "rust-analyzer.lens.debug.enable" = false;
Skyler Greyf066b512022-10-31 00:02:48 +000044 "omnisharp.path" = "${pkgs.omnisharp-roslyn}/bin/OmniSharp";
45 "markdownlint.config" = {
46 line-length = {
47 code_blocks = false;
48 tables = false;
49 };
Skyler Grey3d1b4502022-10-31 00:11:11 +000050 MD024.siblings_only = true;
Skyler Greye9e45852022-10-31 00:16:58 +000051 MD037 = false;
Skyler Greyf066b512022-10-31 00:02:48 +000052 };
Skyler Greya7feb6e2022-08-26 06:51:55 +010053 languageserver = {
54 nix = {
55 command = "${pkgs.rnix-lsp}/bin/rnix-lsp";
Skyler Grey252927a2022-10-18 22:18:15 +010056 filetypes = [ "nix" ];
Skyler Greya7feb6e2022-08-26 06:51:55 +010057 };
Skyler Grey1e098222022-11-05 10:12:12 +000058 haskell = {
59 command = "${pkgs.haskell-language-server}/bin/haskell-language-server-wrapper";
60 args = [ "--lsp" ];
61 rootPatterns = [
62 "*.cabal"
63 "stack.yaml"
64 "cabal.project"
65 "package.yaml"
66 "hie.yaml"
67 ];
68 filetypes = [ "haskell" "lhaskell" ];
69 settings = {
70 haskell = {
71 checkParents = "CheckOnSave";
72 checkProject = true;
73 maxCompletions = 40;
74 formattingProvider = "ormolu";
75 plugin = {
76 stan = { globalOn = true; };
77 };
78 };
79 };
80 };
Skyler Greyfab867f2023-01-25 21:45:01 +000081 ccls = {
82 command = "${pkgs.ccls}/bin/ccls";
83 filetypes = [ "c" "cc" "cpp" "c++" "objc" "objcpp" "C" ];
84 rootPatterns = [ ".ccls" "compile_commands.json" ".git/" ".vim/" ];
85 initializationOptions.cache.directory = "/tmp/ccls";
86 };
Skyler Greya7feb6e2022-08-26 06:51:55 +010087 };
Skyler Grey3d1b4502022-10-31 00:11:11 +000088 "snippets.extends" = {
Skyler Grey252927a2022-10-18 22:18:15 +010089 markdown = [ "tex" ];
Skyler Grey3d1b4502022-10-31 00:11:11 +000090 };
91 "snippets.autoTrigger" = false;
Skyler Grey0c024ef2022-10-31 00:17:14 +000092 "codeLens.enable" = true;
Skyler Greya7feb6e2022-08-26 06:51:55 +010093 };
94 };
95 plugins = with pkgs.vimPlugins; [
96 # Language servers
97 coc-tsserver
98 coc-eslint
99 coc-rust-analyzer
100 coc-json
101 coc-jest
102 coc-css
Skyler Grey140fddc2023-01-27 09:43:42 +0000103 lsp_lines-nvim
Skyler Grey37e3c112022-09-09 08:15:08 +0100104 coc-go
Skyler Greyb8300e72022-09-04 23:06:24 +0100105 coc-markdownlint
Skyler Grey34e57982022-10-30 23:00:58 +0000106 coc-texlab
Skyler Grey3d1b4502022-10-31 00:11:11 +0000107 coc-pyright
Skyler Grey0c024ef2022-10-31 00:17:14 +0000108 coc-java
Skyler Greya7feb6e2022-08-26 06:51:55 +0100109
110 # Spellchecker
Skyler Greyb90fee52023-02-19 23:47:19 +0000111 coc-spell-checker
Skyler Greyf066b512022-10-31 00:02:48 +0000112 nixpkgs-minion.legacyPackages.${system}.vimPlugins.coc-omnisharp
Skyler Greya7feb6e2022-08-26 06:51:55 +0100113
114 # File explorer
115 coc-explorer
116 coc-git # TODO: Check if coc-git is still needed
117
118 # Snippet completion
Skyler Greya7feb6e2022-08-26 06:51:55 +0100119 vim-snippets
Skyler Grey81f4af62022-10-31 00:10:52 +0000120 coc-snippets
Skyler Greya7feb6e2022-08-26 06:51:55 +0100121 ];
Skyler Grey252927a2022-10-18 22:18:15 +0100122 extraConfig = lib.pipe [ ./keybinds.vim ./theme.vim ] [
Skyler Greya7feb6e2022-08-26 06:51:55 +0100123 (map builtins.readFile)
124 (builtins.concatStringsSep "\n")
125 ];
Skyler Greyf066b512022-10-31 00:02:48 +0000126 extraPackages = with pkgs; [
127 nodejs
Skyler Greyf066b512022-10-31 00:02:48 +0000128 go
Skyler Grey1e098222022-11-05 10:12:12 +0000129 stylish-haskell
130 haskell-language-server
131 (haskellPackages.ghcWithPackages (pkgs: with pkgs; [
132 dbus
133 monad-logger
134 xmonad-contrib
135 ]))
Skyler Greyf066b512022-10-31 00:02:48 +0000136 texlab
137 omnisharp-roslyn
Skyler Grey0c024ef2022-10-31 00:17:14 +0000138 jdt-language-server
139 jdk
Skyler Grey3d1b4502022-10-31 00:11:11 +0000140 nodePackages.pyright
141 (python3.withPackages (pyPkgs:
142 with pyPkgs; [
143 pycodestyle
144 black
145 rope
146 ]))
Skyler Greyfab867f2023-01-25 21:45:01 +0000147 libclang
148 ccls
Skyler Greyf066b512022-10-31 00:02:48 +0000149 ];
Skyler Greya7feb6e2022-08-26 06:51:55 +0100150 };
Skyler Grey3d1b4502022-10-31 00:11:11 +0000151 home.file =
152 lib.pipe ./snippets [
153 builtins.readDir
154 builtins.attrNames
155 (map
156 (f: {
157 name = ".config/nvim/UltiSnips/${f}";
158 value = {
159 source = ./snippets + "/${f}";
160 target = ".config/nvim/UltiSnips/${f}";
161 };
162 }))
163 builtins.listToAttrs
Skyler Greyd9c7e1e2023-02-26 12:50:27 +0000164 /* lib.traceValSeq */
Skyler Grey3d1b4502022-10-31 00:11:11 +0000165 ]
166 // {
167 ".config/coc/placeholder".text = "";
168 };
Skyler Greya7feb6e2022-08-26 06:51:55 +0100169}