mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-02-04 10:55:50 +00:00
Merge branch 'main' into languages/fish
This commit is contained in:
commit
b7f891c533
17 changed files with 290 additions and 24 deletions
|
|
@ -72,6 +72,7 @@ isMaximal: {
|
|||
extensions.crates-nvim.enable = isMaximal;
|
||||
};
|
||||
toml.enable = isMaximal;
|
||||
xml.enable = isMaximal;
|
||||
|
||||
# Language modules that are not as common.
|
||||
assembly.enable = false;
|
||||
|
|
@ -93,9 +94,11 @@ isMaximal: {
|
|||
just.enable = false;
|
||||
qml.enable = false;
|
||||
fish.enable = false;
|
||||
jinja.enable = false;
|
||||
|
||||
tailwind.enable = false;
|
||||
svelte.enable = false;
|
||||
tera.enable = false;
|
||||
|
||||
# Nim LSP is broken on Darwin and therefore
|
||||
# should be disabled by default. Users may still enable
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ configuring/custom-package.md
|
|||
configuring/custom-plugins.md
|
||||
configuring/overriding-plugins.md
|
||||
configuring/languages.md
|
||||
configuring/keybinds.md
|
||||
configuring/dags.md
|
||||
configuring/dag-entries.md
|
||||
configuring/autocmds.md
|
||||
|
|
|
|||
38
docs/manual/configuring/keybinds.md
Normal file
38
docs/manual/configuring/keybinds.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# Custom keymaps {#ch-keymaps}
|
||||
|
||||
Some plugin modules provide keymap options for your convenience. If a keymap is
|
||||
not provided by such module options, you may easily register your own custom
|
||||
keymaps via {option}`vim.keymaps`.
|
||||
|
||||
```nix
|
||||
{
|
||||
config.vim.keymaps = [
|
||||
{
|
||||
key = "<leader>m";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = ":make<CR>";
|
||||
}
|
||||
{
|
||||
key = "<leader>l";
|
||||
mode = ["n" "x"];
|
||||
silent = true;
|
||||
action = "<cmd>cnext<CR>";
|
||||
}
|
||||
{
|
||||
key = "<leader>k";
|
||||
mode = ["n" "x"];
|
||||
|
||||
# While `lua` is `true`, `action` is expected to be
|
||||
# a valid Lua expression.
|
||||
lua = true;
|
||||
action = ''
|
||||
function()
|
||||
require('foo').do_thing()
|
||||
print('did thing')
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
|
|
@ -21,3 +21,43 @@ vim.languages.java = {
|
|||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Custom LSP Servers {#ch-custom-lsp-servers}
|
||||
|
||||
Neovim 0.11, in an effort to improve the out-of-the-box experience of Neovim,
|
||||
has introduced a new `vim.lsp` API that can be used to register custom LSP
|
||||
servers with ease. In **nvf**, this translates to the custom `vim.lsp` API that
|
||||
can be used to register servers that are not present in existing language
|
||||
modules.
|
||||
|
||||
The {option}`vim.lsp.servers` submodule can be used to modify existing LSP
|
||||
definitions OR register your own custom LSPs respectively. For example, if you'd
|
||||
like to avoid having NVF pull the LSP packages you may modify the start command
|
||||
to use a string, which will cause the LSP API to discover LSP servers from
|
||||
{env}`PATH`. For example:
|
||||
|
||||
```nix
|
||||
{lib, ...}: {
|
||||
vim.lsp.servers = {
|
||||
# Get `basedpyright-langserver` from PATH, e.g., a dev shell.
|
||||
basedpyright.cmd = lib.mkForce ["basedpyright-langserver" "--stdio"];
|
||||
|
||||
# Define a custom LSP entry using `vim.lsp.servers`:
|
||||
ty = {
|
||||
cmd = lib.mkDefault [(lib.getExe pkgs.ty) "server"];
|
||||
filetypes = ["python"];
|
||||
root_markers = [
|
||||
".git"
|
||||
"pyproject.toml"
|
||||
"setup.cfg"
|
||||
"requirements.txt"
|
||||
"Pipfile"
|
||||
"pyrightconfig.json"
|
||||
];
|
||||
|
||||
# If your LSP accepts custom settings. See `:help lsp-config` for more details
|
||||
# on available fields. This is a freeform field.
|
||||
settings.ty = { /* ... */ };
|
||||
};
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -14,11 +14,12 @@ vim.pluginOverrides = {
|
|||
rev = "";
|
||||
hash = "";
|
||||
};
|
||||
|
||||
# It's also possible to use a flake input
|
||||
lazydev-nvim = inputs.lazydev-nvim;
|
||||
# Or a local path
|
||||
lazydev-nvim = ./lazydev;
|
||||
# Or a npins pin... etc
|
||||
# Or a npins pin nvfetcher source, etc.
|
||||
};
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,9 @@
|
|||
|
||||
- Added [sqruff](https://github.com/quarylabs/sqruff) support to `languages.sql`
|
||||
|
||||
- Lazy-load `crates.nvim` plugin when using
|
||||
`vim.languages.rust.extensions.crates-nvim.enable`
|
||||
|
||||
- Added [Pyrefly](https://pyrefly.org/) and [zuban](https://zubanls.com/)
|
||||
support to `languages.python`
|
||||
|
||||
|
|
@ -139,9 +142,14 @@
|
|||
[Tombi](https://tombi-toml.github.io/tombi/) language server, linter, and
|
||||
formatter.
|
||||
|
||||
- Added Jinja support via `languages.jinja`
|
||||
|
||||
- Added [hlargs.nvim](https://github.com/m-demare/hlargs.nvim) support as
|
||||
`visuals.hlargs-nvim`.
|
||||
|
||||
- Lazy-load `nvim-autopairs` plugin when using
|
||||
`vim.autopairs.nvim-autopairs.enable`
|
||||
|
||||
[Machshev](https://github.com/machshev):
|
||||
|
||||
- Added `ruff` and `ty` LSP support for Python under `programs.python`.
|
||||
|
|
@ -159,4 +167,15 @@
|
|||
- Added [Selenen](https://github.com/kampfkarren/selene) for more diagnostics in
|
||||
`languages.lua`.
|
||||
|
||||
- Added XML syntax highlighting, LSP support and formatting
|
||||
|
||||
- Added [tera](https://keats.github.io/tera/) language support (syntax
|
||||
highlighting only).
|
||||
|
||||
[vagahbond](https://github.com/vagahbond): [codewindow.nvim]:
|
||||
https://github.com/gorbit99/codewindow.nvim
|
||||
|
||||
- Add [codewindow.nvim] plugin in `vim.assistant.codewindow` with `enable` and
|
||||
`setupOpts`
|
||||
|
||||
<!-- vim: set textwidth=80: -->
|
||||
|
|
|
|||
8
flake.lock
generated
8
flake.lock
generated
|
|
@ -74,16 +74,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1768875095,
|
||||
"narHash": "sha256-dYP3DjiL7oIiiq3H65tGIXXIT1Waiadmv93JS0sS+8A=",
|
||||
"lastModified": 1769461804,
|
||||
"narHash": "sha256-msG8SU5WsBUfVVa/9RPLaymvi5bI8edTavbIq3vRlhI=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ed142ab1b3a092c4d149245d0c4126a5d7ea00b0",
|
||||
"rev": "bfc1b8a4574108ceef22f02bafcf6611380c100d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@
|
|||
systems.url = "github:nix-systems/default";
|
||||
|
||||
## Basic Inputs
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
|
||||
flake-parts = {
|
||||
url = "github:hercules-ci/flake-parts";
|
||||
|
|
|
|||
|
|
@ -4,17 +4,14 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.autopairs.nvim-autopairs;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-autopairs"];
|
||||
pluginRC.autopairs = entryAnywhere ''
|
||||
require('nvim-autopairs').setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
vim.lazy.plugins.nvim-autopairs = {
|
||||
package = "nvim-autopairs";
|
||||
setupModule = "nvim-autopairs";
|
||||
setupOpts = cfg.setupOpts;
|
||||
event = ["InsertEnter"];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,10 @@ in {
|
|||
./helm.nix
|
||||
./kotlin.nix
|
||||
./html.nix
|
||||
./tera.nix
|
||||
./haskell.nix
|
||||
./java.nix
|
||||
./jinja.nix
|
||||
./json.nix
|
||||
./lua.nix
|
||||
./markdown.nix
|
||||
|
|
@ -51,6 +53,7 @@ in {
|
|||
./yaml.nix
|
||||
./ruby.nix
|
||||
./just.nix
|
||||
./xml.nix
|
||||
|
||||
# This is now a hard deprecation.
|
||||
(mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"])
|
||||
|
|
|
|||
65
modules/plugins/languages/jinja.nix
Normal file
65
modules/plugins/languages/jinja.nix
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) enum listOf;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.jinja;
|
||||
defaultServers = ["jinja-lsp"];
|
||||
servers = {
|
||||
jinja-lsp = {
|
||||
enable = true;
|
||||
cmd = [(getExe pkgs.jinja-lsp)];
|
||||
filetypes = ["jinja"];
|
||||
root_markers = [
|
||||
".git"
|
||||
];
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.jinja = {
|
||||
enable = mkEnableOption "Jinja template language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Jinja treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "jinja";
|
||||
inlinePackage = mkGrammarOption pkgs "jinja_inline";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Jinja LSP support" // {default = config.vim.lsp.enable;};
|
||||
servers = mkOption {
|
||||
description = "Jinja LSP server to use";
|
||||
type = listOf (enum (attrNames servers));
|
||||
default = defaultServers;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [
|
||||
cfg.treesitter.package
|
||||
cfg.treesitter.inlinePackage
|
||||
];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.servers =
|
||||
mapListToAttrs (n: {
|
||||
name = n;
|
||||
value = servers.${n};
|
||||
})
|
||||
cfg.lsp.servers;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -228,10 +228,17 @@ in {
|
|||
(mkIf cfg.extensions.crates-nvim.enable {
|
||||
vim = mkMerge [
|
||||
{
|
||||
startPlugins = ["crates-nvim"];
|
||||
pluginRC.rust-crates = entryAnywhere ''
|
||||
require("crates").setup(${toLuaObject cfg.extensions.crates-nvim.setupOpts})
|
||||
'';
|
||||
lazy.plugins.crates-nvim = {
|
||||
package = "crates-nvim";
|
||||
setupModule = "crates";
|
||||
setupOpts = cfg.extensions.crates-nvim.setupOpts;
|
||||
event = [
|
||||
{
|
||||
event = "BufRead";
|
||||
pattern = "Cargo.toml";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
})
|
||||
|
|
|
|||
28
modules/plugins/languages/tera.nix
Normal file
28
modules/plugins/languages/tera.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.tera;
|
||||
in {
|
||||
options.vim.languages.tera = {
|
||||
enable = mkEnableOption "Tera templating language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Tera treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "tera";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
]);
|
||||
}
|
||||
62
modules/plugins/languages/xml.nix
Normal file
62
modules/plugins/languages/xml.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum listOf;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.xml;
|
||||
|
||||
defaultServers = ["lemminx"];
|
||||
servers = {
|
||||
lemminx = {
|
||||
enable = true;
|
||||
cmd = [
|
||||
(getExe pkgs.lemminx)
|
||||
];
|
||||
filetypes = ["xml"];
|
||||
root_markers = [".git"];
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.xml = {
|
||||
enable = mkEnableOption "XML language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "XML treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "xml";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "XML LSP support" // {default = config.vim.lsp.enable;};
|
||||
servers = mkOption {
|
||||
type = listOf (enum (attrNames servers));
|
||||
default = defaultServers;
|
||||
description = "XML LSP server to use";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.servers =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = servers.${name};
|
||||
})
|
||||
cfg.lsp.servers;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.minimap.codewindow = {
|
||||
enable = mkEnableOption "codewindow plugin for minimap view";
|
||||
|
|
@ -11,5 +12,7 @@ in {
|
|||
toggle = mkMappingOption "Toggle minimap [codewindow]" "<leader>mm";
|
||||
toggleFocus = mkMappingOption "Toggle minimap focus [codewindow]" "<leader>mf";
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "codewindow" {};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding pushDownDefault;
|
||||
|
||||
cfg = config.vim.minimap.codewindow;
|
||||
|
|
@ -32,9 +33,7 @@ in {
|
|||
|
||||
pluginRC.codewindow = entryAnywhere ''
|
||||
local codewindow = require('codewindow')
|
||||
codewindow.setup({
|
||||
exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'},
|
||||
})
|
||||
codewindow.setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -973,9 +973,9 @@
|
|||
},
|
||||
"branch": "main",
|
||||
"submodules": false,
|
||||
"revision": "de79a7626d54d7785436105ef72f37ee8fe8fa16",
|
||||
"url": "https://github.com/OXY2DEV/markview.nvim/archive/de79a7626d54d7785436105ef72f37ee8fe8fa16.tar.gz",
|
||||
"hash": "sha256-kGhohG4Aw9wMceLiX+s2HCWIyWuJYHoa9D80elM1UQw="
|
||||
"revision": "c81ce9ed129387fc5fdec91abe9818a1b0e6fcac",
|
||||
"url": "https://github.com/OXY2DEV/markview.nvim/archive/c81ce9ed129387fc5fdec91abe9818a1b0e6fcac.tar.gz",
|
||||
"hash": "sha256-CoPfVkPWh5neyIT1rVEHMLo7532lWvbv0Gg/27D0PHw="
|
||||
},
|
||||
"mellow": {
|
||||
"type": "Git",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue