nvim: modularize zk and haskell support

This commit is contained in:
Sridhar Ratnakumar 2022-04-30 11:45:28 -04:00
parent 4f10fd6d44
commit 104f5471c6
4 changed files with 80 additions and 64 deletions

View file

@ -5,32 +5,16 @@ in
{
imports = [
./neovim/coc.nix
./neovim/haskell.nix
./neovim/zk.nix
];
programs.neovim = {
enable = true;
package = nvim;
coc = {
settings = {
languageserver = {
haskell = {
command = "haskell-language-server-wrapper";
args = [ "--lsp" ];
rootPatterns = [
"*.cabal"
"cabal.project"
"hie.yaml"
];
filetypes = [ "haskell" "lhaskell" ];
};
};
};
};
extraPackages = [
pkgs.lazygit
pkgs.himalaya
pkgs.zk
];
# Full list here,
@ -151,52 +135,8 @@ in
# Language support
vim-nix
{
plugin = haskell-vim;
type = "lua";
config = ''
vim.cmd([[
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
]])
'';
}
vim-markdown
{
plugin =
(pkgs.vimUtils.buildVimPlugin {
name = "zk-nvim";
src = inputs.zk-nvim;
});
type = "lua";
config = ''
require("zk").setup({
-- can be "telescope", "fzf" or "select" (`vim.ui.select`)
-- it's recommended to use "telescope" or "fzf"
picker = "telescope",
lsp = {
-- `config` is passed to `vim.lsp.start_client(config)`
config = {
cmd = { "zk", "lsp" },
name = "zk",
-- on_attach = ...
-- etc, see `:h vim.lsp.start_client()`
},
-- automatically attach buffers in a zk notebook that match the given filetypes
auto_attach = {
enabled = true,
filetypes = { "markdown" },
},
},
})
'';
}
];
# Add library code here for use in the Lua config from the

View file

@ -6,7 +6,7 @@
};
extraPackages = [
pkgs.nodejs # coc requires nodejs
pkgs.nodejs # coc requires nodejs
];
};
}

33
home/neovim/haskell.nix Normal file
View file

@ -0,0 +1,33 @@
{ pkgs, inputs, system, ... }:
{
programs.neovim = {
coc.settings.languageserver.haskell = {
command = "haskell-language-server-wrapper";
args = [ "--lsp" ];
rootPatterns = [
"*.cabal"
"cabal.project"
"hie.yaml"
];
filetypes = [ "haskell" "lhaskell" ];
};
plugins = with pkgs.vimPlugins; [
{
plugin = haskell-vim;
type = "lua";
config = ''
vim.cmd([[
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
]])
'';
}
];
};
}

43
home/neovim/zk.nix Normal file
View file

@ -0,0 +1,43 @@
{ pkgs, inputs, system, ... }:
{
programs.neovim = {
extraPackages = [
pkgs.zk
];
plugins = with pkgs.vimPlugins; [
{
plugin =
(pkgs.vimUtils.buildVimPlugin {
name = "zk-nvim";
src = inputs.zk-nvim;
});
type = "lua";
config = ''
require("zk").setup({
-- can be "telescope", "fzf" or "select" (`vim.ui.select`)
-- it's recommended to use "telescope" or "fzf"
picker = "telescope",
lsp = {
-- `config` is passed to `vim.lsp.start_client(config)`
config = {
cmd = { "zk", "lsp" },
name = "zk",
-- on_attach = ...
-- etc, see `:h vim.lsp.start_client()`
},
-- automatically attach buffers in a zk notebook that match the given filetypes
auto_attach = {
enabled = true,
filetypes = { "markdown" },
},
},
})
'';
}
];
};
}