Compare commits
2 Commits
main
...
prepend-to
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7487a5d0a8 | ||
|
|
c9d87d1e3a |
12
README.md
12
README.md
@ -24,6 +24,8 @@
|
|||||||
for <a href="https://neovim.io/">Neovim</a>
|
for <a href="https://neovim.io/">Neovim</a>
|
||||||
</strong>
|
</strong>
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
|
<!-- markdownlint-restore -->
|
||||||
|
|
||||||
[![Neovim][neovim-shield]][neovim-url]
|
[![Neovim][neovim-shield]][neovim-url]
|
||||||
[![Nix][nix-shield]][nix-url]
|
[![Nix][nix-shield]][nix-url]
|
||||||
@ -31,8 +33,6 @@
|
|||||||
|
|
||||||
[![GPL2 License][license-shield]][license-url]
|
[![GPL2 License][license-shield]][license-url]
|
||||||
[![Issues][issues-shield]][issues-url]
|
[![Issues][issues-shield]][issues-url]
|
||||||
</div>
|
|
||||||
<!-- markdownlint-restore -->
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -101,7 +101,7 @@ to start a repo based on this template. **Do _not_ fork it**.
|
|||||||
1. Add/remove plugins to/from the [Neovim overlay](./nix/neovim-overlay.nix).
|
1. Add/remove plugins to/from the [Neovim overlay](./nix/neovim-overlay.nix).
|
||||||
1. Add/remove plugin configs to/from the `nvim/plugin` directory.
|
1. Add/remove plugin configs to/from the `nvim/plugin` directory.
|
||||||
1. Modify as you wish (you will probably want to add a color theme, ...).
|
1. Modify as you wish (you will probably want to add a color theme, ...).
|
||||||
See: [Design](#robot-design).
|
See: [Design](#design).
|
||||||
1. You can create more than one package using the `mkNeovim` function by
|
1. You can create more than one package using the `mkNeovim` function by
|
||||||
- Passing different plugin lists.
|
- Passing different plugin lists.
|
||||||
- Adding `ignoreConfigRegexes` (e.g. `= [ "^ftplugin/.*.lua" ]`).
|
- Adding `ignoreConfigRegexes` (e.g. `= [ "^ftplugin/.*.lua" ]`).
|
||||||
@ -304,9 +304,9 @@ To work around this, you can put scripts in the `plugin` or `after/plugin` direc
|
|||||||
- [`nixCats-nvim`](https://github.com/BirdeeHub/nixCats-nvim):
|
- [`nixCats-nvim`](https://github.com/BirdeeHub/nixCats-nvim):
|
||||||
A project that organises plugins into categories.
|
A project that organises plugins into categories.
|
||||||
It also separates lua and nix configuration.
|
It also separates lua and nix configuration.
|
||||||
- [`lz.n`](https://github.com/nvim-neorocks/lz.n):
|
- [`lazy-nix-helper.nvim`](https://github.com/b-src/lazy-nix-helper.nvim):
|
||||||
A plugin-manager agnostic Lua library for lazy-loading plugins.
|
For lazy.nvim users who would like to manage plugins with Nix,
|
||||||
Can be used with Nix.
|
but load them with lazy.nvim.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
>
|
>
|
||||||
|
|||||||
132
flake.lock
generated
132
flake.lock
generated
@ -1,31 +1,15 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-compat": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1696426674,
|
|
||||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-parts": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717285511,
|
"lastModified": 1706830856,
|
||||||
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
|
"narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
|
"rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -39,11 +23,11 @@
|
|||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731533236,
|
"lastModified": 1710146030,
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -55,16 +39,14 @@
|
|||||||
"gen-luarc": {
|
"gen-luarc": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"git-hooks": "git-hooks",
|
|
||||||
"luvit-meta": "luvit-meta",
|
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1724097937,
|
"lastModified": 1710933866,
|
||||||
"narHash": "sha256-Q4tgm8ZHAQUdvsNft86MqIbHQAm7OF7RT/wwYWXqSdY=",
|
"narHash": "sha256-GtYTuxY6AdFxl3uwFkTkqpvOP4lQLzu2YwqnejhDs1Q=",
|
||||||
"owner": "mrcjkb",
|
"owner": "mrcjkb",
|
||||||
"repo": "nix-gen-luarc-json",
|
"repo": "nix-gen-luarc-json",
|
||||||
"rev": "b36b69c4ded9f31b079523bc452e23458734cf00",
|
"rev": "6e8912ea4fbfaa10797caafb1f5628fb4178b6e8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -73,75 +55,13 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"git-hooks": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat",
|
|
||||||
"gitignore": "gitignore",
|
|
||||||
"nixpkgs": [
|
|
||||||
"gen-luarc",
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"nixpkgs-stable": "nixpkgs-stable"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1723803910,
|
|
||||||
"narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=",
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "git-hooks.nix",
|
|
||||||
"rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "git-hooks.nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"gitignore": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"gen-luarc",
|
|
||||||
"git-hooks",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1709087332,
|
|
||||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "gitignore.nix",
|
|
||||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "gitignore.nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"luvit-meta": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1705776742,
|
|
||||||
"narHash": "sha256-zAAptV/oLuLAAsa2zSB/6fxlElk4+jNZd/cPr9oxFig=",
|
|
||||||
"owner": "Bilal2453",
|
|
||||||
"repo": "luvit-meta",
|
|
||||||
"rev": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "Bilal2453",
|
|
||||||
"repo": "luvit-meta",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1718714799,
|
"lastModified": 1708475490,
|
||||||
"narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=",
|
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e",
|
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -153,39 +73,29 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717284937,
|
"dir": "lib",
|
||||||
"narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=",
|
"lastModified": 1706550542,
|
||||||
"type": "tarball",
|
"narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=",
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs-stable": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1720386169,
|
|
||||||
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
|
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
|
"rev": "97b17f32362e475016f942bbdfda4a4a72a8a652",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
"dir": "lib",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-24.05",
|
"ref": "nixos-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733212471,
|
"lastModified": 1713714899,
|
||||||
"narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=",
|
"narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "55d15ad12a74eb7d4646254e13638ad0c4128776",
|
"rev": "6143fc5eeb9c4f00163267708e26191d1e918932",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@ -11,8 +11,6 @@ with lib;
|
|||||||
# NVIM_APPNAME - Defaults to 'nvim' if not set.
|
# NVIM_APPNAME - Defaults to 'nvim' if not set.
|
||||||
# If set to something else, this will also rename the binary.
|
# If set to something else, this will also rename the binary.
|
||||||
appName ? null,
|
appName ? null,
|
||||||
# The Neovim package to wrap
|
|
||||||
neovim-unwrapped ? pkgs-wrapNeovim.neovim-unwrapped,
|
|
||||||
plugins ? [], # List of plugins
|
plugins ? [], # List of plugins
|
||||||
# List of dev plugins (will be bootstrapped) - useful for plugin developers
|
# List of dev plugins (will be bootstrapped) - useful for plugin developers
|
||||||
# { name = <plugin-name>; url = <git-url>; }
|
# { name = <plugin-name>; url = <git-url>; }
|
||||||
@ -32,10 +30,8 @@ with lib;
|
|||||||
withSqlite ? true, # Add sqlite? This is a dependency for some plugins
|
withSqlite ? true, # Add sqlite? This is a dependency for some plugins
|
||||||
# You probably don't want to create vi or vim aliases
|
# You probably don't want to create vi or vim aliases
|
||||||
# if the appName is something different than "nvim"
|
# if the appName is something different than "nvim"
|
||||||
# Add a "vi" binary to the build output as an alias?
|
viAlias ? appName == "nvim", # Add a "vi" binary to the build output as an alias?
|
||||||
viAlias ? appName == null || appName == "nvim",
|
vimAlias ? appName == "nvim", # Add a "vim" binary to the build output as an alias?
|
||||||
# Add a "vim" binary to the build output as an alias?
|
|
||||||
vimAlias ? appName == null || appName == "nvim",
|
|
||||||
}: let
|
}: let
|
||||||
# This is the structure of a plugin definition.
|
# This is the structure of a plugin definition.
|
||||||
# Each plugin in the `plugins` argument list can also be defined as this attrset
|
# Each plugin in the `plugins` argument list can also be defined as this attrset
|
||||||
@ -99,17 +95,11 @@ with lib;
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
cp -r after $out/after
|
||||||
|
rm -r after
|
||||||
cp -r lua $out/lua
|
cp -r lua $out/lua
|
||||||
rm -r lua
|
rm -r lua
|
||||||
# Copy nvim/after only if it exists
|
cp -r * $out/nvim
|
||||||
if [ -d "after" ]; then
|
|
||||||
cp -r after $out/after
|
|
||||||
rm -r after
|
|
||||||
fi
|
|
||||||
# Copy rest of nvim/ subdirectories only if they exist
|
|
||||||
if [ ! -z "$(ls -A)" ]; then
|
|
||||||
cp -r -- * $out/nvim
|
|
||||||
fi
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -170,7 +160,7 @@ with lib;
|
|||||||
''--set LIBSQLITE "${pkgs.sqlite.out}/lib/libsqlite3.so"'')
|
''--set LIBSQLITE "${pkgs.sqlite.out}/lib/libsqlite3.so"'')
|
||||||
);
|
);
|
||||||
|
|
||||||
luaPackages = neovim-unwrapped.lua.pkgs;
|
luaPackages = pkgs.neovim-unwrapped.lua.pkgs;
|
||||||
resolvedExtraLuaPackages = extraLuaPackages luaPackages;
|
resolvedExtraLuaPackages = extraLuaPackages luaPackages;
|
||||||
|
|
||||||
# Native Lua libraries
|
# Native Lua libraries
|
||||||
@ -184,7 +174,7 @@ with lib;
|
|||||||
''--suffix LUA_PATH ";" "${concatMapStringsSep ";" luaPackages.getLuaPath resolvedExtraLuaPackages}"'';
|
''--suffix LUA_PATH ";" "${concatMapStringsSep ";" luaPackages.getLuaPath resolvedExtraLuaPackages}"'';
|
||||||
|
|
||||||
# wrapNeovimUnstable is the nixpkgs utility function for building a Neovim derivation.
|
# wrapNeovimUnstable is the nixpkgs utility function for building a Neovim derivation.
|
||||||
neovim-wrapped = pkgs-wrapNeovim.wrapNeovimUnstable neovim-unwrapped (neovimConfig
|
neovim-wrapped = pkgs-wrapNeovim.wrapNeovimUnstable pkgs.neovim-unwrapped (neovimConfig
|
||||||
// {
|
// {
|
||||||
luaRcContent = initLua;
|
luaRcContent = initLua;
|
||||||
wrapperArgs =
|
wrapperArgs =
|
||||||
@ -207,8 +197,4 @@ with lib;
|
|||||||
+ lib.optionalString isCustomAppName ''
|
+ lib.optionalString isCustomAppName ''
|
||||||
mv $out/bin/nvim $out/bin/${lib.escapeShellArg appName}
|
mv $out/bin/nvim $out/bin/${lib.escapeShellArg appName}
|
||||||
'';
|
'';
|
||||||
meta.mainProgram
|
|
||||||
= if isCustomAppName
|
|
||||||
then appName
|
|
||||||
else oa.meta.mainProgram;
|
|
||||||
})
|
})
|
||||||
|
|||||||
@ -5,7 +5,7 @@ with final.pkgs.lib; let
|
|||||||
|
|
||||||
# Use this to create a plugin from a flake input
|
# Use this to create a plugin from a flake input
|
||||||
mkNvimPlugin = src: pname:
|
mkNvimPlugin = src: pname:
|
||||||
pkgs.vimUtils.buildVimPlugin {
|
pkgs.vimUtils.buildNeovimPlugin {
|
||||||
inherit pname src;
|
inherit pname src;
|
||||||
version = src.lastModifiedDate;
|
version = src.lastModifiedDate;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -50,6 +50,19 @@ local function prefix_diagnostic(prefix, diagnostic)
|
|||||||
return string.format(prefix .. ' %s', diagnostic.message)
|
return string.format(prefix .. ' %s', diagnostic.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local sign = function(opts)
|
||||||
|
fn.sign_define(opts.name, {
|
||||||
|
texthl = opts.name,
|
||||||
|
text = opts.text,
|
||||||
|
numhl = '',
|
||||||
|
})
|
||||||
|
end
|
||||||
|
-- Requires Nerd fonts
|
||||||
|
sign { name = 'DiagnosticSignError', text = '' }
|
||||||
|
sign { name = 'DiagnosticSignWarn', text = '⚠' }
|
||||||
|
sign { name = 'DiagnosticSignInfo', text = 'ⓘ' }
|
||||||
|
sign { name = 'DiagnosticSignHint', text = '' }
|
||||||
|
|
||||||
vim.diagnostic.config {
|
vim.diagnostic.config {
|
||||||
virtual_text = {
|
virtual_text = {
|
||||||
prefix = '',
|
prefix = '',
|
||||||
@ -70,15 +83,7 @@ vim.diagnostic.config {
|
|||||||
return prefix_diagnostic('■', diagnostic)
|
return prefix_diagnostic('■', diagnostic)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
signs = {
|
signs = true,
|
||||||
text = {
|
|
||||||
-- Requires Nerd fonts
|
|
||||||
[vim.diagnostic.severity.ERROR] = '',
|
|
||||||
[vim.diagnostic.severity.WARN] = '⚠',
|
|
||||||
[vim.diagnostic.severity.INFO] = 'ⓘ',
|
|
||||||
[vim.diagnostic.severity.HINT] = '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
update_in_insert = false,
|
update_in_insert = false,
|
||||||
underline = true,
|
underline = true,
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
@ -102,3 +107,9 @@ cmd.packadd('cfilter') -- Allows filtering the quickfix list with :cfdo
|
|||||||
|
|
||||||
-- let sqlite.lua (which some plugins depend on) know where to find sqlite
|
-- let sqlite.lua (which some plugins depend on) know where to find sqlite
|
||||||
vim.g.sqlite_clib_path = require('luv').os_getenv('LIBSQLITE')
|
vim.g.sqlite_clib_path = require('luv').os_getenv('LIBSQLITE')
|
||||||
|
|
||||||
|
-- this should be at the end, because
|
||||||
|
-- it causes neovim to source ftplugins
|
||||||
|
-- on the packpath when passing a file to the nvim command
|
||||||
|
cmd.syntax('on')
|
||||||
|
cmd.syntax('enable')
|
||||||
|
|||||||
@ -96,10 +96,10 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
|||||||
keymap.set('n', '<space>f', function()
|
keymap.set('n', '<space>f', function()
|
||||||
vim.lsp.buf.format { async = true }
|
vim.lsp.buf.format { async = true }
|
||||||
end, desc('[lsp] [f]ormat buffer'))
|
end, desc('[lsp] [f]ormat buffer'))
|
||||||
if client and client.server_capabilities.inlayHintProvider then
|
if client.server_capabilities.inlayHintProvider then
|
||||||
keymap.set('n', '<space>h', function()
|
keymap.set('n', '<space>h', function()
|
||||||
local current_setting = vim.lsp.inlay_hint.is_enabled { bufnr = bufnr }
|
local current_setting = vim.lsp.inlay_hint.is_enabled(bufnr)
|
||||||
vim.lsp.inlay_hint.enable(not current_setting, { bufnr = bufnr })
|
vim.lsp.inlay_hint.enable(bufnr, not current_setting)
|
||||||
end, desc('[lsp] toggle inlay hints'))
|
end, desc('[lsp] toggle inlay hints'))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -107,16 +107,22 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
|||||||
if not client then
|
if not client then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local function buf_refresh_codeLens()
|
||||||
|
vim.schedule(function()
|
||||||
|
if client.server_capabilities.codeLensProvider then
|
||||||
|
vim.lsp.codelens.refresh()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
local group = api.nvim_create_augroup(string.format('lsp-%s-%s', bufnr, client.id), {})
|
local group = api.nvim_create_augroup(string.format('lsp-%s-%s', bufnr, client.id), {})
|
||||||
if client.server_capabilities.codeLensProvider then
|
if client.server_capabilities.codeLensProvider then
|
||||||
vim.api.nvim_create_autocmd({ 'InsertLeave', 'BufWritePost', 'TextChanged' }, {
|
vim.api.nvim_create_autocmd({ 'InsertLeave', 'BufWritePost', 'TextChanged' }, {
|
||||||
group = group,
|
group = group,
|
||||||
callback = function()
|
callback = buf_refresh_codeLens,
|
||||||
vim.lsp.codelens.refresh { bufnr = bufnr }
|
|
||||||
end,
|
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
})
|
})
|
||||||
vim.lsp.codelens.refresh { bufnr = bufnr }
|
buf_refresh_codeLens()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -174,13 +174,6 @@ keymap.set('n', ']h', function()
|
|||||||
}
|
}
|
||||||
end, { noremap = true, silent = true, desc = 'next [h]int diagnostic' })
|
end, { noremap = true, silent = true, desc = 'next [h]int diagnostic' })
|
||||||
|
|
||||||
local function buf_toggle_diagnostics()
|
|
||||||
local filter = { bufnr = api.nvim_get_current_buf() }
|
|
||||||
diagnostic.enable(not diagnostic.is_enabled(filter), filter)
|
|
||||||
end
|
|
||||||
|
|
||||||
keymap.set('n', '<space>dt', buf_toggle_diagnostics)
|
|
||||||
|
|
||||||
local function toggle_spell_check()
|
local function toggle_spell_check()
|
||||||
---@diagnostic disable-next-line: param-type-mismatch
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
vim.opt.spell = not (vim.opt.spell:get())
|
vim.opt.spell = not (vim.opt.spell:get())
|
||||||
|
|||||||
@ -7,3 +7,4 @@ vim.g.did_load_plugins_plugin = true
|
|||||||
-- even with default configs
|
-- even with default configs
|
||||||
|
|
||||||
require('nvim-surround').setup()
|
require('nvim-surround').setup()
|
||||||
|
require('which-key').setup()
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
require('which-key').setup {
|
|
||||||
preset = 'helix'
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user