Compare commits

..

2 commits

Author SHA1 Message Date
Soliprem
e896d28dde removed unnecessary imports 2024-09-22 20:10:59 +02:00
Soliprem
a314c38289 removing treesitter entirely 2024-09-22 20:10:11 +02:00
19 changed files with 175 additions and 212 deletions

View file

@ -17,6 +17,7 @@ isMaximal: {
lspkind.enable = false; lspkind.enable = false;
lightbulb.enable = true; lightbulb.enable = true;
lspsaga.enable = false; lspsaga.enable = false;
nvimCodeActionMenu.enable = isMaximal;
trouble.enable = true; trouble.enable = true;
lspSignature.enable = true; lspSignature.enable = true;
lsplines.enable = isMaximal; lsplines.enable = isMaximal;
@ -204,7 +205,6 @@ isMaximal: {
go = ["90" "130"]; go = ["90" "130"];
}; };
}; };
fastaction.enable = true;
}; };
assistant = { assistant = {

View file

@ -4,8 +4,6 @@ Release notes for release 0.7
## Breaking Changes and Migration Guide {#sec-breaking-changes-and-migration-guide-0-7} ## Breaking Changes and Migration Guide {#sec-breaking-changes-and-migration-guide-0-7}
### `vim.configRC` removed {#sec-vim-configrc-removed}
In v0.7 we are removing `vim.configRC` in favor of making `vim.luaConfigRC` the In v0.7 we are removing `vim.configRC` in favor of making `vim.luaConfigRC` the
top-level DAG, and thereby making the entire configuration Lua based. This top-level DAG, and thereby making the entire configuration Lua based. This
change introduces a few breaking changes: change introduces a few breaking changes:
@ -26,17 +24,6 @@ making good use of its extensive Lua API. Additionally, Vimscript is slow and
brings unnecessary performance overhead while working with different brings unnecessary performance overhead while working with different
configuration formats. configuration formats.
### `vim.lsp.nvimCodeActionMenu` removed in favor of `vim.ui.fastaction` {#sec-nvim-code-action-menu-deprecation}
The nvim-code-action-menu plugin has been archived and broken for a long time,
so it's being replaced with a young, but better alternative called
fastaction.nvim. Simply remove everything set under
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
Note that we are looking to add more alternatives in the future like
dressing.nvim and actions-preview.nvim, in case fastaction doesn't work for
everyone.
## Changelog {#sec-release-0.7-changelog} ## Changelog {#sec-release-0.7-changelog}
[ItsSorae](https://github.com/ItsSorae): [ItsSorae](https://github.com/ItsSorae):
@ -116,9 +103,6 @@ everyone.
yourself by adding `vim.opt.listchars:append({ eol = '<char>' })` to your yourself by adding `vim.opt.listchars:append({ eol = '<char>' })` to your
lua configuration lua configuration
- Replace `vim.lsp.nvimCodeActionMenu` with `vim.ui.fastaction`, see the
breaking changes section above for more details
[Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd() [Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd()
- Make Neovim's configuration file entirely Lua based. This comes with a few - Make Neovim's configuration file entirely Lua based. This comes with a few

34
flake.lock generated
View file

@ -571,22 +571,6 @@
"type": "github" "type": "github"
} }
}, },
"plugin-fastaction-nvim": {
"flake": false,
"locked": {
"lastModified": 1721396662,
"narHash": "sha256-L7na78FsE+QHlEwxMpiwQcoOPhtmrknvdTZfzUoDANI=",
"owner": "Chaitanyabsprip",
"repo": "fastaction.nvim",
"rev": "2384dea7ba81d2709d0bee0e4bc7a8831ff13a9d",
"type": "github"
},
"original": {
"owner": "Chaitanyabsprip",
"repo": "fastaction.nvim",
"type": "github"
}
},
"plugin-fidget-nvim": { "plugin-fidget-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -1068,6 +1052,22 @@
"type": "github" "type": "github"
} }
}, },
"plugin-nvim-code-action-menu": {
"flake": false,
"locked": {
"lastModified": 1702287297,
"narHash": "sha256-pY+aP9iBuJhvDZzVEsOHZmnfaq3vUP7TfKEEQrj+Mo8=",
"owner": "weilbith",
"repo": "nvim-code-action-menu",
"rev": "8c7672a4b04d3cc4edd2c484d05b660a9cb34a1b",
"type": "github"
},
"original": {
"owner": "weilbith",
"repo": "nvim-code-action-menu",
"type": "github"
}
},
"plugin-nvim-colorizer-lua": { "plugin-nvim-colorizer-lua": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -1855,7 +1855,6 @@
"plugin-dracula": "plugin-dracula", "plugin-dracula": "plugin-dracula",
"plugin-dressing-nvim": "plugin-dressing-nvim", "plugin-dressing-nvim": "plugin-dressing-nvim",
"plugin-elixir-tools": "plugin-elixir-tools", "plugin-elixir-tools": "plugin-elixir-tools",
"plugin-fastaction-nvim": "plugin-fastaction-nvim",
"plugin-fidget-nvim": "plugin-fidget-nvim", "plugin-fidget-nvim": "plugin-fidget-nvim",
"plugin-flutter-tools": "plugin-flutter-tools", "plugin-flutter-tools": "plugin-flutter-tools",
"plugin-gesture-nvim": "plugin-gesture-nvim", "plugin-gesture-nvim": "plugin-gesture-nvim",
@ -1886,6 +1885,7 @@
"plugin-nvim-autopairs": "plugin-nvim-autopairs", "plugin-nvim-autopairs": "plugin-nvim-autopairs",
"plugin-nvim-bufferline-lua": "plugin-nvim-bufferline-lua", "plugin-nvim-bufferline-lua": "plugin-nvim-bufferline-lua",
"plugin-nvim-cmp": "plugin-nvim-cmp", "plugin-nvim-cmp": "plugin-nvim-cmp",
"plugin-nvim-code-action-menu": "plugin-nvim-code-action-menu",
"plugin-nvim-colorizer-lua": "plugin-nvim-colorizer-lua", "plugin-nvim-colorizer-lua": "plugin-nvim-colorizer-lua",
"plugin-nvim-cursorline": "plugin-nvim-cursorline", "plugin-nvim-cursorline": "plugin-nvim-cursorline",
"plugin-nvim-dap": "plugin-nvim-dap", "plugin-nvim-dap": "plugin-nvim-dap",

View file

@ -133,8 +133,8 @@
flake = false; flake = false;
}; };
plugin-fastaction-nvim = { plugin-nvim-code-action-menu = {
url = "github:Chaitanyabsprip/fastaction.nvim"; url = "github:weilbith/nvim-code-action-menu";
flake = false; flake = false;
}; };

View file

@ -67,6 +67,7 @@ in {
formatOnSave = true; formatOnSave = true;
lightbulb.enable = true; lightbulb.enable = true;
lspsaga.enable = false; lspsaga.enable = false;
nvimCodeActionMenu.enable = true;
trouble.enable = true; trouble.enable = true;
lspSignature.enable = true; lspSignature.enable = true;
rust.enable = false; rust.enable = false;

View file

@ -67,6 +67,7 @@ in {
formatOnSave = true; formatOnSave = true;
lightbulb.enable = true; lightbulb.enable = true;
lspsaga.enable = false; lspsaga.enable = false;
nvimCodeActionMenu.enable = true;
trouble.enable = true; trouble.enable = true;
lspSignature.enable = true; lspSignature.enable = true;
rust.enable = false; rust.enable = false;

View file

@ -7,12 +7,5 @@ in {
Tidalcycles language support has been removed as of 2024-06-06 as it was long unmaintained. If Tidalcycles language support has been removed as of 2024-06-06 as it was long unmaintained. If
you depended on this functionality, please open an issue. you depended on this functionality, please open an issue.
'') '')
# 2024-07-20
(mkRemovedOptionModule ["vim" "lsp" "nvimCodeActionMenu"] ''
nvimCodeActionMenu has been deprecated and removed upstream. As of 0.7, fastaction will be
available under `vim.ui.fastaction` as a replacement. Simply remove everything under
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
'')
]; ];
} }

View file

@ -3,13 +3,11 @@
lib, lib,
... ...
}: let }: let
inherit (lib.options) mkOption mkEnableOption literalExpression literalMD; inherit (lib.options) mkOption literalExpression;
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.types) enum bool str int either; inherit (lib.types) enum bool str int;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.dag) entryAfter; inherit (lib.nvim.dag) entryAfter;
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.types) luaInline;
cfg = config.vim; cfg = config.vim;
in { in {
@ -160,138 +158,112 @@ in {
default = "sensitive"; default = "sensitive";
description = "Set the case sensitivity of search"; description = "Set the case sensitivity of search";
}; };
undoFile = {
enable = mkEnableOption "undofile for persistent undo behaviour";
path = mkOption {
type = either str luaInline;
default = mkLuaInline "vim.fn.stdpath('state') .. '/undo'";
defaultText = literalMD ''
```nix
mkLuaInline "vim.fn.stdpath('state') .. '/undo'"
```
'';
example = literalMD ''
```nix
mkLuaInline "os.getenv('XDG_DATA_HOME') .. '/nvf/undo'"
```
'';
description = "Path to the directory in which undo history will be stored";
};
};
}; };
config = { config.vim.luaConfigRC.basic = entryAfter ["globalsScript"] ''
vim.luaConfigRC.basic = entryAfter ["globalsScript"] '' -- Settings that are set for everything
-- Settings that are set for everything vim.o.encoding = "utf-8"
vim.o.encoding = "utf-8" vim.o.hidden = true
vim.o.hidden = true vim.opt.shortmess:append("c")
vim.opt.shortmess:append("c") vim.o.expandtab = true
vim.o.expandtab = true vim.o.mouse = ${toLuaObject cfg.mouseSupport}
vim.o.mouse = ${toLuaObject cfg.mouseSupport} vim.o.tabstop = ${toLuaObject cfg.tabWidth}
vim.o.tabstop = ${toLuaObject cfg.tabWidth} vim.o.shiftwidth = ${toLuaObject cfg.tabWidth}
vim.o.shiftwidth = ${toLuaObject cfg.tabWidth} vim.o.softtabstop = ${toLuaObject cfg.tabWidth}
vim.o.softtabstop = ${toLuaObject cfg.tabWidth} vim.o.cmdheight = ${toLuaObject cfg.cmdHeight}
vim.o.cmdheight = ${toLuaObject cfg.cmdHeight} vim.o.updatetime = ${toLuaObject cfg.updateTime}
vim.o.updatetime = ${toLuaObject cfg.updateTime} vim.o.tm = ${toLuaObject cfg.mapTimeout}
vim.o.tm = ${toLuaObject cfg.mapTimeout} vim.o.cursorlineopt = ${toLuaObject cfg.cursorlineOpt}
vim.o.cursorlineopt = ${toLuaObject cfg.cursorlineOpt} vim.o.scrolloff = ${toLuaObject cfg.scrollOffset}
vim.o.scrolloff = ${toLuaObject cfg.scrollOffset} vim.g.mapleader = ${toLuaObject cfg.leaderKey}
vim.g.mapleader = ${toLuaObject cfg.leaderKey} vim.g.maplocalleader = ${toLuaObject cfg.leaderKey}
vim.g.maplocalleader = ${toLuaObject cfg.leaderKey}
${optionalString cfg.undoFile.enable '' ${optionalString cfg.splitBelow ''
vim.o.undofile = true vim.o.splitbelow = true
vim.o.undodir = ${toLuaObject cfg.undoFile.path} ''}
''}
${optionalString cfg.splitBelow '' ${optionalString cfg.splitRight ''
vim.o.splitbelow = true vim.o.splitright = true
''} ''}
${optionalString cfg.splitRight '' ${optionalString cfg.showSignColumn ''
vim.o.splitright = true vim.o.signcolumn = "yes"
''} ''}
${optionalString cfg.showSignColumn '' ${optionalString cfg.autoIndent ''
vim.o.signcolumn = "yes" vim.o.autoindent = true
''} ''}
${optionalString cfg.autoIndent '' ${optionalString cfg.preventJunkFiles ''
vim.o.autoindent = true vim.o.swapfile = false
''} vim.o.backup = false
vim.o.writebackup = false
''}
${optionalString cfg.preventJunkFiles '' ${optionalString (cfg.bell == "none") ''
vim.o.swapfile = false vim.o.errorbells = false
vim.o.backup = false vim.o.visualbell = false
vim.o.writebackup = false ''}
''}
${optionalString (cfg.bell == "none") '' ${optionalString (cfg.bell == "on") ''
vim.o.errorbells = false vim.o.visualbell = false
vim.o.visualbell = false ''}
''}
${optionalString (cfg.bell == "on") '' ${optionalString (cfg.bell == "visual") ''
vim.o.visualbell = false vim.o.errorbells = false
''} ''}
${optionalString (cfg.bell == "visual") '' ${optionalString (cfg.lineNumberMode == "relative") ''
vim.o.errorbells = false vim.o.relativenumber = true
''} ''}
${optionalString (cfg.lineNumberMode == "relative") '' ${optionalString (cfg.lineNumberMode == "number") ''
vim.o.relativenumber = true vim.o.number = true
''} ''}
${optionalString (cfg.lineNumberMode == "number") '' ${optionalString (cfg.lineNumberMode == "relNumber") ''
vim.o.number = true vim.o.number = true
''} vim.o.relativenumber = true
''}
${optionalString (cfg.lineNumberMode == "relNumber") '' ${optionalString cfg.useSystemClipboard ''
vim.o.number = true vim.opt.clipboard:append("unnamedplus")
vim.o.relativenumber = true ''}
''}
${optionalString cfg.useSystemClipboard '' ${optionalString cfg.syntaxHighlighting ''
vim.opt.clipboard:append("unnamedplus") vim.cmd("syntax on")
''} ''}
${optionalString cfg.syntaxHighlighting '' ${optionalString (!cfg.wordWrap) ''
vim.cmd("syntax on") vim.o.wrap = false
''} ''}
${optionalString (!cfg.wordWrap) '' ${optionalString cfg.hideSearchHighlight ''
vim.o.wrap = false vim.o.hlsearch = false
''} vim.o.incsearch = true
''}
${optionalString cfg.hideSearchHighlight '' ${optionalString cfg.colourTerm ''
vim.o.hlsearch = false vim.o.termguicolors = true
vim.o.incsearch = true ''}
''}
${optionalString cfg.colourTerm '' ${optionalString (!cfg.enableEditorconfig) ''
vim.o.termguicolors = true vim.g.editorconfig = false
''} ''}
${optionalString (!cfg.enableEditorconfig) '' ${optionalString (cfg.searchCase == "ignore") ''
vim.g.editorconfig = false vim.o.smartcase = false
''} vim.o.ignorecase = true
''}
${optionalString (cfg.searchCase == "ignore") '' ${optionalString (cfg.searchCase == "smart") ''
vim.o.smartcase = false vim.o.smartcase = true
vim.o.ignorecase = true vim.o.ignorecase = true
''} ''}
${optionalString (cfg.searchCase == "smart") '' ${optionalString (cfg.searchCase == "sensitive") ''
vim.o.smartcase = true vim.o.smartcase = false
vim.o.ignorecase = true vim.o.ignorecase = false
''} ''}
'';
${optionalString (cfg.searchCase == "sensitive") ''
vim.o.smartcase = false
vim.o.ignorecase = false
''}
'';
};
} }

View file

@ -6,10 +6,9 @@
}: let }: let
inherit (builtins) attrNames; inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption literalExpression; inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList; inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str bool; inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.lua) expToLua; inherit (lib.nvim.lua) expToLua;
cfg = config.vim.languages.r; cfg = config.vim.languages.r;
@ -41,15 +40,6 @@ in {
options.vim.languages.r = { options.vim.languages.r = {
enable = mkEnableOption "R language support"; enable = mkEnableOption "R language support";
treesitter = {
enable = mkEnableOption "R treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkOption {
description = "R treesitter grammar to use";
type = package;
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.r;
};
};
lsp = { lsp = {
enable = mkEnableOption "R LSP support" // {default = config.vim.languages.enableLSP;}; enable = mkEnableOption "R LSP support" // {default = config.vim.languages.enableLSP;};
@ -69,11 +59,6 @@ in {
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
# vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.lsp.enable { (mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true; vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.r-lsp = servers.${cfg.lsp.server}.lspConfig; vim.lsp.lspconfig.sources.r-lsp = servers.${cfg.lsp.server}.lspConfig;

View file

@ -10,6 +10,7 @@
# lsp plugins # lsp plugins
./lspsaga ./lspsaga
./nvim-code-action-menu
./trouble ./trouble
./lsp-signature ./lsp-signature
./lightbulb ./lightbulb

View file

@ -36,7 +36,7 @@ in {
(mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')") (mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')")
(mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')") (mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')")
(mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action") (mkIf (!cfg.nvimCodeActionMenu.enable) (mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action"))
(mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help")) (mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help"))
]; ];
}; };

View file

@ -0,0 +1,38 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.lsp;
self = import ./nvim-code-action-menu.nix {inherit lib;};
mappingDefinitions = self.options.vim.lsp.nvimCodeActionMenu.mappings;
mappings = addDescriptionsToMappings cfg.nvimCodeActionMenu.mappings mappingDefinitions;
in {
config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) {
vim = {
startPlugins = ["nvim-code-action-menu"];
maps.normal = mkSetBinding mappings.open ":CodeActionMenu<CR>";
binds.whichKey.register = pushDownDefault {
"<leader>c" = "+CodeAction";
};
pluginRC.code-action-menu = entryAnywhere ''
-- border configuration
vim.g.code_action_menu_window_border = ${toLuaObject config.vim.ui.borders.plugins.code-action-menu.style}
-- show individual sections of the code action menu
${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"}
${lib.optionalString cfg.nvimCodeActionMenu.show.diff "vim.g.code_action_menu_show_diff = true"}
${lib.optionalString cfg.nvimCodeActionMenu.show.actionKind "vim.g.code_action_menu_show_action_kind = true"}
'';
};
};
}

View file

@ -1,6 +1,6 @@
{ {
imports = [ imports = [
./fastaction-nvim.nix ./nvim-code-action-menu.nix
./config.nix ./config.nix
]; ];
} }

View file

@ -0,0 +1,20 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.binds) mkMappingOption;
in {
options.vim.lsp = {
nvimCodeActionMenu = {
enable = mkEnableOption "nvim code action menu";
show = {
details = mkEnableOption "Show details" // {default = true;};
diff = mkEnableOption "Show diff" // {default = true;};
actionKind = mkEnableOption "Show action kind" // {default = true;};
};
mappings = {
open = mkMappingOption "Open code action menu [nvim-code-action-menu]" "<leader>ca";
};
};
};
}

View file

@ -43,7 +43,7 @@ in {
lspsaga = mkPluginStyleOption "lspsaga"; lspsaga = mkPluginStyleOption "lspsaga";
nvim-cmp = mkPluginStyleOption "nvim-cmp"; nvim-cmp = mkPluginStyleOption "nvim-cmp";
lsp-signature = mkPluginStyleOption "lsp-signature"; lsp-signature = mkPluginStyleOption "lsp-signature";
fastaction = mkPluginStyleOption "fastaction"; code-action-menu = mkPluginStyleOption "code-actions-menu";
}; };
}; };
} }

View file

@ -8,6 +8,5 @@
./illuminate ./illuminate
./breadcrumbs ./breadcrumbs
./borders ./borders
./fastaction
]; ];
} }

View file

@ -1,24 +0,0 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkDefault;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.ui.fastaction;
borderCfg = config.vim.ui.borders.plugins.fastaction;
in {
config = mkIf cfg.enable {
vim = {
ui.fastaction.setupOpts = {
register_ui_select = mkDefault true;
popup.border = mkIf borderCfg.enable borderCfg.style;
};
startPlugins = ["fastaction-nvim"];
pluginRC.fastaction = entryAnywhere "require('fastaction').setup(${toLuaObject cfg.setupOpts})";
};
};
}

View file

@ -1,9 +0,0 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.ui.fastaction = {
enable = mkEnableOption "overriding vim.ui.select with fastaction.nvim";
setupOpts = mkPluginSetupOption "fastaction" {};
};
}

View file

@ -45,6 +45,8 @@ in {
'noice', 'noice',
'NvimTree', 'NvimTree',
'alpha', 'alpha',
'code-action-menu-menu',
'code-action-menu-warning-message',
'notify', 'notify',
'Navbuddy' 'Navbuddy'
}, },