mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 11:01:15 +00:00
Compare commits
17 commits
7bb3a337ff
...
b8aed0e102
Author | SHA1 | Date | |
---|---|---|---|
|
b8aed0e102 | ||
|
88393d6a78 | ||
|
665f0fa106 | ||
|
256a8cf62c | ||
|
d49e46ab16 | ||
|
854fd340e3 | ||
|
3c4eced9d1 | ||
|
ff9b0eeb1f | ||
|
d76d673dd4 | ||
|
54ec473039 | ||
|
a7e0542fd0 | ||
|
94d2b837cf | ||
be81f19b5f | |||
|
f5d33f6a53 | ||
|
caaacbf59c | ||
|
c0790c5494 | ||
|
0947ab38c0 |
31 changed files with 847 additions and 428 deletions
|
@ -51,9 +51,11 @@ isMaximal: {
|
||||||
css.enable = isMaximal;
|
css.enable = isMaximal;
|
||||||
sql.enable = isMaximal;
|
sql.enable = isMaximal;
|
||||||
java.enable = isMaximal;
|
java.enable = isMaximal;
|
||||||
|
kotlin.enable = isMaximal;
|
||||||
ts.enable = isMaximal;
|
ts.enable = isMaximal;
|
||||||
svelte.enable = isMaximal;
|
svelte.enable = isMaximal;
|
||||||
go.enable = isMaximal;
|
go.enable = isMaximal;
|
||||||
|
lua.enable = isMaximal;
|
||||||
elixir.enable = isMaximal;
|
elixir.enable = isMaximal;
|
||||||
zig.enable = isMaximal;
|
zig.enable = isMaximal;
|
||||||
ocaml.enable = isMaximal;
|
ocaml.enable = isMaximal;
|
||||||
|
@ -68,6 +70,7 @@ isMaximal: {
|
||||||
lsp.server = "clangd";
|
lsp.server = "clangd";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
scala.enable = isMaximal;
|
||||||
rust = {
|
rust = {
|
||||||
enable = isMaximal;
|
enable = isMaximal;
|
||||||
crates.enable = isMaximal;
|
crates.enable = isMaximal;
|
||||||
|
@ -171,6 +174,7 @@ isMaximal: {
|
||||||
|
|
||||||
notes = {
|
notes = {
|
||||||
obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled
|
obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled
|
||||||
|
neorg.enable = false;
|
||||||
orgmode.enable = false;
|
orgmode.enable = false;
|
||||||
mind-nvim.enable = isMaximal;
|
mind-nvim.enable = isMaximal;
|
||||||
todo-comments.enable = true;
|
todo-comments.enable = true;
|
||||||
|
|
|
@ -136,30 +136,29 @@ plugins are managed by `lz.n`.
|
||||||
let
|
let
|
||||||
cfg = config.vim.your-plugin;
|
cfg = config.vim.your-plugin;
|
||||||
in {
|
in {
|
||||||
vim.lazy.plugins = [
|
vim.lazy.plugins.your-plugin = {
|
||||||
{
|
# instead of vim.startPlugins, use this:
|
||||||
# instead of vim.startPlugins, use this:
|
package = "your-plugin";
|
||||||
package = "your-plugin";
|
|
||||||
|
|
||||||
# if your plugin uses the `require('your-plugin').setup{...}` pattern
|
# if your plugin uses the `require('your-plugin').setup{...}` pattern
|
||||||
setupModule = "your-plugin";
|
setupModule = "your-plugin";
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
# events that trigger this plugin to be loaded
|
# events that trigger this plugin to be loaded
|
||||||
events = ["DirChanged"];
|
events = ["DirChanged"];
|
||||||
cmd = ["YourPluginCommand"];
|
cmd = ["YourPluginCommand"];
|
||||||
|
|
||||||
# keymaps
|
# keymaps
|
||||||
keys = [
|
keys = [
|
||||||
# we'll cover this in detail in the keymaps section
|
# we'll cover this in detail in the keymaps section
|
||||||
{
|
{
|
||||||
key = "<leader>d";
|
key = "<leader>d";
|
||||||
mode = "n";
|
mode = "n";
|
||||||
action = ":YourPluginCommand";
|
action = ":YourPluginCommand";
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
}
|
};
|
||||||
];
|
;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,14 @@ 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
|
dressing.nvim and actions-preview.nvim, in case fastaction doesn't work for
|
||||||
everyone.
|
everyone.
|
||||||
|
|
||||||
|
### `type` based modules removed {#sec-type-based-modules-removed}
|
||||||
|
|
||||||
|
As part of the autocompletion rewrite, modules that used to use a `type` option
|
||||||
|
have been replaced by per-plugin modules instead. Since both modules only had
|
||||||
|
one type, you can simply change
|
||||||
|
- `vim.autocomplete.*` -> `vim.autocomplete.nvim-cmp.*`
|
||||||
|
- `vim.autopairs.enable` -> `vim.autopairs.nvim-autopairs.enable`
|
||||||
|
|
||||||
## Changelog {#sec-release-0.7-changelog}
|
## Changelog {#sec-release-0.7-changelog}
|
||||||
|
|
||||||
[ItsSorae](https://github.com/ItsSorae):
|
[ItsSorae](https://github.com/ItsSorae):
|
||||||
|
@ -93,6 +101,9 @@ everyone.
|
||||||
- Add dap-go for better dap configurations
|
- Add dap-go for better dap configurations
|
||||||
- Make noice.nvim customizable
|
- Make noice.nvim customizable
|
||||||
- Standardize border style options and add custom borders
|
- Standardize border style options and add custom borders
|
||||||
|
- Remove `vim.disableDefaultRuntimePaths` in wrapper options.
|
||||||
|
- As nvf uses `$NVIM_APP_NAME` as of recent changes, we can safely assume any
|
||||||
|
configuration in `$XDG_CONFIG_HOME/nvf` is intentional.
|
||||||
|
|
||||||
[rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim
|
[rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim
|
||||||
[rustaceanvim]: https://github.com/mrcjkb/rustaceanvim
|
[rustaceanvim]: https://github.com/mrcjkb/rustaceanvim
|
||||||
|
@ -263,9 +274,19 @@ everyone.
|
||||||
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
||||||
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
||||||
ccc
|
ccc
|
||||||
|
- Add Neorg support under `vim.notes.neorg`
|
||||||
|
- Add LSP, diagnostics, formatter and Treesitter support for Kotlin under
|
||||||
|
`vim.languages.kotlin`
|
||||||
|
- changed default keybinds for leap.nvim to avoid altering expected behavior
|
||||||
|
|
||||||
[Bloxx12](https://github.com/Bloxx12)
|
[Bloxx12](https://github.com/Bloxx12)
|
||||||
|
|
||||||
- Add support for [base16 theming](https://github.com/RRethy/base16-nvim) under
|
- Add support for [base16 theming](https://github.com/RRethy/base16-nvim) under
|
||||||
`vim.theme`
|
`vim.theme`
|
||||||
- Fix internal breakage in `elixir-tools` setup.
|
- Fix internal breakage in `elixir-tools` setup.
|
||||||
|
|
||||||
|
[ksonj](https://github.com/ksonj):
|
||||||
|
|
||||||
|
- Add LSP support for Scala via
|
||||||
|
[nvim-metals](https://github.com/scalameta/nvim-metals)
|
||||||
|
|
||||||
|
|
85
flake.lock
85
flake.lock
|
@ -828,6 +828,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-lua-utils-nvim": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1708177208,
|
||||||
|
"narHash": "sha256-9ildzQEMkXKZ3LHq+khGFgRQFxlIXQclQ7QU3fcU1C4=",
|
||||||
|
"owner": "nvim-neorg",
|
||||||
|
"repo": "lua-utils.nvim",
|
||||||
|
"rev": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nvim-neorg",
|
||||||
|
"repo": "lua-utils.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-lualine": {
|
"plugin-lualine": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -989,6 +1005,38 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-neorg": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1727821831,
|
||||||
|
"narHash": "sha256-yfWQ6yKytu1jkWUtRZTVICslUWej6jVYv7frmSB7/6Q=",
|
||||||
|
"owner": "nvim-neorg",
|
||||||
|
"repo": "neorg",
|
||||||
|
"rev": "afc9a37bf021acb0853e95714c4c6436e1588286",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nvim-neorg",
|
||||||
|
"repo": "neorg",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plugin-neorg-telescope": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1722358034,
|
||||||
|
"narHash": "sha256-ei4uUqpIQjGKzu5ryu0Hlmis9TS9FJsYnjt4J4QdWlw=",
|
||||||
|
"owner": "nvim-neorg",
|
||||||
|
"repo": "neorg-telescope",
|
||||||
|
"rev": "ddb2556644cae922699a239bbb0fe16e25b084b7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nvim-neorg",
|
||||||
|
"repo": "neorg-telescope",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-new-file-template-nvim": {
|
"plugin-new-file-template-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1230,6 +1278,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-nvim-metals": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1728295172,
|
||||||
|
"narHash": "sha256-ja/+MNxZ3H9io9jDwm5rhE6iKNi86a22eCOY75g19O8=",
|
||||||
|
"owner": "scalameta",
|
||||||
|
"repo": "nvim-metals",
|
||||||
|
"rev": "f861db9fda55939797ac1b05238c49b0dcdc3bdb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "scalameta",
|
||||||
|
"repo": "nvim-metals",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-nvim-navbuddy": {
|
"plugin-nvim-navbuddy": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1486,6 +1550,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-pathlib-nvim": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1724943804,
|
||||||
|
"narHash": "sha256-YhCJeNKlcjgg3q51UWFhuIEPzNueC8YTpeuPPJDndvw=",
|
||||||
|
"owner": "pysan3",
|
||||||
|
"repo": "pathlib.nvim",
|
||||||
|
"rev": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "pysan3",
|
||||||
|
"repo": "pathlib.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-plenary-nvim": {
|
"plugin-plenary-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1908,6 +1988,7 @@
|
||||||
"plugin-lsp-signature": "plugin-lsp-signature",
|
"plugin-lsp-signature": "plugin-lsp-signature",
|
||||||
"plugin-lspkind": "plugin-lspkind",
|
"plugin-lspkind": "plugin-lspkind",
|
||||||
"plugin-lspsaga": "plugin-lspsaga",
|
"plugin-lspsaga": "plugin-lspsaga",
|
||||||
|
"plugin-lua-utils-nvim": "plugin-lua-utils-nvim",
|
||||||
"plugin-lualine": "plugin-lualine",
|
"plugin-lualine": "plugin-lualine",
|
||||||
"plugin-luasnip": "plugin-luasnip",
|
"plugin-luasnip": "plugin-luasnip",
|
||||||
"plugin-lz-n": "plugin-lz-n",
|
"plugin-lz-n": "plugin-lz-n",
|
||||||
|
@ -1918,6 +1999,8 @@
|
||||||
"plugin-neo-tree-nvim": "plugin-neo-tree-nvim",
|
"plugin-neo-tree-nvim": "plugin-neo-tree-nvim",
|
||||||
"plugin-neocord": "plugin-neocord",
|
"plugin-neocord": "plugin-neocord",
|
||||||
"plugin-neodev-nvim": "plugin-neodev-nvim",
|
"plugin-neodev-nvim": "plugin-neodev-nvim",
|
||||||
|
"plugin-neorg": "plugin-neorg",
|
||||||
|
"plugin-neorg-telescope": "plugin-neorg-telescope",
|
||||||
"plugin-new-file-template-nvim": "plugin-new-file-template-nvim",
|
"plugin-new-file-template-nvim": "plugin-new-file-template-nvim",
|
||||||
"plugin-noice-nvim": "plugin-noice-nvim",
|
"plugin-noice-nvim": "plugin-noice-nvim",
|
||||||
"plugin-none-ls": "plugin-none-ls",
|
"plugin-none-ls": "plugin-none-ls",
|
||||||
|
@ -1933,6 +2016,7 @@
|
||||||
"plugin-nvim-docs-view": "plugin-nvim-docs-view",
|
"plugin-nvim-docs-view": "plugin-nvim-docs-view",
|
||||||
"plugin-nvim-lightbulb": "plugin-nvim-lightbulb",
|
"plugin-nvim-lightbulb": "plugin-nvim-lightbulb",
|
||||||
"plugin-nvim-lspconfig": "plugin-nvim-lspconfig",
|
"plugin-nvim-lspconfig": "plugin-nvim-lspconfig",
|
||||||
|
"plugin-nvim-metals": "plugin-nvim-metals",
|
||||||
"plugin-nvim-navbuddy": "plugin-nvim-navbuddy",
|
"plugin-nvim-navbuddy": "plugin-nvim-navbuddy",
|
||||||
"plugin-nvim-navic": "plugin-nvim-navic",
|
"plugin-nvim-navic": "plugin-nvim-navic",
|
||||||
"plugin-nvim-neoclip": "plugin-nvim-neoclip",
|
"plugin-nvim-neoclip": "plugin-nvim-neoclip",
|
||||||
|
@ -1949,6 +2033,7 @@
|
||||||
"plugin-orgmode-nvim": "plugin-orgmode-nvim",
|
"plugin-orgmode-nvim": "plugin-orgmode-nvim",
|
||||||
"plugin-otter-nvim": "plugin-otter-nvim",
|
"plugin-otter-nvim": "plugin-otter-nvim",
|
||||||
"plugin-oxocarbon": "plugin-oxocarbon",
|
"plugin-oxocarbon": "plugin-oxocarbon",
|
||||||
|
"plugin-pathlib-nvim": "plugin-pathlib-nvim",
|
||||||
"plugin-plenary-nvim": "plugin-plenary-nvim",
|
"plugin-plenary-nvim": "plugin-plenary-nvim",
|
||||||
"plugin-project-nvim": "plugin-project-nvim",
|
"plugin-project-nvim": "plugin-project-nvim",
|
||||||
"plugin-registers": "plugin-registers",
|
"plugin-registers": "plugin-registers",
|
||||||
|
|
25
flake.nix
25
flake.nix
|
@ -217,6 +217,11 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-nvim-metals = {
|
||||||
|
url = "github:scalameta/nvim-metals";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
# Copying/Registers
|
# Copying/Registers
|
||||||
plugin-registers = {
|
plugin-registers = {
|
||||||
url = "github:tversteeg/registers.nvim";
|
url = "github:tversteeg/registers.nvim";
|
||||||
|
@ -652,6 +657,26 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-lua-utils-nvim = {
|
||||||
|
url = "github:nvim-neorg/lua-utils.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin-pathlib-nvim = {
|
||||||
|
url = "github:pysan3/pathlib.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin-neorg = {
|
||||||
|
url = "github:nvim-neorg/neorg";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin-neorg-telescope = {
|
||||||
|
url = "github:nvim-neorg/neorg-telescope";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
plugin-nui-nvim = {
|
plugin-nui-nvim = {
|
||||||
# (required by noice.nvim)
|
# (required by noice.nvim)
|
||||||
url = "github:MunifTanjim/nui.nvim";
|
url = "github:MunifTanjim/nui.nvim";
|
||||||
|
|
|
@ -31,9 +31,28 @@ in {
|
||||||
vim.autocomplete.type has been removed in favor of per-plugin modules.
|
vim.autocomplete.type has been removed in favor of per-plugin modules.
|
||||||
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
||||||
'')
|
'')
|
||||||
|
(mkRemovedOptionModule ["vim" "autocomplete" "sources"] ''
|
||||||
|
vim.autocomplete.sources has been removed in favor of per-plugin modules.
|
||||||
|
You can add nvim-cmp sources with vim.autocomplete.nvim-cmp.sources
|
||||||
|
instead.
|
||||||
|
'')
|
||||||
(mkRemovedOptionModule ["vim" "snippets" "vsnip" "enable"] ''
|
(mkRemovedOptionModule ["vim" "snippets" "vsnip" "enable"] ''
|
||||||
vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip.
|
vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip.
|
||||||
'')
|
'')
|
||||||
(mkRenamedOptionModule ["vim" "lsp" "lspkind" "mode"] ["vim" "lsp" "lspkind" "setupOpts" "mode"])
|
(mkRenamedOptionModule ["vim" "lsp" "lspkind" "mode"] ["vim" "lsp" "lspkind" "setupOpts" "mode"])
|
||||||
|
|
||||||
|
# 2024-10-14
|
||||||
|
(mkRemovedOptionModule ["vim" "configRC"] ''
|
||||||
|
Please migrate your configRC sections to Neovim's Lua format, and
|
||||||
|
add them to `vim.luaConfigRC`.
|
||||||
|
|
||||||
|
See the v0.7 release notes for more information on why and how to
|
||||||
|
migrate your existing configurations to the new format.
|
||||||
|
'')
|
||||||
|
|
||||||
|
(mkRemovedOptionModule ["vim" "disableDefaultRuntimePaths"] ''
|
||||||
|
Nvf now uses $NVIM_APP_NAME so there is no longer the problem of
|
||||||
|
(accidental) leaking of user configuration.
|
||||||
|
'')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,37 +11,32 @@
|
||||||
inherit (self.options.vim.comments.comment-nvim) mappings;
|
inherit (self.options.vim.comments.comment-nvim) mappings;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim.startPlugins = ["comment-nvim"];
|
||||||
"comment-nvim"
|
|
||||||
];
|
|
||||||
|
|
||||||
vim.lazy.plugins = [
|
vim.lazy.plugins.comment-nvim = {
|
||||||
{
|
package = "comment-nvim";
|
||||||
package = "comment-nvim";
|
setupModule = "Comment";
|
||||||
setupModule = "Comment";
|
inherit (cfg) setupOpts;
|
||||||
inherit (cfg) setupOpts;
|
keys = [
|
||||||
keys = [
|
(mkLznBinding ["n"] cfg.mappings.toggleOpLeaderLine "<Plug>(comment_toggle_linewise)" mappings.toggleOpLeaderLine.description)
|
||||||
(mkLznBinding ["n"] cfg.mappings.toggleOpLeaderLine "<Plug>(comment_toggle_linewise)" mappings.toggleOpLeaderLine.description)
|
(mkLznBinding ["n"] cfg.mappings.toggleOpLeaderBlock "<Plug>(comment_toggle_blockwise)" mappings.toggleOpLeaderBlock.description)
|
||||||
(mkLznBinding ["n"] cfg.mappings.toggleOpLeaderBlock "<Plug>(comment_toggle_blockwise)" mappings.toggleOpLeaderBlock.description)
|
(mkLznExprBinding ["n"] cfg.mappings.toggleCurrentLine ''
|
||||||
|
function()
|
||||||
(mkLznExprBinding ["n"] cfg.mappings.toggleCurrentLine ''
|
return vim.api.nvim_get_vvar('count') == 0 and '<Plug>(comment_toggle_linewise_current)'
|
||||||
function()
|
or '<Plug>(comment_toggle_linewise_count)'
|
||||||
return vim.api.nvim_get_vvar('count') == 0 and '<Plug>(comment_toggle_linewise_current)'
|
end
|
||||||
or '<Plug>(comment_toggle_linewise_count)'
|
''
|
||||||
end
|
mappings.toggleCurrentLine.description)
|
||||||
''
|
(mkLznExprBinding ["n"] cfg.mappings.toggleCurrentBlock ''
|
||||||
mappings.toggleCurrentLine.description)
|
function()
|
||||||
(mkLznExprBinding ["n"] cfg.mappings.toggleCurrentBlock ''
|
return vim.api.nvim_get_vvar('count') == 0 and '<Plug>(comment_toggle_blockwise_current)'
|
||||||
function()
|
or '<Plug>(comment_toggle_blockwise_count)'
|
||||||
return vim.api.nvim_get_vvar('count') == 0 and '<Plug>(comment_toggle_blockwise_current)'
|
end
|
||||||
or '<Plug>(comment_toggle_blockwise_count)'
|
''
|
||||||
end
|
mappings.toggleCurrentBlock.description)
|
||||||
''
|
(mkLznBinding ["x"] cfg.mappings.toggleSelectedLine "<Plug>(comment_toggle_linewise_visual)" mappings.toggleSelectedLine.description)
|
||||||
mappings.toggleCurrentBlock.description)
|
(mkLznBinding ["x"] cfg.mappings.toggleSelectedBlock "<Plug>(comment_toggle_blockwise_visual)" mappings.toggleSelectedBlock.description)
|
||||||
(mkLznBinding ["x"] cfg.mappings.toggleSelectedLine "<Plug>(comment_toggle_linewise_visual)" mappings.toggleSelectedLine.description)
|
];
|
||||||
(mkLznBinding ["x"] cfg.mappings.toggleSelectedBlock "<Plug>(comment_toggle_blockwise_visual)" mappings.toggleSelectedBlock.description)
|
};
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,17 +6,13 @@
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings;
|
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
|
|
||||||
cfg = config.vim.autocomplete.nvim-cmp;
|
cfg = config.vim.autocomplete.nvim-cmp;
|
||||||
luasnipEnable = config.vim.snippets.luasnip.enable;
|
luasnipEnable = config.vim.snippets.luasnip.enable;
|
||||||
|
inherit (cfg) mappings;
|
||||||
self = import ./nvim-cmp.nix {inherit lib config;};
|
|
||||||
mappingDefinitions = self.options.vim.autocomplete.nvim-cmp.mappings;
|
|
||||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
|
@ -45,39 +41,20 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginRC.nvim-cmp = mkIf cfg.enable (entryAfter ["autopairs" "luasnip"] ''
|
pluginRC.nvim-cmp = mkIf cfg.enable (entryAfter ["autopairs" "luasnip"] ''
|
||||||
local luasnip = require("luasnip")
|
${optionalString luasnipEnable "local luasnip = require('luasnip')"}
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
cmp.setup(${toLuaObject cfg.setupOpts})
|
cmp.setup(${toLuaObject cfg.setupOpts})
|
||||||
'');
|
'');
|
||||||
|
|
||||||
# `cmp` and `luasnip` are defined above, in the `nvim-cmp` section
|
# `cmp` and `luasnip` are defined above, in the `nvim-cmp` section
|
||||||
autocomplete.nvim-cmp.setupOpts.mapping = {
|
autocomplete.nvim-cmp.setupOpts.mapping = {
|
||||||
${mappings.complete.value} = mkLuaInline "cmp.mapping.complete()";
|
${mappings.complete} = mkLuaInline "cmp.mapping.complete()";
|
||||||
${mappings.close.value} = mkLuaInline "cmp.mapping.abort()";
|
${mappings.close} = mkLuaInline "cmp.mapping.abort()";
|
||||||
${mappings.scrollDocsUp.value} = mkLuaInline "cmp.mapping.scroll_docs(-4)";
|
${mappings.scrollDocsUp} = mkLuaInline "cmp.mapping.scroll_docs(-4)";
|
||||||
${mappings.scrollDocsDown.value} = mkLuaInline "cmp.mapping.scroll_docs(4)";
|
${mappings.scrollDocsDown} = mkLuaInline "cmp.mapping.scroll_docs(4)";
|
||||||
|
${mappings.confirm} = mkLuaInline "cmp.mapping.confirm({ select = true })";
|
||||||
|
|
||||||
${mappings.confirm.value} = mkLuaInline ''
|
${mappings.next} = mkLuaInline ''
|
||||||
cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
${
|
|
||||||
if luasnipEnable
|
|
||||||
then ''
|
|
||||||
if luasnip.expandable() then
|
|
||||||
luasnip.expand()
|
|
||||||
else
|
|
||||||
cmp.confirm({ select = true })
|
|
||||||
end
|
|
||||||
''
|
|
||||||
else "cmp.confirm({ select = true })"
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
'';
|
|
||||||
|
|
||||||
${mappings.next.value} = mkLuaInline ''
|
|
||||||
cmp.mapping(function(fallback)
|
cmp.mapping(function(fallback)
|
||||||
local has_words_before = function()
|
local has_words_before = function()
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
|
@ -98,7 +75,7 @@ in {
|
||||||
end)
|
end)
|
||||||
'';
|
'';
|
||||||
|
|
||||||
${mappings.previous.value} = mkLuaInline ''
|
${mappings.previous} = mkLuaInline ''
|
||||||
cmp.mapping(function(fallback)
|
cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
|
|
|
@ -54,17 +54,15 @@ in {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["nvim-nio"];
|
startPlugins = ["nvim-nio"];
|
||||||
|
|
||||||
lazy.plugins = [
|
lazy.plugins.nvim-dap-ui = {
|
||||||
{
|
package = "nvim-dap-ui";
|
||||||
package = "nvim-dap-ui";
|
setupModule = "dapui";
|
||||||
setupModule = "dapui";
|
setupOpts = {};
|
||||||
setupOpts = {};
|
|
||||||
|
|
||||||
keys = [
|
keys = [
|
||||||
(mkSetLuaLznBinding mappings.toggleDapUI "function() require('dapui').toggle() end")
|
(mkSetLuaLznBinding mappings.toggleDapUI "function() require('dapui').toggle() end")
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
|
||||||
pluginRC.nvim-dap-ui = entryAfter ["nvim-dap"] (
|
pluginRC.nvim-dap-ui = entryAfter ["nvim-dap"] (
|
||||||
optionalString cfg.ui.autoStart ''
|
optionalString cfg.ui.autoStart ''
|
||||||
|
|
|
@ -14,19 +14,15 @@ in {
|
||||||
"plenary-nvim" # commons library
|
"plenary-nvim" # commons library
|
||||||
"image-nvim" # optional for image previews
|
"image-nvim" # optional for image previews
|
||||||
"nui-nvim" # ui library
|
"nui-nvim" # ui library
|
||||||
# neotree
|
|
||||||
"neo-tree-nvim"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
lazy.plugins = [
|
lazy.plugins.neo-tree-nvim = {
|
||||||
{
|
package = "neo-tree-nvim";
|
||||||
package = "neo-tree-nvim";
|
setupModule = "neo-tree";
|
||||||
setupModule = "neo-tree";
|
inherit (cfg) setupOpts;
|
||||||
inherit (cfg) setupOpts;
|
|
||||||
|
|
||||||
cmd = ["Neotree"];
|
cmd = ["Neotree"];
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
|
||||||
visuals.nvimWebDevicons.enable = true;
|
visuals.nvimWebDevicons.enable = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
inherit (self.options.vim.filetree.nvimTree) mappings;
|
inherit (self.options.vim.filetree.nvimTree) mappings;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.binds.whichKey.register = pushDownDefault {
|
vim = {
|
||||||
"<leader>t" = "+NvimTree";
|
binds.whichKey.register = pushDownDefault {
|
||||||
};
|
"<leader>t" = "+NvimTree";
|
||||||
|
};
|
||||||
|
|
||||||
vim.lazy.plugins = [
|
lazy.plugins.nvim-tree-lua = {
|
||||||
{
|
|
||||||
package = "nvim-tree-lua";
|
package = "nvim-tree-lua";
|
||||||
setupModule = "nvim-tree";
|
setupModule = "nvim-tree";
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
|
@ -31,58 +31,58 @@ in {
|
||||||
(mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
(mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
||||||
(mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
(mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
|
||||||
vim.pluginRC.nvimtreelua = entryAnywhere ''
|
pluginRC.nvimtreelua = entryAnywhere ''
|
||||||
${
|
${
|
||||||
optionalString cfg.setupOpts.disable_netrw ''
|
optionalString cfg.setupOpts.disable_netrw ''
|
||||||
-- disable netrew completely
|
-- disable netrew completely
|
||||||
vim.g.loaded_netrw = 1
|
vim.g.loaded_netrw = 1
|
||||||
vim.g.loaded_netrwPlugin = 1
|
vim.g.loaded_netrwPlugin = 1
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
|
|
||||||
${
|
${
|
||||||
optionalString cfg.openOnSetup ''
|
optionalString cfg.openOnSetup ''
|
||||||
${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
|
${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
|
||||||
-- autostart behaviour
|
-- autostart behaviour
|
||||||
-- Open on startup has been deprecated
|
-- Open on startup has been deprecated
|
||||||
-- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
|
-- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
|
||||||
|
|
||||||
-- use a nix eval to dynamically insert the open on startup function
|
-- use a nix eval to dynamically insert the open on startup function
|
||||||
local function open_nvim_tree(data)
|
local function open_nvim_tree(data)
|
||||||
local IGNORED_FT = {
|
local IGNORED_FT = {
|
||||||
"markdown",
|
"markdown",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- buffer is a real file on the disk
|
-- buffer is a real file on the disk
|
||||||
local real_file = vim.fn.filereadable(data.file) == 1
|
local real_file = vim.fn.filereadable(data.file) == 1
|
||||||
|
|
||||||
-- buffer is a [No Name]
|
-- buffer is a [No Name]
|
||||||
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
||||||
|
|
||||||
-- &ft
|
-- &ft
|
||||||
local filetype = vim.bo[data.buf].ft
|
local filetype = vim.bo[data.buf].ft
|
||||||
|
|
||||||
-- only files please
|
-- only files please
|
||||||
if not real_file and not no_name then
|
if not real_file and not no_name then
|
||||||
return
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- skip ignored filetypes
|
||||||
|
if vim.tbl_contains(IGNORED_FT, filetype) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- open the tree but don't focus it
|
||||||
|
require("nvim-tree.api").tree.toggle({ focus = false })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- skip ignored filetypes
|
-- function to automatically open the tree on VimEnter
|
||||||
if vim.tbl_contains(IGNORED_FT, filetype) then
|
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
||||||
return
|
''
|
||||||
end
|
}
|
||||||
|
'';
|
||||||
-- open the tree but don't focus it
|
};
|
||||||
require("nvim-tree.api").tree.toggle({ focus = false })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- function to automatically open the tree on VimEnter
|
|
||||||
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
|
||||||
''
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ in {
|
||||||
./css.nix
|
./css.nix
|
||||||
./elixir.nix
|
./elixir.nix
|
||||||
./go.nix
|
./go.nix
|
||||||
|
./kotlin.nix
|
||||||
./html.nix
|
./html.nix
|
||||||
./java.nix
|
./java.nix
|
||||||
./lua.nix
|
./lua.nix
|
||||||
|
@ -19,6 +20,7 @@ in {
|
||||||
./python.nix
|
./python.nix
|
||||||
./r.nix
|
./r.nix
|
||||||
./rust.nix
|
./rust.nix
|
||||||
|
./scala.nix
|
||||||
./sql.nix
|
./sql.nix
|
||||||
./svelte.nix
|
./svelte.nix
|
||||||
./tailwind.nix
|
./tailwind.nix
|
||||||
|
|
107
modules/plugins/languages/kotlin.nix
Normal file
107
modules/plugins/languages/kotlin.nix
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||||
|
inherit (lib.types) package;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.kotlin;
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["ktlint"];
|
||||||
|
diagnosticsProviders = {
|
||||||
|
ktlint = {
|
||||||
|
package = pkgs.ktlint;
|
||||||
|
nullConfig = pkg: ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.diagnostics.ktlint.with({
|
||||||
|
command = "${getExe pkg}",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.kotlin = {
|
||||||
|
enable = mkEnableOption "Kotlin/HCL support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Kotlin treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "kotlin";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "Kotlin LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "kotlin_language_server package with Kotlin runtime";
|
||||||
|
type = package;
|
||||||
|
example = literalExpression ''
|
||||||
|
pkgs.symlinkJoin {
|
||||||
|
name = "kotlin-language-server-wrapped";
|
||||||
|
paths = [pkgs.kotlin-language-server];
|
||||||
|
nativeBuildInputs = [pkgs.makeWrapper];
|
||||||
|
postBuild = '''
|
||||||
|
wrapProgram $out/bin/kotlin-language-server \
|
||||||
|
--prefix PATH : ''${pkgs.kotlin}/bin
|
||||||
|
''';
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
default = pkgs.kotlin-language-server;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extraDiagnostics = {
|
||||||
|
enable = mkEnableOption "extra Kotlin diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||||
|
|
||||||
|
types = diagnostics {
|
||||||
|
langDesc = "Kotlin";
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
inherit defaultDiagnosticsProvider;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||||
|
lang = "kotlin";
|
||||||
|
config = cfg.extraDiagnostics.types;
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.kotlin_language_server = ''
|
||||||
|
lspconfig.kotlin_language_server.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
root_dir = lspconfig.util.root_pattern("main.kt", ".git"),
|
||||||
|
on_attach=default_on_attach,
|
||||||
|
init_options = {
|
||||||
|
-- speeds up the startup time for the LSP
|
||||||
|
storagePath = vim.fn.stdpath('state') .. '/kotlin',
|
||||||
|
},
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${cfg.lsp.package}/bin/kotlin-language-server"}''
|
||||||
|
},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
149
modules/plugins/languages/scala.nix
Normal file
149
modules/plugins/languages/scala.nix
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption luaInline;
|
||||||
|
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
|
||||||
|
inherit (lib.strings) optionalString;
|
||||||
|
inherit (lib.types) attrsOf anything bool;
|
||||||
|
|
||||||
|
listCommandsAction =
|
||||||
|
if config.vim.telescope.enable
|
||||||
|
then ''require("telescope").extensions.metals.commands()''
|
||||||
|
else ''require("metals").commands()'';
|
||||||
|
|
||||||
|
cfg = config.vim.languages.scala;
|
||||||
|
|
||||||
|
usingDap = config.vim.debugger.nvim-dap.enable && cfg.dap.enable;
|
||||||
|
usingLualine = config.vim.statusline.lualine.enable;
|
||||||
|
in {
|
||||||
|
options.vim.languages.scala = {
|
||||||
|
enable = mkEnableOption "Scala language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Scala treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "scala";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "Scala LSP support (metals)" // {default = config.vim.languages.enableLSP;};
|
||||||
|
package = mkPackageOption pkgs "metals" {
|
||||||
|
default = ["metals"];
|
||||||
|
};
|
||||||
|
|
||||||
|
extraMappings = {
|
||||||
|
listCommands = mkMappingOption "List Metals commands" "<leader>lc";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraSettings = mkOption {
|
||||||
|
type = attrsOf anything;
|
||||||
|
description = "Extra settings passed to the metals config. Check nvim-metals docs for available options";
|
||||||
|
default = {
|
||||||
|
showImplicitArguments = true;
|
||||||
|
showImplicitConversionsAndClasses = true;
|
||||||
|
showInferredType = true;
|
||||||
|
excludedPackages = [
|
||||||
|
"akka.actor.typed.javadsl"
|
||||||
|
"com.github.swagger.akka.javadsl"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
dap = {
|
||||||
|
enable = mkEnableOption "Scala Debug Adapter support (metals)" // {default = config.vim.languages.enableDAP;};
|
||||||
|
config = mkOption {
|
||||||
|
description = "Lua configuration for dap";
|
||||||
|
type = luaInline;
|
||||||
|
default = mkLuaInline ''
|
||||||
|
dap.configurations.scala = {
|
||||||
|
{
|
||||||
|
type = "scala",
|
||||||
|
request = "launch",
|
||||||
|
name = "RunOrTest",
|
||||||
|
metals = {
|
||||||
|
runType = "runOrTestFile",
|
||||||
|
--args = { "firstArg", "secondArg", "thirdArg" }, -- here just as an example
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "scala",
|
||||||
|
request = "launch",
|
||||||
|
name = "Test Target",
|
||||||
|
metals = {
|
||||||
|
runType = "testTarget",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fixShortmess = mkOption {
|
||||||
|
type = bool;
|
||||||
|
description = "Remove the 'F' flag from shortmess to allow messages to be shown. Without doing this, autocommands that deal with filetypes prohibit messages from being shown";
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (
|
||||||
|
mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["nvim-metals"];
|
||||||
|
pluginRC.nvim-metals = entryAfter ["lsp-setup"] ''
|
||||||
|
local metals_caps = capabilities -- from lsp-setup
|
||||||
|
|
||||||
|
local attach_metals_keymaps = function(client, bufnr)
|
||||||
|
attach_keymaps(client, bufnr) -- from lsp-setup
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '${cfg.lsp.extraMappings.listCommands}', '<cmd>lua ${listCommandsAction}<CR>', {noremap=true, silent=true, desc='Show all Metals commands'})
|
||||||
|
end
|
||||||
|
|
||||||
|
metals_config = require('metals').bare_config()
|
||||||
|
${optionalString usingLualine "metals_config.init_options.statusBarProvider = 'on'"}
|
||||||
|
|
||||||
|
metals_config.capabilities = metals_caps
|
||||||
|
metals_config.on_attach = function(client, bufnr)
|
||||||
|
${optionalString usingDap "require('metals').setup_dap()"}
|
||||||
|
attach_metals_keymaps(client, bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
metals_config.settings = ${toLuaObject cfg.lsp.extraSettings}
|
||||||
|
metals_config.settings.metalsBinaryPath = "${cfg.lsp.package}/bin/metals"
|
||||||
|
|
||||||
|
metals_config.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||||
|
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
virtual_text = {
|
||||||
|
prefix = '⚠',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
${optionalString cfg.fixShortmess ''vim.opt_global.shortmess:remove("F")''}
|
||||||
|
|
||||||
|
local lsp_group = vim.api.nvim_create_augroup('lsp', { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
group = lsp_group,
|
||||||
|
pattern = {'java', 'scala', 'sbt'},
|
||||||
|
callback = function()
|
||||||
|
require('metals').initialize_or_attach(metals_config)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
|
@ -14,23 +14,21 @@
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
||||||
vim = {
|
vim = {
|
||||||
lazy.plugins = [
|
lazy.plugins.trouble = {
|
||||||
{
|
package = "trouble";
|
||||||
package = "trouble";
|
setupModule = "trouble";
|
||||||
setupModule = "trouble";
|
inherit (cfg.trouble) setupOpts;
|
||||||
inherit (cfg.trouble) setupOpts;
|
|
||||||
|
|
||||||
cmd = "Trouble";
|
cmd = "Trouble";
|
||||||
keys = [
|
keys = [
|
||||||
(mkSetLznBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
(mkSetLznBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
||||||
(mkSetLznBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
(mkSetLznBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
||||||
(mkSetLznBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
(mkSetLznBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
||||||
(mkSetLznBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
(mkSetLznBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
||||||
(mkSetLznBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
(mkSetLznBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
||||||
(mkSetLznBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
(mkSetLznBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
|
||||||
binds.whichKey.register = pushDownDefault {
|
binds.whichKey.register = pushDownDefault {
|
||||||
"<leader>l" = "Trouble";
|
"<leader>l" = "Trouble";
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
./obsidian
|
./obsidian
|
||||||
./orgmode
|
./orgmode
|
||||||
|
./neorg
|
||||||
./mind-nvim
|
./mind-nvim
|
||||||
./todo-comments
|
./todo-comments
|
||||||
];
|
];
|
||||||
|
|
41
modules/plugins/notes/neorg/config.nix
Normal file
41
modules/plugins/notes/neorg/config.nix
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.binds) pushDownDefault;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
|
cfg = config.vim.notes.neorg;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
{
|
||||||
|
vim = {
|
||||||
|
startPlugins = [
|
||||||
|
"lua-utils-nvim"
|
||||||
|
"nui-nvim"
|
||||||
|
"nvim-nio"
|
||||||
|
"pathlib-nvim"
|
||||||
|
"plenary-nvim"
|
||||||
|
"neorg"
|
||||||
|
"neorg-telescope"
|
||||||
|
];
|
||||||
|
|
||||||
|
binds.whichKey.register = pushDownDefault {
|
||||||
|
"<leader>o" = "+Notes";
|
||||||
|
};
|
||||||
|
|
||||||
|
pluginRC.neorg = entryAnywhere ''
|
||||||
|
require('neorg').setup(${toLuaObject cfg.setupOpts})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.norgPackage];
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
6
modules/plugins/notes/neorg/default.nix
Normal file
6
modules/plugins/notes/neorg/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./neorg.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
50
modules/plugins/notes/neorg/neorg.nix
Normal file
50
modules/plugins/notes/neorg/neorg.nix
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) submodule listOf str;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||||
|
in {
|
||||||
|
options.vim.notes.neorg = {
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
Neorg: An intuitive note-taking and organization tool with a structured nested syntax.
|
||||||
|
'';
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "Neorg" {
|
||||||
|
load = {
|
||||||
|
"core.defaults" = mkOption {
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
all of the most important modules that any user would want to have a "just works" experience
|
||||||
|
'';
|
||||||
|
|
||||||
|
type = submodule {
|
||||||
|
options = {
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
all of the most important modules that any user would want to have a "just works" experience
|
||||||
|
'';
|
||||||
|
config = {
|
||||||
|
disable = mkOption {
|
||||||
|
description = ''
|
||||||
|
list of modules from to be disabled from core.defaults
|
||||||
|
'';
|
||||||
|
type = listOf str;
|
||||||
|
default = [];
|
||||||
|
example = ["core.autocommands" "core.itero"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Neorg treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
norgPackage = mkGrammarOption pkgs "norg";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -14,39 +14,37 @@
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
lazy.plugins = [
|
lazy.plugins.toggleterm-nvim = {
|
||||||
{
|
package = "toggleterm-nvim";
|
||||||
package = "toggleterm-nvim";
|
cmd = ["ToggleTerm" "ToggleTermSendCurrentLine" "ToggleTermSendVisualLines" "ToggleTermSendVisualSelection" "ToggleTermSetName" "ToggleTermToggleAll"];
|
||||||
cmd = ["ToggleTerm" "ToggleTermSendCurrentLine" "ToggleTermSendVisualLines" "ToggleTermSendVisualSelection" "ToggleTermSetName" "ToggleTermToggleAll"];
|
keys = [
|
||||||
keys = [
|
(mkLznBinding ["n"] cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal")
|
||||||
(mkLznBinding ["n"] cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal")
|
{
|
||||||
{
|
key = cfg.lazygit.mappings.open;
|
||||||
key = cfg.lazygit.mappings.open;
|
desc = lazygitMapDesc;
|
||||||
desc = lazygitMapDesc;
|
}
|
||||||
}
|
];
|
||||||
];
|
|
||||||
|
|
||||||
setupModule = "toggleterm";
|
setupModule = "toggleterm";
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
after = optionalString cfg.lazygit.enable ''
|
after = optionalString cfg.lazygit.enable ''
|
||||||
local terminal = require 'toggleterm.terminal'
|
local terminal = require 'toggleterm.terminal'
|
||||||
local lazygit = terminal.Terminal:new({
|
local lazygit = terminal.Terminal:new({
|
||||||
cmd = '${
|
cmd = '${
|
||||||
if (cfg.lazygit.package != null)
|
if (cfg.lazygit.package != null)
|
||||||
then getExe cfg.lazygit.package
|
then getExe cfg.lazygit.package
|
||||||
else "lazygit"
|
else "lazygit"
|
||||||
}',
|
}',
|
||||||
direction = '${cfg.lazygit.direction}',
|
direction = '${cfg.lazygit.direction}',
|
||||||
hidden = true,
|
hidden = true,
|
||||||
on_open = function(term)
|
on_open = function(term)
|
||||||
vim.cmd("startinsert!")
|
vim.cmd("startinsert!")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set('n', ${toJSON cfg.lazygit.mappings.open}, function() lazygit:toggle() end, {silent = true, noremap = true, desc = '${lazygitMapDesc}'})
|
vim.keymap.set('n', ${toJSON cfg.lazygit.mappings.open}, function() lazygit:toggle() end, {silent = true, noremap = true, desc = '${lazygitMapDesc}'})
|
||||||
'';
|
'';
|
||||||
}
|
};
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,13 @@
|
||||||
cfg = config.vim.binds.cheatsheet;
|
cfg = config.vim.binds.cheatsheet;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.lazy.plugins = [
|
vim.lazy.plugins.cheatsheet-nvim = {
|
||||||
{
|
package = "cheatsheet-nvim";
|
||||||
package = "cheatsheet-nvim";
|
setupModule = "cheatsheet";
|
||||||
setupModule = "cheatsheet";
|
setupOpts = {};
|
||||||
setupOpts = {};
|
cmd = ["Cheatsheet" "CheatsheetEdit"];
|
||||||
cmd = ["Cheatsheet" "CheatsheetEdit"];
|
|
||||||
|
|
||||||
before = optionalString config.vim.lazy.enable "require('lz.n').trigger_load('telescope')";
|
before = optionalString config.vim.lazy.enable "require('lz.n').trigger_load('telescope')";
|
||||||
}
|
};
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,12 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["plenary-nvim"];
|
startPlugins = ["plenary-nvim"];
|
||||||
lazy.plugins = [
|
lazy.plugins.diffview-nvim = {
|
||||||
{
|
package = "diffview-nvim";
|
||||||
package = "diffview-nvim";
|
cmd = ["DiffviewClose" "DiffviewFileHistory" "DiffviewFocusFiles" "DiffviewLog" "DiffviewOpen" "DiffviewRefresh" "DiffviewToggleFiles"];
|
||||||
cmd = ["DiffviewClose" "DiffviewFileHistory" "DiffviewFocusFiles" "DiffviewLog" "DiffviewOpen" "DiffviewRefresh" "DiffviewToggleFiles"];
|
setupModule = "diffview";
|
||||||
setupModule = "diffview";
|
inherit (cfg) setupOpts;
|
||||||
inherit (cfg) setupOpts;
|
};
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,16 +10,14 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = ["dressing-nvim"];
|
vim.startPlugins = ["dressing-nvim"];
|
||||||
|
|
||||||
vim.lazy.plugins = [
|
vim.lazy.plugins.icon-picker-nvim = {
|
||||||
{
|
package = "icon-picker-nvim";
|
||||||
package = "icon-picker-nvim";
|
setupModule = "icon-picker";
|
||||||
setupModule = "icon-picker";
|
setupOpts = {
|
||||||
setupOpts = {
|
disable_legacy_commands = true;
|
||||||
disable_legacy_commands = true;
|
};
|
||||||
};
|
|
||||||
|
|
||||||
cmd = ["IconPickerInsert" "IconPickerNormal" "IconPickerYank"];
|
cmd = ["IconPickerInsert" "IconPickerNormal" "IconPickerYank"];
|
||||||
}
|
};
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf mkDefault;
|
||||||
inherit (lib.nvim.binds) mkLznBinding;
|
inherit (lib.nvim.binds) mkLznBinding;
|
||||||
|
|
||||||
cfg = config.vim.utility.motion.leap;
|
cfg = config.vim.utility.motion.leap;
|
||||||
|
@ -11,51 +11,51 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["vim-repeat"];
|
startPlugins = ["vim-repeat"];
|
||||||
lazy.plugins = [
|
lazy.plugins.leap-nvim = {
|
||||||
{
|
package = "leap-nvim";
|
||||||
package = "leap-nvim";
|
keys = [
|
||||||
keys = [
|
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
||||||
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
||||||
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapForwardTill "<Plug>(leap-forward-till)" "Leap forward till")
|
||||||
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapForwardTill "<Plug>(leap-forward-till)" "Leap forward till")
|
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapBackwardTill "<Plug>(leap-backward-till)" "Leap backward till")
|
||||||
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapBackwardTill "<Plug>(leap-backward-till)" "Leap backward till")
|
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
||||||
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
];
|
||||||
];
|
|
||||||
|
|
||||||
after = ''
|
after = ''
|
||||||
require('leap').opts = {
|
require('leap').opts = {
|
||||||
max_phase_one_targets = nil,
|
max_phase_one_targets = nil,
|
||||||
highlight_unlabeled_phase_one_targets = false,
|
highlight_unlabeled_phase_one_targets = false,
|
||||||
max_highlighted_traversal_targets = 10,
|
max_highlighted_traversal_targets = 10,
|
||||||
case_sensitive = false,
|
case_sensitive = false,
|
||||||
equivalence_classes = { ' \t\r\n', },
|
equivalence_classes = { ' \t\r\n', },
|
||||||
substitute_chars = {},
|
substitute_chars = {},
|
||||||
safe_labels = {
|
safe_labels = {
|
||||||
"s", "f", "n", "u", "t", "/",
|
"s", "f", "n", "u", "t", "/",
|
||||||
"S", "F", "N", "L", "H", "M", "U", "G", "T", "?", "Z"
|
"S", "F", "N", "L", "H", "M", "U", "G", "T", "?", "Z"
|
||||||
},
|
},
|
||||||
labels = {
|
labels = {
|
||||||
"s", "f", "n",
|
"s", "f", "n",
|
||||||
"j", "k", "l", "h", "o", "d", "w", "e", "m", "b",
|
"j", "k", "l", "h", "o", "d", "w", "e", "m", "b",
|
||||||
"u", "y", "v", "r", "g", "t", "c", "x", "/", "z",
|
"u", "y", "v", "r", "g", "t", "c", "x", "/", "z",
|
||||||
"S", "F", "N",
|
"S", "F", "N",
|
||||||
"J", "K", "L", "H", "O", "D", "W", "E", "M", "B",
|
"J", "K", "L", "H", "O", "D", "W", "E", "M", "B",
|
||||||
"U", "Y", "V", "R", "G", "T", "C", "X", "?", "Z"
|
"U", "Y", "V", "R", "G", "T", "C", "X", "?", "Z"
|
||||||
},
|
},
|
||||||
special_keys = {
|
special_keys = {
|
||||||
repeat_search = '<enter>',
|
repeat_search = '<enter>',
|
||||||
next_phase_one_target = '<enter>',
|
next_phase_one_target = '<enter>',
|
||||||
next_target = {'<enter>', ';'},
|
next_target = {'<enter>', ';'},
|
||||||
prev_target = {'<tab>', ','},
|
prev_target = {'<tab>', ','},
|
||||||
next_group = '<space>',
|
next_group = '<space>',
|
||||||
prev_group = '<tab>',
|
prev_group = '<tab>',
|
||||||
multi_accept = '<enter>',
|
multi_accept = '<enter>',
|
||||||
multi_revert = '<backspace>',
|
multi_revert = '<backspace>',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
binds.whichKey.register."<leader>s" = mkDefault "+Leap";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,22 +9,22 @@ in {
|
||||||
leapForwardTo = mkOption {
|
leapForwardTo = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
description = "Leap forward to";
|
description = "Leap forward to";
|
||||||
default = "s";
|
default = "<leader>ss";
|
||||||
};
|
};
|
||||||
leapBackwardTo = mkOption {
|
leapBackwardTo = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
description = "Leap backward to";
|
description = "Leap backward to";
|
||||||
default = "S";
|
default = "<leader>sS";
|
||||||
};
|
};
|
||||||
leapForwardTill = mkOption {
|
leapForwardTill = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
description = "Leap forward till";
|
description = "Leap forward till";
|
||||||
default = "x";
|
default = "<leader>sx";
|
||||||
};
|
};
|
||||||
leapBackwardTill = mkOption {
|
leapBackwardTill = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
description = "Leap backward till";
|
description = "Leap backward till";
|
||||||
default = "X";
|
default = "<leader>sX";
|
||||||
};
|
};
|
||||||
leapFromWindow = mkOption {
|
leapFromWindow = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
|
|
|
@ -30,26 +30,24 @@ in {
|
||||||
startPlugins = ["nvim-surround"];
|
startPlugins = ["nvim-surround"];
|
||||||
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
|
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
|
||||||
|
|
||||||
lazy.plugins = [
|
lazy.plugins.nvim-surround = {
|
||||||
{
|
package = "nvim-surround";
|
||||||
package = "nvim-surround";
|
setupModule = "nvim-surround";
|
||||||
setupModule = "nvim-surround";
|
inherit (cfg) setupOpts;
|
||||||
inherit (cfg) setupOpts;
|
|
||||||
|
|
||||||
keys =
|
keys =
|
||||||
map (mkLznKey ["i"]) (with vendoredKeybinds; [insert insert_line])
|
map (mkLznKey ["i"]) (with vendoredKeybinds; [insert insert_line])
|
||||||
++ map (mkLznKey ["x"]) (with vendoredKeybinds; [visual visual_line])
|
++ map (mkLznKey ["x"]) (with vendoredKeybinds; [visual visual_line])
|
||||||
++ map (mkLznKey ["n"]) (with vendoredKeybinds; [
|
++ map (mkLznKey ["n"]) (with vendoredKeybinds; [
|
||||||
normal
|
normal
|
||||||
normal_cur
|
normal_cur
|
||||||
normal_line
|
normal_line
|
||||||
normal_cur_line
|
normal_cur_line
|
||||||
delete
|
delete
|
||||||
change
|
change
|
||||||
change_line
|
change_line
|
||||||
]);
|
]);
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
|
||||||
utility.surround.setupOpts.keymaps = mkIf cfg.useVendoredKeybindings vendoredKeybinds;
|
utility.surround.setupOpts.keymaps = mkIf cfg.useVendoredKeybindings vendoredKeybinds;
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,57 +20,55 @@ in {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["plenary-nvim"];
|
startPlugins = ["plenary-nvim"];
|
||||||
|
|
||||||
lazy.plugins = [
|
lazy.plugins.telescope = {
|
||||||
{
|
package = "telescope";
|
||||||
package = "telescope";
|
setupModule = "telescope";
|
||||||
setupModule = "telescope";
|
inherit (cfg) setupOpts;
|
||||||
inherit (cfg) setupOpts;
|
# FIXME: how do I deal with extensions? set all as deps?
|
||||||
# FIXME: how do I deal with extensions? set all as deps?
|
after = ''
|
||||||
after = ''
|
local telescope = require("telescope")
|
||||||
local telescope = require("telescope")
|
${optionalString config.vim.ui.noice.enable "telescope.load_extension('noice')"}
|
||||||
${optionalString config.vim.ui.noice.enable "telescope.load_extension('noice')"}
|
${optionalString config.vim.notify.nvim-notify.enable "telescope.load_extension('notify')"}
|
||||||
${optionalString config.vim.notify.nvim-notify.enable "telescope.load_extension('notify')"}
|
${optionalString config.vim.projects.project-nvim.enable "telescope.load_extension('projects')"}
|
||||||
${optionalString config.vim.projects.project-nvim.enable "telescope.load_extension('projects')"}
|
'';
|
||||||
'';
|
|
||||||
|
|
||||||
cmd = ["Telescope"];
|
cmd = ["Telescope"];
|
||||||
|
|
||||||
keys =
|
keys =
|
||||||
[
|
[
|
||||||
(mkSetLznBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
|
(mkSetLznBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
|
||||||
(mkSetLznBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
(mkSetLznBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
||||||
(mkSetLznBinding mappings.buffers "<cmd> Telescope buffers<CR>")
|
(mkSetLznBinding mappings.buffers "<cmd> Telescope buffers<CR>")
|
||||||
(mkSetLznBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
(mkSetLznBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
||||||
(mkSetLznBinding mappings.open "<cmd> Telescope<CR>")
|
(mkSetLznBinding mappings.open "<cmd> Telescope<CR>")
|
||||||
|
|
||||||
(mkSetLznBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
(mkSetLznBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
||||||
(mkSetLznBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
(mkSetLznBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
||||||
(mkSetLznBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
(mkSetLznBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
||||||
(mkSetLznBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
(mkSetLznBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
||||||
(mkSetLznBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
(mkSetLznBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
||||||
|
]
|
||||||
|
++ (optionals config.vim.lsp.enable [
|
||||||
|
(mkSetLznBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
||||||
|
(mkSetLznBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
||||||
|
|
||||||
|
(mkSetLznBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
||||||
|
(mkSetLznBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
||||||
|
(mkSetLznBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
||||||
|
(mkSetLznBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
||||||
|
(mkSetLznBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
||||||
|
])
|
||||||
|
++ (
|
||||||
|
optionals config.vim.treesitter.enable [
|
||||||
|
(mkSetLznBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
||||||
]
|
]
|
||||||
++ (optionals config.vim.lsp.enable [
|
)
|
||||||
(mkSetLznBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
++ (
|
||||||
(mkSetLznBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
optionals config.vim.projects.project-nvim.enable [
|
||||||
|
(mkSetLznBinding mappings.findProjects "<cmd Telescope projects<CR>")
|
||||||
(mkSetLznBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
]
|
||||||
(mkSetLznBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
);
|
||||||
(mkSetLznBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
};
|
||||||
(mkSetLznBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
|
||||||
(mkSetLznBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
|
||||||
])
|
|
||||||
++ (
|
|
||||||
optionals config.vim.treesitter.enable [
|
|
||||||
(mkSetLznBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
|
||||||
]
|
|
||||||
)
|
|
||||||
++ (
|
|
||||||
optionals config.vim.projects.project-nvim.enable [
|
|
||||||
(mkSetLznBinding mappings.findProjects "<cmd Telescope projects<CR>")
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
binds.whichKey.register = pushDownDefault {
|
binds.whichKey.register = pushDownDefault {
|
||||||
"<leader>f" = "+Telescope";
|
"<leader>f" = "+Telescope";
|
||||||
|
|
|
@ -8,13 +8,11 @@
|
||||||
cfg = config.vim.visuals.fidget-nvim;
|
cfg = config.vim.visuals.fidget-nvim;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.lazy.plugins = [
|
vim.lazy.plugins.fidget-nvim = {
|
||||||
{
|
package = "fidget-nvim";
|
||||||
package = "fidget-nvim";
|
setupModule = "fidget";
|
||||||
setupModule = "fidget";
|
event = "LspAttach";
|
||||||
event = "LspAttach";
|
inherit (cfg) setupOpts;
|
||||||
inherit (cfg) setupOpts;
|
};
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toJSON typeOf head length tryEval filter concatLists concatStringsSep;
|
inherit (builtins) toJSON typeOf head length filter concatLists concatStringsSep;
|
||||||
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
|
@ -21,14 +22,7 @@
|
||||||
else keySpec.action;
|
else keySpec.action;
|
||||||
};
|
};
|
||||||
|
|
||||||
toLuaLznSpec = spec: let
|
toLuaLznSpec = name: spec:
|
||||||
name =
|
|
||||||
if typeOf spec.package == "string"
|
|
||||||
then spec.package
|
|
||||||
else if (spec.package ? pname && (tryEval spec.package.pname).success)
|
|
||||||
then spec.package.pname
|
|
||||||
else spec.package.name;
|
|
||||||
in
|
|
||||||
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
||||||
// {
|
// {
|
||||||
"@1" = name;
|
"@1" = name;
|
||||||
|
@ -62,9 +56,9 @@
|
||||||
# empty list or str or (listOf str)
|
# empty list or str or (listOf str)
|
||||||
else spec.keys;
|
else spec.keys;
|
||||||
};
|
};
|
||||||
lznSpecs = map toLuaLznSpec cfg.plugins;
|
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;
|
||||||
|
|
||||||
specToNotLazyConfig = spec: ''
|
specToNotLazyConfig = _: spec: ''
|
||||||
do
|
do
|
||||||
${optionalString (spec.before != null) spec.before}
|
${optionalString (spec.before != null) spec.before}
|
||||||
${optionalString (spec.setupModule != null)
|
${optionalString (spec.setupModule != null)
|
||||||
|
@ -73,34 +67,32 @@
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
specToKeymaps = spec:
|
specToKeymaps = _: spec:
|
||||||
if typeOf spec.keys == "list"
|
if typeOf spec.keys == "list"
|
||||||
then map (x: removeAttrs x ["ft"]) (filter (lznKey: lznKey.action != null && lznKey.ft == null) spec.keys)
|
then map (x: removeAttrs x ["ft"]) (filter (lznKey: lznKey.action != null && lznKey.ft == null) spec.keys)
|
||||||
else if spec.keys == null || typeOf spec.keys == "string"
|
else if spec.keys == null || typeOf spec.keys == "string"
|
||||||
then []
|
then []
|
||||||
else [spec.keys];
|
else [spec.keys];
|
||||||
|
|
||||||
notLazyConfig = concatStringsSep "\n" (map specToNotLazyConfig cfg.plugins);
|
notLazyConfig = concatStringsSep "\n" (mapAttrsToList specToNotLazyConfig cfg.plugins);
|
||||||
in {
|
in {
|
||||||
config.vim = mkMerge [
|
config.vim = mkMerge [
|
||||||
(mkIf cfg.enable {
|
(mkIf cfg.enable {
|
||||||
startPlugins = ["lz-n" "lzn-auto-require"];
|
startPlugins = ["lz-n" "lzn-auto-require"];
|
||||||
|
|
||||||
optPlugins = map (plugin: plugin.package) cfg.plugins;
|
optPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
|
||||||
|
|
||||||
luaConfigRC.lzn-load = entryBefore ["pluginConfigs"] ''
|
luaConfigRC.lzn-load = entryBefore ["pluginConfigs"] ''
|
||||||
require('lz.n').load(${toLuaObject lznSpecs})
|
require('lz.n').load(${toLuaObject lznSpecs})
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
(
|
(mkIf (!cfg.enable) {
|
||||||
mkIf (!cfg.enable) {
|
startPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
|
||||||
startPlugins = map (plugin: plugin.package) cfg.plugins;
|
luaConfigPre =
|
||||||
luaConfigPre =
|
concatStringsSep "\n"
|
||||||
concatStringsSep "\n"
|
(filter (x: x != null) (mapAttrsToList (_: spec: spec.beforeAll) cfg.plugins));
|
||||||
(filter (x: x != null) (map (spec: spec.beforeAll) cfg.plugins));
|
luaConfigRC.unlazy = entryAfter ["pluginConfigs"] notLazyConfig;
|
||||||
luaConfigRC.unlazy = entryAfter ["pluginConfigs"] notLazyConfig;
|
keymaps = concatLists (mapAttrsToList specToKeymaps cfg.plugins);
|
||||||
keymaps = concatLists (map specToKeymaps cfg.plugins);
|
})
|
||||||
}
|
|
||||||
)
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,19 +188,29 @@ in {
|
||||||
|
|
||||||
plugins = mkOption {
|
plugins = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
type = listOf lznPluginType;
|
type = attrsOf lznPluginType;
|
||||||
description = "list of plugins to lazy load";
|
description = ''
|
||||||
|
Plugins to lazy load.
|
||||||
|
|
||||||
|
The attribute key is used as the plugin name: for the default `vim.g.lz_n.load`
|
||||||
|
function this should be either the `package.pname` or `package.name`.
|
||||||
|
'';
|
||||||
example = ''
|
example = ''
|
||||||
[
|
{
|
||||||
{
|
toggleterm-nvim = {
|
||||||
package = "toggleterm-nvim";
|
package = "toggleterm-nvim";
|
||||||
setupModule = "toggleterm";
|
setupModule = "toggleterm";
|
||||||
setupOpts = cfg.setupOpts;
|
setupOpts = cfg.setupOpts;
|
||||||
|
|
||||||
after = "require('toggleterm').do_something()";
|
after = "require('toggleterm').do_something()";
|
||||||
cmd = ["ToggleTerm"];
|
cmd = ["ToggleTerm"];
|
||||||
}
|
};
|
||||||
]
|
|
||||||
|
$${pkgs.vimPlugins.vim-bbye.pname} = {
|
||||||
|
package = pkgs.vimPlugins.vim-bbye;
|
||||||
|
cmd = ["Bdelete" "Bwipeout"];
|
||||||
|
};
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,27 +3,18 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkRemovedOptionModule;
|
|
||||||
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.types) str attrs lines listOf either path bool;
|
inherit (lib.types) str attrs lines listOf either path;
|
||||||
inherit (lib.nvim.types) dagOf;
|
inherit (lib.nvim.types) dagOf;
|
||||||
inherit (lib.nvim.lua) listToLuaTable;
|
inherit (lib.nvim.lua) listToLuaTable;
|
||||||
|
|
||||||
cfg = config.vim;
|
cfg = config.vim;
|
||||||
in {
|
in {
|
||||||
imports = [
|
|
||||||
(mkRemovedOptionModule ["vim" "configRC"] ''
|
|
||||||
Please migrate your configRC sections to Neovim's Lua format, and
|
|
||||||
add them to luaConfigRC.
|
|
||||||
|
|
||||||
See the v0.7 release notes for more information on how to migrate
|
|
||||||
your existing configurations.
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
|
|
||||||
options.vim = {
|
options.vim = {
|
||||||
enableLuaLoader = mkEnableOption ''
|
enableLuaLoader = mkEnableOption ''
|
||||||
|
[{option}`official documentation`]: https://neovim.io/doc/user/lua.html#vim.loader.enable()
|
||||||
|
|
||||||
the experimental Lua module loader to speed up the start up process
|
the experimental Lua module loader to speed up the start up process
|
||||||
|
|
||||||
If `true`, this will enable the experimental Lua module loader which:
|
If `true`, this will enable the experimental Lua module loader which:
|
||||||
|
@ -32,30 +23,12 @@ in {
|
||||||
- adds the libs loader
|
- adds the libs loader
|
||||||
- removes the default Neovim loader
|
- removes the default Neovim loader
|
||||||
|
|
||||||
|
::: {.note}
|
||||||
This is disabled by default. Before setting this option, please
|
This is disabled by default. Before setting this option, please
|
||||||
take a look at the [{option}`official documentation`](https://neovim.io/doc/user/lua.html#vim.loader.enable()).
|
take a look at the [{option}`official documentation`].
|
||||||
|
:::
|
||||||
'';
|
'';
|
||||||
|
|
||||||
disableDefaultRuntimePaths = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
example = false;
|
|
||||||
description = ''
|
|
||||||
Disables the default runtime paths that are set by Neovim
|
|
||||||
when it starts up. This is useful when you want to have
|
|
||||||
full control over the runtime paths that are set by Neovim.
|
|
||||||
|
|
||||||
::: {.note}
|
|
||||||
To avoid leaking imperative user configuration into your
|
|
||||||
configuration, this is enabled by default. If you wish
|
|
||||||
to load configuration from user configuration directories
|
|
||||||
(e.g. {file}`$HOME/.config/nvim`, {file}`$HOME/.config/nvim/after`
|
|
||||||
and {file}`$HOME/.local/share/nvim/site`) you may set this
|
|
||||||
option to true.
|
|
||||||
:::
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
additionalRuntimePaths = mkOption {
|
additionalRuntimePaths = mkOption {
|
||||||
type = listOf (either path str);
|
type = listOf (either path str);
|
||||||
default = [];
|
default = [];
|
||||||
|
@ -180,21 +153,6 @@ in {
|
||||||
vim.opt.runtimepath:append(${listToLuaTable cfg.additionalRuntimePaths})
|
vim.opt.runtimepath:append(${listToLuaTable cfg.additionalRuntimePaths})
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString cfg.disableDefaultRuntimePaths ''
|
|
||||||
-- Remove default user runtime paths from the
|
|
||||||
-- `runtimepath` option to avoid leaking user configuration
|
|
||||||
-- into the final neovim wrapper
|
|
||||||
local defaultRuntimePaths = {
|
|
||||||
vim.fn.stdpath('config'), -- $HOME/.config/nvim
|
|
||||||
vim.fn.stdpath('config') .. "/after", -- $HOME/.config/nvim/after
|
|
||||||
vim.fn.stdpath('data') .. "/site", -- $HOME/.local/share/nvim/site
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, path in ipairs(defaultRuntimePaths) do
|
|
||||||
vim.opt.runtimepath:remove(path)
|
|
||||||
end
|
|
||||||
''}
|
|
||||||
|
|
||||||
${optionalString cfg.enableLuaLoader "vim.loader.enable()"}
|
${optionalString cfg.enableLuaLoader "vim.loader.enable()"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue