nvim: enable inlay hints + toggling

This commit is contained in:
Daniel Lundin 2024-12-02 09:42:24 +01:00
parent 5c319ac288
commit aed9af6f45
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI
6 changed files with 110 additions and 31 deletions

View file

@ -50,7 +50,6 @@
plugins = with pkgs.vimPlugins; [
friendly-snippets
go-nvim
rustaceanvim
targets-vim
ts-comments-nvim
@ -116,6 +115,23 @@
'';
}
{
plugin = pkgs.vimUtils.buildVimPlugin {
name = "inlay-hints";
src = pkgs.fetchFromGitHub {
owner = "MysticalDevil";
repo = "inlay-hints.nvim";
rev = "af84dee42cd118af6d592b06c1c0e45d6432a6c0"; # 2024-08-23
hash = "sha256-DZVtFAUK9c8GInp+JdCQ1BKe0dkAheHKI67oxdMmA24=";
};
};
type = "lua";
config = ''
require('inlay-hints').setup()
require("inlay-hints.utils").enable_inlay_hints()
'';
}
{
plugin = codeium-nvim;
type = "lua";
@ -185,6 +201,12 @@
type = "lua";
config = lib.fileContents ./mini.lua;
}
{
plugin = rustaceanvim;
type = "lua";
config = lib.fileContents ./rust.lua;
}
];
};
}

View file

@ -152,5 +152,5 @@ vim.keymap.set("n", "K", function()
vim.keymap.set("n", "<Leader>ub", function()
vim.o.background = (vim.o.background == "light" and "dark" or "light")
end, opts("Toggle dark/light background"))
vim.keymap.set("n", "<Leader>uh", "<cmd>InlayHintsToggle<cr>", opts("Toggle inlay hints"))

View file

@ -1,12 +1,27 @@
local lspconfig = require("lspconfig")
local servers = {
cssls = {},
gopls = {},
html = {},
jsonls = {},
superhtml = {},
ts_ls = {},
gopls = {
settings = {
gopls = {
hints = {
rangeVariableTypes = true,
parameterNames = true,
constantValues = true,
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
functionTypeParameters = true,
},
},
},
},
harper_ls = {
filetypes = {
"asciidoc", "c", "gitcommit", "go", "html", "javascript", "just", "lua", "markdown",
@ -22,6 +37,7 @@ local servers = {
path = vim.split(package.path, ";"),
},
diagnostics = { globals = { "vim", "hs" } },
hint = { enable = true },
workspace = {
library = {
[vim.fn.expand("$VIMRUNTIME/lua")] = true,

40
home/common/nvim/rust.lua Normal file
View file

@ -0,0 +1,40 @@
vim.g.rustaceanvim = {
server = {
settings = {
["rust-analyzer"] = {
inlayHints = {
bindingModeHints = {
enable = false,
},
chainingHints = {
enable = true,
},
closingBraceHints = {
enable = true,
minLines = 25,
},
closureReturnTypeHints = {
enable = "never",
},
lifetimeElisionHints = {
enable = "never",
useParameterNames = false,
},
maxLength = 25,
parameterHints = {
enable = true,
},
reborrowHints = {
enable = "never",
},
renderColons = true,
typeHints = {
enable = true,
hideClosureInitialization = false,
hideNamedConstructor = false,
},
},
},
},
},
}

View file

@ -13,6 +13,7 @@
plugins = with pkgs.vimPlugins; [
ts-comments-nvim
nvim-ts-context-commentstring
playground
{
plugin = nvim-treesitter-context;