From 65c64492e574366e381c610a699bae08d80039d1 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang <59727193+horriblename@users.noreply.github.com> Date: Tue, 18 Apr 2023 17:10:14 +0200 Subject: [PATCH 01/24] tokyonight: update deprecated style setup --- modules/theme/supported_themes.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/theme/supported_themes.nix b/modules/theme/supported_themes.nix index 814b412..e619bce 100644 --- a/modules/theme/supported_themes.nix +++ b/modules/theme/supported_themes.nix @@ -12,9 +12,7 @@ tokyonight = { setup = {style ? "night"}: '' - -- need to set style before colorscheme to apply - vim.g.tokyonight_style = '${style}' - vim.cmd[[colorscheme tokyonight]] + vim.cmd[[colorscheme tokyonight-${style}]] ''; styles = ["day" "night" "storm"]; }; From 3b85a387b479de943750c1a58b5515af620deb87 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang <59727193+horriblename@users.noreply.github.com> Date: Tue, 18 Apr 2023 17:10:52 +0200 Subject: [PATCH 02/24] tokyonight: add new style --- modules/theme/supported_themes.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/theme/supported_themes.nix b/modules/theme/supported_themes.nix index e619bce..d787f82 100644 --- a/modules/theme/supported_themes.nix +++ b/modules/theme/supported_themes.nix @@ -14,7 +14,7 @@ setup = {style ? "night"}: '' vim.cmd[[colorscheme tokyonight-${style}]] ''; - styles = ["day" "night" "storm"]; + styles = ["day" "night" "storm" "moon"]; }; dracula = { From 2ad526cbf5bc762e3cd83f02a682967f27c5619e Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 20:11:06 +0300 Subject: [PATCH 03/24] fix: incorrect description for typescript language module --- modules/languages/ts.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/languages/ts.nix b/modules/languages/ts.nix index d1c9796..ecb8f02 100644 --- a/modules/languages/ts.nix +++ b/modules/languages/ts.nix @@ -55,7 +55,7 @@ with builtins; let }; in { options.vim.languages.ts = { - enable = mkEnableOption "SQL language support"; + enable = mkEnableOption "Typescript/Javascript language support"; treesitter = { enable = mkOption { From 099b87a5cf9ecade4461449f5477cd24cc1623b9 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 20:13:02 +0300 Subject: [PATCH 04/24] feat: silence annoying null-ls codeactions messages --- extra.nix | 2 +- modules/lsp/null-ls/config.nix | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/extra.nix b/extra.nix index 0bcd924..8384df0 100644 --- a/extra.nix +++ b/extra.nix @@ -127,7 +127,7 @@ inputs: let vim.git = { enable = true; gitsigns.enable = true; - gitsigns.codeActions = true; + gitsigns.codeActions = false; # throws an annoying debug message }; vim.minimap = { diff --git a/modules/lsp/null-ls/config.nix b/modules/lsp/null-ls/config.nix index 7f1289a..1602f24 100644 --- a/modules/lsp/null-ls/config.nix +++ b/modules/lsp/null-ls/config.nix @@ -21,6 +21,7 @@ in { ''; vim.luaConfigRC.null_ls = nvim.dag.entryAfter ["null_ls-setup" "lsp-setup"] '' require('null-ls').setup({ + debug = false, diagnostics_format = "[#{m}] #{s} (#{c})", debounce = 250, default_timeout = 5000, From b9ec7702c5682b616e64a91b4c75346fcbcd25d8 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang <59727193+horriblename@users.noreply.github.com> Date: Tue, 18 Apr 2023 19:17:10 +0200 Subject: [PATCH 05/24] update release notes --- docs/release-notes/rl-0.3.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes/rl-0.3.adoc b/docs/release-notes/rl-0.3.adoc index 26b52c2..0d64544 100644 --- a/docs/release-notes/rl-0.3.adoc +++ b/docs/release-notes/rl-0.3.adoc @@ -15,3 +15,5 @@ * Improved handling of completion formatting. When setting <>, can also include optional menu mapping. And can provide your own function with <>. * For <> and <> turning them off should use `null` rather than `""` now. + +* Fixed deprecated configuration method for Tokyonight, and added new style "moon" From c749a7fe59fc078a9558315de7ec2aa3958a3b89 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 20:28:31 +0300 Subject: [PATCH 06/24] feat: drop venn-nvim --- extra.nix | 1 - flake.lock | 17 ------------- flake.nix | 5 ---- lib/types/plugins.nix | 1 - modules/utility/default.nix | 1 - modules/utility/venn/config.nix | 42 -------------------------------- modules/utility/venn/default.nix | 6 ----- modules/utility/venn/venn.nix | 11 --------- 8 files changed, 84 deletions(-) delete mode 100644 modules/utility/venn/config.nix delete mode 100644 modules/utility/venn/default.nix delete mode 100644 modules/utility/venn/venn.nix diff --git a/extra.nix b/extra.nix index 8384df0..c8e625b 100644 --- a/extra.nix +++ b/extra.nix @@ -151,7 +151,6 @@ inputs: let vim.utility = { colorizer.enable = true; icon-picker.enable = true; - venn-nvim.enable = false; # FIXME throws an error when its commands are ran manually diffview-nvim.enable = true; motion = { hop.enable = true; diff --git a/flake.lock b/flake.lock index 3013939..4e4fbde 100644 --- a/flake.lock +++ b/flake.lock @@ -1355,7 +1355,6 @@ "toggleterm-nvim": "toggleterm-nvim", "tokyonight": "tokyonight", "trouble": "trouble", - "venn-nvim": "venn-nvim", "vim-markdown": "vim-markdown", "vim-repeat": "vim-repeat", "vim-startify": "vim-startify", @@ -1652,22 +1651,6 @@ "type": "github" } }, - "venn-nvim": { - "flake": false, - "locked": { - "lastModified": 1669127905, - "narHash": "sha256-Ks5qUaI0MrhVC2AhVsReVwC/2WArXqIQ36CcCSCyzAk=", - "owner": "jbyuki", - "repo": "venn.nvim", - "rev": "c114563960b8fb1197695d42798d1f3e7190b798", - "type": "github" - }, - "original": { - "owner": "jbyuki", - "repo": "venn.nvim", - "type": "github" - } - }, "vim-markdown": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index 18f712b..e488e89 100644 --- a/flake.nix +++ b/flake.nix @@ -383,11 +383,6 @@ flake = false; }; - venn-nvim = { - url = "github:jbyuki/venn.nvim"; - flake = false; - }; - icon-picker-nvim = { url = "github:ziontee113/icon-picker.nvim"; flake = false; diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 0c1d0d3..f99394f 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -51,7 +51,6 @@ with lib; let "cinnamon-nvim" "cheatsheet-nvim" "colorizer" - "venn-nvim" "cellular-automaton" "presence-nvim" "icon-picker-nvim" diff --git a/modules/utility/default.nix b/modules/utility/default.nix index 87fce55..1bd03c6 100644 --- a/modules/utility/default.nix +++ b/modules/utility/default.nix @@ -7,7 +7,6 @@ _: { ./colorizer ./icon-picker ./telescope - ./venn ./diffview ]; } diff --git a/modules/utility/venn/config.nix b/modules/utility/venn/config.nix deleted file mode 100644 index 1bd958d..0000000 --- a/modules/utility/venn/config.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; let - cfg = config.vim.utility.venn-nvim; -in { - config = mkIf (cfg.enable) { - vim.startPlugins = [ - "venn-nvim" - ]; - - # TODO: https://github.com/jbyuki/venn.nvim#using-toggle-command - # add keybindings for drawing diagrams - vim.luaConfigRC.venn-nvim = nvim.dag.entryAnywhere '' - local venn = require('venn') - -- venn.nvim: enable or disable keymappings - function _G.Toggle_venn() - local venn_enabled = vim.inspect(vim.b.venn_enabled) - if venn_enabled == "nil" then - vim.b.venn_enabled = true - vim.cmd[[setlocal ve=all]] - -- draw a line on HJKL keystokes - vim.api.nvim_buf_set_keymap(0, "n", "J", "j:VBox", {noremap = true}) - vim.api.nvim_buf_set_keymap(0, "n", "K", "k:VBox", {noremap = true}) - vim.api.nvim_buf_set_keymap(0, "n", "L", "l:VBox", {noremap = true}) - vim.api.nvim_buf_set_keymap(0, "n", "H", "h:VBox", {noremap = true}) - -- draw a box by pressing "f" with visual selection - vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox", {noremap = true}) - else - vim.cmd[[setlocal ve=]] - vim.cmd[[mapclear ]] - vim.b.venn_enabled = nil - end - end - -- toggle keymappings for venn using v - vim.api.nvim_set_keymap('n', 'v', ":lua Toggle_venn()", { noremap = true}) - ''; - }; -} diff --git a/modules/utility/venn/default.nix b/modules/utility/venn/default.nix deleted file mode 100644 index de4dff0..0000000 --- a/modules/utility/venn/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: { - imports = [ - ./config.nix - ./venn.nix - ]; -} diff --git a/modules/utility/venn/venn.nix b/modules/utility/venn/venn.nix deleted file mode 100644 index 8885f64..0000000 --- a/modules/utility/venn/venn.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; { - options.vim.utility.venn-nvim = { - enable = mkEnableOption "Enable venn.nvim: draw ASCII diagrams in Neovim"; - }; -} From c874b7fa99c2c5326ac2de50e540c1993af9a85b Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 19 Apr 2023 00:54:44 +0300 Subject: [PATCH 07/24] fix: catppuccin not inheriting transparency --- extra.nix | 1 + modules/theme/supported_themes.nix | 2 +- modules/theme/theme.nix | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/extra.nix b/extra.nix index c8e625b..fa1f4d9 100644 --- a/extra.nix +++ b/extra.nix @@ -91,6 +91,7 @@ inputs: let enable = true; name = "catppuccin"; style = "mocha"; + transparent = false; }; vim.autopairs.enable = true; diff --git a/modules/theme/supported_themes.nix b/modules/theme/supported_themes.nix index d787f82..d2a20dc 100644 --- a/modules/theme/supported_themes.nix +++ b/modules/theme/supported_themes.nix @@ -32,7 +32,7 @@ -- Catppuccin theme require('catppuccin').setup { flavour = "${style}", - transparent_background = "${builtins.toString transparent}", + transparent_background = ${lib.boolToString transparent}, integrations = { nvimtree = { enabled = true, diff --git a/modules/theme/theme.nix b/modules/theme/theme.nix index 06a5dd5..6dcb66d 100644 --- a/modules/theme/theme.nix +++ b/modules/theme/theme.nix @@ -40,6 +40,8 @@ in { config = mkIf cfg.enable { vim.startPlugins = [cfg.name]; vim.luaConfigRC.themeSetup = nvim.dag.entryBefore ["theme"] cfg.extraConfig; - vim.luaConfigRC.theme = supported_themes.${cfg.name}.setup {style = cfg.style;}; + vim.luaConfigRC.theme = supported_themes.${cfg.name}.setup (with cfg; { + inherit style transparent; + }); }; } From 77a10e8ee41b10fffc8b8d506b3d1ecb86893a38 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Wed, 19 Apr 2023 13:48:13 +0200 Subject: [PATCH 08/24] fix: accept missing transparent attribute --- modules/theme/supported_themes.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/theme/supported_themes.nix b/modules/theme/supported_themes.nix index d2a20dc..10e0f6c 100644 --- a/modules/theme/supported_themes.nix +++ b/modules/theme/supported_themes.nix @@ -1,6 +1,9 @@ {lib}: { onedark = { - setup = {style ? "dark"}: '' + setup = { + style ? "dark", + transparent, + }: '' -- OneDark theme require('onedark').setup { style = "${style}" @@ -11,7 +14,10 @@ }; tokyonight = { - setup = {style ? "night"}: '' + setup = { + style ? "night", + transparent, + }: '' vim.cmd[[colorscheme tokyonight-${style}]] ''; styles = ["day" "night" "storm" "moon"]; From 74258839e8327beb5a9eaba48f73592805bc53d3 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 19 Apr 2023 15:49:28 +0300 Subject: [PATCH 09/24] docs: 0.3 release notes --- docs/release-notes/rl-0.3.adoc | 58 +++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/rl-0.3.adoc b/docs/release-notes/rl-0.3.adoc index 0d64544..5218117 100644 --- a/docs/release-notes/rl-0.3.adoc +++ b/docs/release-notes/rl-0.3.adoc @@ -1,3 +1,35 @@ +[[sec-release-0.3]] +== Release 0.3 + +Release 0.3 had to come out beore I wanted it to due to Neovim 0.9 dropping into nixpkgs-unstable. The treesitter changes +have prompted a treesitter rework, which was followed by reworking the languages system. Most of the changes to those are downstreamed +from the original repository. The feature requests that was originally planned for 0.3 have been moved to 0.4, which +should come out soon. + +[[sec-release-0.3-changelog]] +=== Changelog + +* We have transitioned to flake-parts, from flake-utils to extend the flexibility of this flake. This means the flake structure +is different than usual, but the functionality remains the same. + +* We now provide a home-manager module. Do note that it is still far from perfect, but it works. + +* `nodejs_16` is now bundled with `Copilot.lua` if the user has enabled Copilot assistant. + +* which-key section titles have been fixed. This is to be changed once again in a possible keybind rewrite, but now it should +display the correct titles instad of `+prefix` + +* Most of `presence.nvim`'s options have been made fully configurable through your configuration file. + +* Most of the modules have been refactored to separate `config` and `options` attributes. + +* Darwin has been deprecated as the zig package is marked as broken. We will attempt to use the zig overlay to return Darwin +support. + +* `Fidget.nvim` has been added as a neat visual addition for LSP installations. + +* `diffview.nvim` has been added to provide a convenient diff utility. + * Treesitter grammars are now configurable with <>. Utilizes the nixpkgs `nvim-treesitter` plugin rather than a custom input in order to take advantage of build support of pinned versions. See https://discourse.nixos.org/t/psa-if-you-are-on-unstable-try-out-nvim-treesitter-withallgrammars/23321?u=snowytrees[discourse] for more information. Packages can be found under the `pkgs.vimPlugins.nvim-treesitter.builtGrammars` attribute. Treesitter grammars for supported languages should be enabled within the module. By default no grammars are installed, thus the following grammars which do not have a language section are not included anymore: comment, toml, make, html, css, graphql, json. * A new section has been added for language support: `vim.languages.`. The options <>, <>, etc. will enable the respective section for all languages that have been enabled. @@ -9,11 +41,35 @@ * Removed the plugins document in the docs. Was too unwieldy to keep updated. - * `vim.visual.lspkind` has been moved to <> * Improved handling of completion formatting. When setting <>, can also include optional menu mapping. And can provide your own function with <>. * For <> and <> turning them off should use `null` rather than `""` now. +* Transparency has been made optional and has been disabled by default. <> option can be used to enable or +disable transparency for your configuration. + * Fixed deprecated configuration method for Tokyonight, and added new style "moon" + +* Dart language support as well as extended flutter support has been added. Thanks to @FlafyDev for his contributions towards Dart +language support. + +* Elixir language support has been added through `elixir-tools.nvim`. + +* `hop.nvim` and `leap.nvim` have been added for fast navigation. + +* `modes.nvim` has been added to the UI plugins as a minor error highlighter. + +* `smartcollumn.nvim` has been added to dynamically display a colorcolumn when the limit has been exceeded, providing +per-buftype column position and more. + +* `project.nvim` has been added for better project management inside Neovim. + +* More configuration options have been added to `nvim-session-manager`. + +* Editorconfig support has been added to the core functionality, with an enable option. + +* `venn-nvim` has been dropped due to broken keybinds. + + From c946397fba2efd244bc39f406d1060417689585c Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 19 Apr 2023 16:28:08 +0300 Subject: [PATCH 10/24] docs: include 0.3 release notes in docs --- docs/release-notes/release-notes.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/release-notes.adoc b/docs/release-notes/release-notes.adoc index 3a408b7..8217fb6 100644 --- a/docs/release-notes/release-notes.adoc +++ b/docs/release-notes/release-notes.adoc @@ -8,3 +8,4 @@ This section lists the release notes for tagged version of neovim-flake and curr include::rl-0.1.adoc[] include::rl-0.2.adoc[] +include::rl-0.3.adoc[] From 229450c4a99447b80ec05392bfde681f28c13136 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 19 Apr 2023 16:30:45 +0300 Subject: [PATCH 11/24] docs: fix typo in release notes --- docs/release-notes/rl-0.3.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release-notes/rl-0.3.adoc b/docs/release-notes/rl-0.3.adoc index 5218117..e601e80 100644 --- a/docs/release-notes/rl-0.3.adoc +++ b/docs/release-notes/rl-0.3.adoc @@ -47,7 +47,7 @@ support. * For <> and <> turning them off should use `null` rather than `""` now. -* Transparency has been made optional and has been disabled by default. <> option can be used to enable or +* Transparency has been made optional and has been disabled by default. <> option can be used to enable or disable transparency for your configuration. * Fixed deprecated configuration method for Tokyonight, and added new style "moon" From ec5f3a731aa57f1c0598d73523e2fb1ebcaf4aae Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sat, 22 Apr 2023 00:05:19 +0200 Subject: [PATCH 12/24] fix editorconfig option --- modules/basic/config.nix | 4 ++-- modules/basic/module.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/basic/config.nix b/modules/basic/config.nix index 1b4512a..2cab900 100644 --- a/modules/basic/config.nix +++ b/modules/basic/config.nix @@ -103,8 +103,8 @@ in { set termguicolors set t_Co=256 ''} - ${optionalString cfg.enableEditorconfig '' - vim.g.editorconfig = false + ${optionalString (!cfg.enableEditorconfig) '' + let g:editorconfig = v:false ''} ''; }; diff --git a/modules/basic/module.nix b/modules/basic/module.nix index 82dd802..443abee 100644 --- a/modules/basic/module.nix +++ b/modules/basic/module.nix @@ -141,7 +141,7 @@ with builtins; { }; enableEditorconfig = mkOption { type = types.bool; - default = false; + default = true; description = "Follow editorconfig rules in current directory"; }; }; From dca00f83dd7a708faa78c34de1c3287621c6ab27 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 23 Apr 2023 15:36:53 +0200 Subject: [PATCH 13/24] fix: ccls config --- modules/languages/clang.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/languages/clang.nix b/modules/languages/clang.nix index a9d1191..39e5031 100644 --- a/modules/languages/clang.nix +++ b/modules/languages/clang.nix @@ -16,8 +16,8 @@ with builtins; let lspconfig.ccls.setup{ capabilities = capabilities; on_attach=default_on_attach; - cmd = {"${pkgs.ccls}/bin/ccls"}; - ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.cclsOpts}"} + cmd = {"${cfg.lsp.package}/bin/ccls"}; + ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"} } ''; }; From 64c398871d56c20c57c7b294113ca45b7b03f3c5 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 23 Apr 2023 15:46:05 +0200 Subject: [PATCH 14/24] feat: add clangd lsp --- modules/languages/clang.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/languages/clang.nix b/modules/languages/clang.nix index 39e5031..a779dd5 100644 --- a/modules/languages/clang.nix +++ b/modules/languages/clang.nix @@ -21,6 +21,17 @@ with builtins; let } ''; }; + clangd = { + package = pkgs.clang-tools; + lspConfig = '' + lspconfig.clangd.setup{ + capabilities = capabilities; + on_attach=default_on_attach; + cmd = {"${cfg.lsp.package}/bin/clangd"}; + ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"} + } + ''; + }; }; in { options.vim.languages.clang = { From 345d8e76a7bf0bf8f39510e70032cfe607c73d44 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 23 Apr 2023 15:56:54 +0200 Subject: [PATCH 15/24] docs: update release notes --- docs/release-notes/rl-0.4.adoc | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 docs/release-notes/rl-0.4.adoc diff --git a/docs/release-notes/rl-0.4.adoc b/docs/release-notes/rl-0.4.adoc new file mode 100644 index 0000000..6f35b5d --- /dev/null +++ b/docs/release-notes/rl-0.4.adoc @@ -0,0 +1,10 @@ +[[sec-release-0.4]] +== Release 0.4 + +Release notes for release 0.4 + + +[[sec-release-0.4-changelog]] +=== Changelog + +* Added `clangd` as alternative lsp for C/++. From 24b631f3430b39373d77edc455abbe6dca36a5e2 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Mon, 24 Apr 2023 13:16:43 +0200 Subject: [PATCH 16/24] feat: lazygit integration --- modules/terminal/toggleterm/config.nix | 54 ++++++++++++++-------- modules/terminal/toggleterm/toggleterm.nix | 8 ++++ 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/modules/terminal/toggleterm/config.nix b/modules/terminal/toggleterm/config.nix index 9e98bb1..40e037a 100644 --- a/modules/terminal/toggleterm/config.nix +++ b/modules/terminal/toggleterm/config.nix @@ -6,31 +6,47 @@ with lib; with builtins; let cfg = config.vim.terminal.toggleterm; + toggleKey = ""; in { config = mkIf cfg.enable { vim.startPlugins = [ "toggleterm-nvim" ]; - vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere '' - require("toggleterm").setup({ - open_mapping = [[]], - direction = '${toString cfg.direction}', - -- TODO: this should probably be turned into a module that uses the lua function if and only if the user has not set it - size = function(term) - if term.direction == "horizontal" then - return 15 - elseif term.direction == "vertical" then - return vim.o.columns * 0.4 + vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere ('' + require("toggleterm").setup({ + open_mapping = [[${toggleKey}]], + direction = '${toString cfg.direction}', + -- TODO: this should probably be turned into a module that uses the lua function if and only if the user has not set it + size = function(term) + if term.direction == "horizontal" then + return 15 + elseif term.direction == "vertical" then + return vim.o.columns * 0.4 + end + end, + winbar = { + enabled = '${toString cfg.enable_winbar}', + name_formatter = function(term) -- term: Terminal + return term.name + end + }, + }) + '' + + optionalString cfg.lazygit.enable '' + + local terminal = require 'toggleterm.terminal' + local lazygit = terminal.Terminal:new({ + cmd = "lazygit", + direction = '${cfg.lazygit.direction}', + hidden = true, + on_open = function(term) + vim.cmd("startinsert!") + vim.keymap.set( 't', [[${toggleKey}]], function() term:toggle() end, {silent = true, noremap = true, buffer = term.bufnr}) end - end, - winbar = { - enabled = '${toString cfg.enable_winbar}', - name_formatter = function(term) -- term: Terminal - return term.name - end - }, - }) - ''; + }) + + vim.keymap.set( 'n', [[gg]], function() lazygit:toggle() end, {silent = true, noremap = true}) + ''); }; } diff --git a/modules/terminal/toggleterm/toggleterm.nix b/modules/terminal/toggleterm/toggleterm.nix index e2ed940..a3e5a42 100644 --- a/modules/terminal/toggleterm/toggleterm.nix +++ b/modules/terminal/toggleterm/toggleterm.nix @@ -17,5 +17,13 @@ with builtins; { default = false; description = "Enable winbar"; }; + lazygit = { + enable = mkEnableOption "Enable LazyGit integration"; + direction = mkOption { + type = types.enum ["horizontal" "vertical" "tab" "float"]; + default = "float"; + description = "Direction of the lazygit window"; + }; + }; }; } From f8ff3cd9fa161899922f1328f2f035248b574939 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Thu, 27 Apr 2023 12:41:59 +0200 Subject: [PATCH 17/24] use separate dag for toggleterm --- modules/terminal/toggleterm/config.nix | 83 ++++++++++++++------------ 1 file changed, 45 insertions(+), 38 deletions(-) diff --git a/modules/terminal/toggleterm/config.nix b/modules/terminal/toggleterm/config.nix index 40e037a..4bf8559 100644 --- a/modules/terminal/toggleterm/config.nix +++ b/modules/terminal/toggleterm/config.nix @@ -8,45 +8,52 @@ with builtins; let cfg = config.vim.terminal.toggleterm; toggleKey = ""; in { - config = mkIf cfg.enable { - vim.startPlugins = [ - "toggleterm-nvim" - ]; + config = mkMerge [ + (mkIf cfg.enable { + vim.startPlugins = [ + "toggleterm-nvim" + ]; - vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere ('' - require("toggleterm").setup({ - open_mapping = [[${toggleKey}]], - direction = '${toString cfg.direction}', - -- TODO: this should probably be turned into a module that uses the lua function if and only if the user has not set it - size = function(term) - if term.direction == "horizontal" then - return 15 - elseif term.direction == "vertical" then - return vim.o.columns * 0.4 + vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere '' + require("toggleterm").setup({ + open_mapping = [[${toggleKey}]], + direction = '${toString cfg.direction}', + -- TODO: this should probably be turned into a module that uses the lua function if and only if the user has not set it + size = function(term) + if term.direction == "horizontal" then + return 15 + elseif term.direction == "vertical" then + return vim.o.columns * 0.4 + end + end, + winbar = { + enabled = '${toString cfg.enable_winbar}', + name_formatter = function(term) -- term: Terminal + return term.name + end + }, + }) + ''; + } + ) + ( + mkIf (cfg.enable && cfg.lazygit.enable) + { + vim.luaConfigRC.toggleterm-lazygit = mkIf cfg.lazygit.enable nvim.dag.entryAfter ["toggleterm"] '' + local terminal = require 'toggleterm.terminal' + local lazygit = terminal.Terminal:new({ + cmd = "lazygit", + direction = '${cfg.lazygit.direction}', + hidden = true, + on_open = function(term) + vim.cmd("startinsert!") + vim.keymap.set( 't', [[${toggleKey}]], function() term:toggle() end, {silent = true, noremap = true, buffer = term.bufnr}) end - end, - winbar = { - enabled = '${toString cfg.enable_winbar}', - name_formatter = function(term) -- term: Terminal - return term.name - end - }, - }) - '' - + optionalString cfg.lazygit.enable '' + }) - local terminal = require 'toggleterm.terminal' - local lazygit = terminal.Terminal:new({ - cmd = "lazygit", - direction = '${cfg.lazygit.direction}', - hidden = true, - on_open = function(term) - vim.cmd("startinsert!") - vim.keymap.set( 't', [[${toggleKey}]], function() term:toggle() end, {silent = true, noremap = true, buffer = term.bufnr}) - end - }) - - vim.keymap.set( 'n', [[gg]], function() lazygit:toggle() end, {silent = true, noremap = true}) - ''); - }; + vim.keymap.set( 'n', [[gg]], function() lazygit:toggle() end, {silent = true, noremap = true}) + ''; + } + ) + ]; } From 2018cd7b2fc9aa927fa6295f91afc1133c823ccf Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Thu, 27 Apr 2023 12:52:34 +0200 Subject: [PATCH 18/24] (lazygit) add option `package` --- modules/terminal/toggleterm/config.nix | 14 +++++++++++--- modules/terminal/toggleterm/toggleterm.nix | 6 ++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/modules/terminal/toggleterm/config.nix b/modules/terminal/toggleterm/config.nix index 4bf8559..868dec4 100644 --- a/modules/terminal/toggleterm/config.nix +++ b/modules/terminal/toggleterm/config.nix @@ -9,7 +9,8 @@ with builtins; let toggleKey = ""; in { config = mkMerge [ - (mkIf cfg.enable { + ( + mkIf cfg.enable { vim.startPlugins = [ "toggleterm-nvim" ]; @@ -39,10 +40,17 @@ in { ( mkIf (cfg.enable && cfg.lazygit.enable) { - vim.luaConfigRC.toggleterm-lazygit = mkIf cfg.lazygit.enable nvim.dag.entryAfter ["toggleterm"] '' + vim.startPlugins = lib.optionals (cfg.lazygit.package != null) [ + cfg.lazygit.package + ]; + vim.luaConfigRC.toggleterm-lazygit = nvim.dag.entryAfter ["toggleterm"] '' local terminal = require 'toggleterm.terminal' local lazygit = terminal.Terminal:new({ - cmd = "lazygit", + cmd = '${ + if (cfg.lazygit.package != null) + then getExe cfg.lazygit.package + else "lazygit" + }', direction = '${cfg.lazygit.direction}', hidden = true, on_open = function(term) diff --git a/modules/terminal/toggleterm/toggleterm.nix b/modules/terminal/toggleterm/toggleterm.nix index a3e5a42..e304bf6 100644 --- a/modules/terminal/toggleterm/toggleterm.nix +++ b/modules/terminal/toggleterm/toggleterm.nix @@ -1,4 +1,5 @@ { + pkgs, config, lib, ... @@ -24,6 +25,11 @@ with builtins; { default = "float"; description = "Direction of the lazygit window"; }; + package = mkOption { + type = with types; nullOr package; + default = pkgs.lazygit; + description = "The package to use for lazygit, null means do not install automatically"; + }; }; }; } From 998a5da5ff4a952ac8540bffd769b8b8199b9739 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Fri, 28 Apr 2023 06:54:04 +0200 Subject: [PATCH 19/24] fix: broken python lsp option --- modules/languages/python.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/languages/python.nix b/modules/languages/python.nix index ab80ca6..367391e 100644 --- a/modules/languages/python.nix +++ b/modules/languages/python.nix @@ -64,7 +64,11 @@ in { type = with types; enum (attrNames servers); default = defaultServer; }; - package = nvim.types.mkGrammarOption pkgs "python"; + package = mkOption { + description = "python LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; }; format = { From 7afe92b8450d848e813def844a4ae474c6c463d5 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 28 Apr 2023 08:59:35 +0300 Subject: [PATCH 20/24] dev: enable lazygit out of the box --- extra.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extra.nix b/extra.nix index fa1f4d9..df79958 100644 --- a/extra.nix +++ b/extra.nix @@ -167,7 +167,10 @@ inputs: let }; vim.terminal = { - toggleterm.enable = true; + toggleterm = { + enable = true; + lazygit.enable = true; + }; }; vim.ui = { From 132b93a633009a7eb4eb0bf3fa9aa603aee0a8db Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 28 Apr 2023 09:49:11 +0300 Subject: [PATCH 21/24] docs: update release notes with lazygit --- docs/release-notes/rl-0.4.adoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/release-notes/rl-0.4.adoc b/docs/release-notes/rl-0.4.adoc index 6f35b5d..ddf5f75 100644 --- a/docs/release-notes/rl-0.4.adoc +++ b/docs/release-notes/rl-0.4.adoc @@ -7,4 +7,9 @@ Release notes for release 0.4 [[sec-release-0.4-changelog]] === Changelog + +ttps://github.com/horriblename[horriblename]: + * Added `clangd` as alternative lsp for C/++. + +* Added `toggleterm` integration for `lazygit`. From 719db9906772d553422c3566041923012b0a8279 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 28 Apr 2023 09:49:31 +0300 Subject: [PATCH 22/24] docs: clarify `lazygit.package` usage --- modules/terminal/toggleterm/toggleterm.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/terminal/toggleterm/toggleterm.nix b/modules/terminal/toggleterm/toggleterm.nix index e304bf6..09b03f2 100644 --- a/modules/terminal/toggleterm/toggleterm.nix +++ b/modules/terminal/toggleterm/toggleterm.nix @@ -28,7 +28,7 @@ with builtins; { package = mkOption { type = with types; nullOr package; default = pkgs.lazygit; - description = "The package to use for lazygit, null means do not install automatically"; + description = "The package that should be used for lazygit. Setting it to null will attempt to use lazygit from your PATH"; }; }; }; From c01f5bc2bc654dec52355f0f04c71953d8b89bd5 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 28 Apr 2023 13:39:29 +0300 Subject: [PATCH 23/24] style: formatting --- extra.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra.nix b/extra.nix index df79958..767d5dd 100644 --- a/extra.nix +++ b/extra.nix @@ -170,7 +170,7 @@ inputs: let toggleterm = { enable = true; lazygit.enable = true; - }; + }; }; vim.ui = { From b3b4f54c898ea64ca92f4836a2e4802f4066c3c1 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 1 May 2023 18:32:47 +0300 Subject: [PATCH 24/24] fix: invalid zls package --- modules/languages/zig.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/languages/zig.nix b/modules/languages/zig.nix index 0ce85db..02410be 100644 --- a/modules/languages/zig.nix +++ b/modules/languages/zig.nix @@ -28,7 +28,7 @@ in { package = mkOption { description = "ZLS package"; type = types.package; - default = pkgs.nodePackages.pyright; + default = pkgs.zls; }; zigPackage = mkOption { description = "Zig package used by ZLS"; @@ -37,7 +37,6 @@ in { }; }; }; - config = mkIf cfg.enable (mkMerge [ (mkIf cfg.treesitter.enable { vim.treesitter.enable = true;