From 50c22738b301119c1b08a6a88f01bcf90878eb6e Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Sat, 27 Jul 2024 22:22:59 +0200 Subject: [PATCH] feat(nvim): enable vimwiki --- flake.nix | 2 ++ neovim/default.nix | 17 ++++++++++++++--- neovim/lspconfig.lua | 5 +++-- neovim/vimwiki.lua | 12 ++++++++++++ shell/shell_aliases.nix | 1 + 5 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 neovim/vimwiki.lua diff --git a/flake.nix b/flake.nix index 76c916e..8737aba 100644 --- a/flake.nix +++ b/flake.nix @@ -35,6 +35,7 @@ gpgSigningKey = "4AA25D647AA54CC7"; gpgSSHKeys = [ "1F937AC8F77ED74CE24EAAE79B5601F73C6D115F" ]; theme = "dark"; + vimwikiPath = "~/vimwiki"; }; }; "mmandl@NB11313" = home-manager.lib.homeManagerConfiguration { @@ -55,6 +56,7 @@ gpgSigningKey = "088ED38F036C7AF2"; gpgSSHKeys = [ "AEB2BF3FF9CF9529E9A3C6F1A202D21686FF9278" ]; theme = "dark"; + vimwikiPath = "~/vimwiki"; }; }; }; diff --git a/neovim/default.nix b/neovim/default.nix index 26cdcb8..937c266 100644 --- a/neovim/default.nix +++ b/neovim/default.nix @@ -1,4 +1,4 @@ -{ pkgs, theme, ... }: +{ pkgs, theme, vimwikiPath, ... }: { # symlink for a stable path home.file.".vscode-extensions/vscode-lldb".source = pkgs.vscode-extensions.vadimcn.vscode-lldb; @@ -81,7 +81,7 @@ lsp-status-nvim rustaceanvim neodev-nvim - null-ls-nvim + none-ls-nvim lsp_lines-nvim lsp-inlayhints-nvim @@ -92,6 +92,9 @@ # neorg neorg neorg-telescope + + # vim-wiki + vimwiki ]; withNodeJs = true; @@ -102,8 +105,8 @@ terraform-ls tflint bash-language-server + prettierd nodePackages.yaml-language-server - nodePackages.prettier nodePackages.eslint_d nodePackages.typescript-language-server nodePackages.typescript @@ -128,6 +131,9 @@ #clipboard xclip + + #vimwiki + vimwiki-markdown ]; extraLuaPackages = luaPackages: [ @@ -165,6 +171,11 @@ ${builtins.readFile ./illuminate.lua } ${builtins.readFile ./wilder.lua } + do + local vimwiki_path = "${vimwikiPath}" + ${builtins.readFile ./vimwiki.lua } + end + vim.g.gitblame_date_format = "%r" require("nvim-autopairs").setup({}) diff --git a/neovim/lspconfig.lua b/neovim/lspconfig.lua index 5c63236..db4b8a4 100644 --- a/neovim/lspconfig.lua +++ b/neovim/lspconfig.lua @@ -161,8 +161,9 @@ vim.g.rustaceanvim = { local null_ls = require("null-ls") null_ls.setup({ sources = { - null_ls.builtins.formatting.prettier, - null_ls.builtins.diagnostics.tsc, + null_ls.builtins.formatting.prettierd.with({ + extra_filetypes = { "vimwiki" }, + }), }, on_attach = on_attach, }) diff --git a/neovim/vimwiki.lua b/neovim/vimwiki.lua new file mode 100644 index 0000000..d79e6cc --- /dev/null +++ b/neovim/vimwiki.lua @@ -0,0 +1,12 @@ +vim.g.vimwiki_list = { + { + path = vimwiki_path, + syntax = "markdown", + ext = ".md", + path_html = "~/vimwiki_html", + custom_wiki2html = "vimwiki_markdown", + } +} + +-- disable global markdown hijacking +vim.g.vimwiki_global_ext = 0 diff --git a/shell/shell_aliases.nix b/shell/shell_aliases.nix index 762ac23..1f73735 100644 --- a/shell/shell_aliases.nix +++ b/shell/shell_aliases.nix @@ -7,5 +7,6 @@ gs = "git status"; gd = "git diff"; k = "kubectl"; + ww = "nvim -c VimwikiIndex"; }; }