feat(plugin): add showkeys integrationfor quick key preview
Adds nvzone/showkeys plugin and toggles it on demand to display current key bindings, enhancing developer workflow discoverability of mappings.
This commit is contained in:
3 files changed
+158
-138
No files matched your search
+64
-63
@@ -1,74 +1,75 @@
|
|||||||
add({
|
add({
|
||||||
"mfussenegger/nvim-lint", -- linter
|
'mfussenegger/nvim-lint', -- linter
|
||||||
"rshkarin/mason-nvim-lint", -- linter installer
|
'rshkarin/mason-nvim-lint', -- linter installer
|
||||||
"stevearc/conform.nvim", -- autoformater
|
'stevearc/conform.nvim', -- autoformater
|
||||||
"zapling/mason-conform.nvim", -- formatter installer
|
'szw/vim-maximizer',
|
||||||
|
'zapling/mason-conform.nvim', -- formatter installer
|
||||||
})
|
})
|
||||||
|
|
||||||
-- linter
|
-- linter
|
||||||
require("lint").linters_by_ft = {
|
require('lint').linters_by_ft = {
|
||||||
["*"] = { "codespell" },
|
['*'] = { 'codespell' },
|
||||||
["javascript"] = { "eslint_d", "cspell" },
|
['javascript'] = { 'eslint_d', 'cspell' },
|
||||||
["typescript"] = { "eslint_d", "cspell" },
|
['typescript'] = { 'eslint_d', 'cspell' },
|
||||||
["javascriptreact"] = { "eslint_d", "cspell" },
|
['javascriptreact'] = { 'eslint_d', 'cspell' },
|
||||||
["typescriptreact"] = { "eslint_d", "cspell" },
|
['typescriptreact'] = { 'eslint_d', 'cspell' },
|
||||||
["dockerfile"] = { "hadolint" },
|
['dockerfile'] = { 'hadolint' },
|
||||||
["markdown"] = { "write_good", "markdownlint" },
|
['markdown'] = { 'write_good', 'markdownlint' },
|
||||||
["text"] = { "write_good" },
|
['text'] = { 'write_good' },
|
||||||
["sh"] = { "shellcheck" },
|
['sh'] = { 'shellcheck' },
|
||||||
["yaml"] = { "actionlint" },
|
['yaml'] = { 'actionlint' },
|
||||||
["python"] = { "ruff" },
|
['python'] = { 'ruff' },
|
||||||
}
|
}
|
||||||
require("mason-nvim-lint").setup({
|
require('mason-nvim-lint').setup({
|
||||||
ensure_installed = require("extensions").linter,
|
ensure_installed = require('extensions').linter,
|
||||||
automatic_installation = false,
|
automatic_installation = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- formatter
|
-- formatter
|
||||||
require("conform").setup({
|
require('conform').setup({
|
||||||
formatters = {
|
formatters = {
|
||||||
["markdown-toc"] = {
|
['markdown-toc'] = {
|
||||||
condition = function(_, ctx)
|
condition = function(_, ctx)
|
||||||
for _, line in ipairs(vim.api.nvim_buf_get_lines(ctx.buf, 0, -1, false)) do
|
for _, line in ipairs(vim.api.nvim_buf_get_lines(ctx.buf, 0, -1, false)) do
|
||||||
if line:find("<!%-%-% toc %-%->") then
|
if line:find('<!%-%-% toc %-%->') then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
["lua"] = { "stylua" },
|
['lua'] = { 'stylua' },
|
||||||
["c"] = { "clang_format" },
|
['c'] = { 'clang_format' },
|
||||||
["cpp"] = { "clang_format" },
|
['cpp'] = { 'clang_format' },
|
||||||
["h"] = { "clang_format" },
|
['h'] = { 'clang_format' },
|
||||||
["python"] = { "ruff_fix", "ruff_format", "ruff_organize_imports" },
|
['python'] = { 'ruff_fix', 'ruff_format', 'ruff_organize_imports' },
|
||||||
["javascript"] = { "biome" },
|
['javascript'] = { 'biome' },
|
||||||
["typescript"] = { "biome" },
|
['typescript'] = { 'biome' },
|
||||||
["typescriptreact"] = { "biome" },
|
['typescriptreact'] = { 'biome' },
|
||||||
["markdown"] = { "prettier", "markdownlint-cli2"},
|
['markdown'] = { 'prettier', 'markdownlint-cli2' },
|
||||||
["markdown.mdx"] = { "prettier", "markdownlint-cli2" },
|
['markdown.mdx'] = { 'prettier', 'markdownlint-cli2' },
|
||||||
["mdx"] = { "prettier" },
|
['mdx'] = { 'prettier' },
|
||||||
["_"] = { "trim_whitespace" },
|
['_'] = { 'trim_whitespace' },
|
||||||
},
|
},
|
||||||
options = {
|
options = {
|
||||||
stop_after_first = true,
|
stop_after_first = true,
|
||||||
},
|
},
|
||||||
format_after_save = function(bufnr)
|
format_after_save = function(bufnr)
|
||||||
if not vim.b[bufnr].conform_disable then
|
if not vim.b[bufnr].conform_disable then
|
||||||
return {
|
return {
|
||||||
lsp_format = "fallback",
|
lsp_format = 'fallback',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>tf", function()
|
vim.keymap.set('n', '<leader>tf', function()
|
||||||
vim.b.conform_disable = not vim.b.conform_disable
|
vim.b.conform_disable = not vim.b.conform_disable
|
||||||
local status = vim.b.conform_disable and "disabled" or "enabled"
|
local status = vim.b.conform_disable and 'disabled' or 'enabled'
|
||||||
vim.notify("Autoformat " .. status, vim.log.levels.INFO)
|
vim.notify('Autoformat ' .. status, vim.log.levels.INFO)
|
||||||
end, { desc = "Toggle autoformat" })
|
end, { desc = 'Toggle autoformat' })
|
||||||
require("mason-conform").setup({
|
require('mason-conform').setup({
|
||||||
ensure_installed = require("extensions").formatter,
|
ensure_installed = require('extensions').formatter,
|
||||||
automatic_installation = true,
|
automatic_installation = true,
|
||||||
})
|
})
|
||||||
+76
-73
@@ -1,79 +1,82 @@
|
|||||||
add({
|
add({
|
||||||
"saghen/blink.lib",
|
'saghen/blink.lib',
|
||||||
{ src = "saghen/blink.cmp", build = "cargo build --release" },
|
{ src = 'saghen/blink.cmp', build = 'cargo build --release' },
|
||||||
"rafamadriz/friendly-snippets",
|
'rafamadriz/friendly-snippets',
|
||||||
})
|
})
|
||||||
|
|
||||||
require("blink.cmp").setup({
|
require('blink.cmp').setup({
|
||||||
fuzzy = { implementation = "prefer_rust" },
|
fuzzy = { implementation = 'prefer_rust' },
|
||||||
snippets = { preset = "default" },
|
snippets = { preset = 'default' },
|
||||||
sources = {
|
sources = {
|
||||||
default = function()
|
default = function()
|
||||||
local type = vim.fn.getcmdtype()
|
local type = vim.fn.getcmdtype()
|
||||||
if type == "/" or type == "?" then return { "buffer" } end
|
if type == '/' or type == '?' then
|
||||||
if type == ":" then return { "cmdline" } end
|
return { 'buffer' }
|
||||||
return { "lsp", "path", "snippets", "buffer" }
|
end
|
||||||
end,
|
if type == ':' then
|
||||||
providers = {
|
return { 'cmdline' }
|
||||||
snippets = {
|
end
|
||||||
opts = {
|
return { 'lsp', 'path', 'snippets', 'buffer' }
|
||||||
search_paths = { vim.fn.stdpath("config") .. "/snippets" },
|
end,
|
||||||
extended_filetypes = { mdx = { "markdown" } },
|
providers = {
|
||||||
},
|
snippets = {
|
||||||
},
|
opts = {
|
||||||
},
|
search_paths = { vim.fn.stdpath('config') .. '/snippets' },
|
||||||
},
|
extended_filetypes = { mdx = { 'markdown' } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
completion = {
|
completion = {
|
||||||
ghost_text = { enabled = true },
|
ghost_text = { enabled = true },
|
||||||
|
|
||||||
list = {
|
list = {
|
||||||
selection = {
|
selection = {
|
||||||
preselect = false,
|
preselect = false,
|
||||||
auto_insert = true,
|
auto_insert = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
documentation = {
|
documentation = {
|
||||||
window = { border = "rounded" },
|
window = { border = 'rounded' },
|
||||||
auto_show = true,
|
auto_show = true,
|
||||||
auto_show_delay_ms = 50,
|
auto_show_delay_ms = 50,
|
||||||
},
|
},
|
||||||
menu = {
|
menu = {
|
||||||
border = "rounded",
|
border = 'rounded',
|
||||||
draw = {
|
draw = {
|
||||||
components = {
|
components = {
|
||||||
kind_icon = {
|
kind_icon = {
|
||||||
text = function(ctx)
|
text = function(ctx)
|
||||||
local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind)
|
local kind_icon, _, _ = require('mini.icons').get('lsp', ctx.kind)
|
||||||
return kind_icon
|
return kind_icon
|
||||||
end,
|
end,
|
||||||
highlight = function(ctx)
|
highlight = function(ctx)
|
||||||
local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
|
local _, hl, _ = require('mini.icons').get('lsp', ctx.kind)
|
||||||
return hl
|
return hl
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
kind = {
|
kind = {
|
||||||
highlight = function(ctx)
|
highlight = function(ctx)
|
||||||
local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
|
local _, hl, _ = require('mini.icons').get('lsp', ctx.kind)
|
||||||
return hl
|
return hl
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
signature = {
|
signature = {
|
||||||
window = { border = "rounded" },
|
window = { border = 'rounded' },
|
||||||
},
|
},
|
||||||
keymap = {
|
keymap = {
|
||||||
preset = "none",
|
preset = 'none',
|
||||||
["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" },
|
['<S-Tab>'] = { 'select_prev', 'snippet_backward', 'fallback' },
|
||||||
["<Tab>"] = { "select_next", "snippet_forward", "fallback" },
|
['<Tab>'] = { 'select_next', 'snippet_forward', 'fallback' },
|
||||||
["<CR>"] = { "accept", "fallback" },
|
['<CR>'] = { 'accept', 'fallback' },
|
||||||
["<C-space>"] = { "hide", "show" },
|
['<C-space>'] = { 'hide', 'show' },
|
||||||
["<C-y>"] = { "show", "show_documentation", "hide_documentation" },
|
['<C-y>'] = { 'show', 'show_documentation', 'hide_documentation' },
|
||||||
["<C-u>"] = { "scroll_documentation_up", "fallback" },
|
['<C-u>'] = { 'scroll_documentation_up', 'fallback' },
|
||||||
["<C-d>"] = { "scroll_documentation_down", "fallback" },
|
['<C-d>'] = { 'scroll_documentation_down', 'fallback' },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
+18
-2
@@ -2,11 +2,10 @@ add({
|
|||||||
'OXY2DEV/markview.nvim', -- rendering for html and markdown
|
'OXY2DEV/markview.nvim', -- rendering for html and markdown
|
||||||
'serhez/bento.nvim', -- buffer manager
|
'serhez/bento.nvim', -- buffer manager
|
||||||
'akinsho/toggleterm.nvim', --float terminal
|
'akinsho/toggleterm.nvim', --float terminal
|
||||||
|
'nvzone/showkeys', -- show keystrokes
|
||||||
})
|
})
|
||||||
require('bento').setup({})
|
require('bento').setup({})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- lazy load markdown preview
|
-- lazy load markdown preview
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
pattern = 'markdown',
|
pattern = 'markdown',
|
||||||
@@ -45,4 +44,21 @@ require('toggleterm').setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- showkeys
|
||||||
|
require('showkeys').setup({
|
||||||
|
position = 'top-right',
|
||||||
|
show_count = true,
|
||||||
|
winopts = {
|
||||||
|
focusable = false,
|
||||||
|
relative = 'editor',
|
||||||
|
style = 'minimal',
|
||||||
|
border = 'single',
|
||||||
|
height = 1,
|
||||||
|
row = 1,
|
||||||
|
col = 0,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>ok', '<cmd>ShowkeysToggle<CR>', {
|
||||||
|
desc = 'Toggle Showkeys',
|
||||||
|
})
|
||||||
Reference in new issue
Block a user