mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-03-08 01:36:02 +00:00
Compare commits
6 commits
45aaf1cccf
...
100d9e59a1
| Author | SHA1 | Date | |
|---|---|---|---|
|
100d9e59a1 |
|||
|
33cc70b4db |
|||
|
8050617656 |
|||
|
3182811b8d |
|||
|
f66d077294 |
|||
|
7bc9581b30 |
6 changed files with 84 additions and 4 deletions
|
|
@ -17,6 +17,7 @@ configuring/custom-package.md
|
||||||
configuring/custom-plugins.md
|
configuring/custom-plugins.md
|
||||||
configuring/overriding-plugins.md
|
configuring/overriding-plugins.md
|
||||||
configuring/languages.md
|
configuring/languages.md
|
||||||
|
configuring/keybinds.md
|
||||||
configuring/dags.md
|
configuring/dags.md
|
||||||
configuring/dag-entries.md
|
configuring/dag-entries.md
|
||||||
configuring/autocmds.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 = "";
|
rev = "";
|
||||||
hash = "";
|
hash = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
# It's also possible to use a flake input
|
# It's also possible to use a flake input
|
||||||
lazydev-nvim = inputs.lazydev-nvim;
|
lazydev-nvim = inputs.lazydev-nvim;
|
||||||
# Or a local path
|
# Or a local path
|
||||||
lazydev-nvim = ./lazydev;
|
lazydev-nvim = ./lazydev;
|
||||||
# Or a npins pin... etc
|
# Or a npins pin nvfetcher source, etc.
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,4 +49,4 @@ in
|
||||||
"expToLua"
|
"expToLua"
|
||||||
"listToLuaTable"
|
"listToLuaTable"
|
||||||
"attrsetToLuaTable"
|
"attrsetToLuaTable"
|
||||||
] (name: lib.warn "${name} is deprecated use toLuaObject instead" toLuaObject)
|
] (name: builtins.throw "${name} is deprecated use toLuaObject instead")
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.attrsets) attrNames;
|
inherit (lib.attrsets) attrNames;
|
||||||
inherit (lib.types) bool package str listOf either enum int;
|
inherit (lib.types) bool package str listOf either enum int;
|
||||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption deprecatedSingleOrListOf;
|
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption deprecatedSingleOrListOf;
|
||||||
inherit (lib.nvim.dag) entryAfter entryAnywhere;
|
inherit (lib.nvim.dag) entryAfter entryAnywhere;
|
||||||
|
|
@ -169,7 +169,7 @@ in {
|
||||||
server = {
|
server = {
|
||||||
cmd = ${
|
cmd = ${
|
||||||
if isList cfg.lsp.package
|
if isList cfg.lsp.package
|
||||||
then expToLua cfg.lsp.package
|
then toLuaObject cfg.lsp.package
|
||||||
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
||||||
},
|
},
|
||||||
default_settings = {
|
default_settings = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue