-
-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(recipes): add recipe for toggling inlay hints when entering/leav…
…ing insert mode
- Loading branch information
Showing
6 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
lua/astrocommunity/recipes/astrolsp-no-insert-inlay-hints/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# AstroLSP - Disable inlay hints in insert mode | ||
|
||
**Website:** <https://docs.astronvim.com/recipes/advanced_lsp/#inlay-hints> | ||
|
||
This plugin specification configures AstroLSP to disable inlay hints in a buffer when going into insert mode and re-enables them when leaving insert mode. |
33 changes: 33 additions & 0 deletions
33
lua/astrocommunity/recipes/astrolsp-no-insert-inlay-hints/init.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
return { | ||
"AstroNvim/astrolsp", | ||
---@type AstroLSPOpts | ||
opts = { | ||
autocmds = { | ||
no_insert_inlay_hints = { | ||
-- only create for language servers that support inlay hints | ||
-- (and only if vim.lsp.inlay_hint is available) | ||
cond = vim.lsp.inlay_hint and "textDocument/inlayHint" or false, | ||
{ | ||
-- when going into insert mode | ||
event = "InsertEnter", | ||
desc = "disable inlay hints on insert", | ||
callback = function(args) | ||
local filter = { bufnr = args.buf } | ||
-- if the inlay hints are currently enabled | ||
if vim.lsp.inlay_hint.is_enabled(filter) then | ||
-- disable the inlay hints | ||
vim.lsp.inlay_hint.enable(false, filter) | ||
-- create a single use autocommand to turn the inlay hints back on | ||
-- when leaving insert mode | ||
vim.api.nvim_create_autocmd("InsertLeave", { | ||
buffer = args.buf, | ||
once = true, | ||
callback = function() vim.lsp.inlay_hint.enable(true, filter) end, | ||
}) | ||
end | ||
end, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# heirline.nvim clock statusline | ||
|
||
**Website:** <https://docs.astronvim.com/Recipes/status#default-statusline-with-clock> | ||
**Website:** <https://docs.astronvim.com/recipes/status#default-statusline-with-clock> | ||
|
||
This plugin specification configures the `statusline` in AstroNvim to show a clock in the right hand side mode indicator. |
2 changes: 1 addition & 1 deletion
2
lua/astrocommunity/recipes/heirline-mode-text-statusline/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lua/astrocommunity/recipes/heirline-nvchad-statusline/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# heirline.nvim NvChad statusline | ||
|
||
**Website:** <https://docs.astronvim.com/Recipes/status#replicate-nvchad-statusline> | ||
**Website:** <https://docs.astronvim.com/recipes/status#replicate-nvchad-statusline> | ||
|
||
This plugin specification configures the `statusline` in AstroNvim to emulate the NvChad statusline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters