vim: add mapping to display syntax highlighting groups
This commit is contained in:
parent
ac34dfeeaa
commit
45ed3965f0
2 changed files with 12 additions and 0 deletions
|
@ -64,3 +64,6 @@ nmap { '<leader>ev', '<cmd>tabedit ~/.config/nvim/init.lua<cr>' }
|
|||
nmap { '<leader>es', '<cmd>tabedit ~/.config/nvim/spell/en.utf-8.add<cr>' }
|
||||
nmap { '<leader>ez', '<cmd>tabedit ~/.config/zsh/.zshrc<cr>' }
|
||||
|
||||
-- show syntax highlight groups for symbol under the cursor
|
||||
nmap { '<leader>sh', '<cmd>lua require"fs.util".syntax_stack()<cr>' }
|
||||
|
||||
|
|
|
@ -62,5 +62,14 @@ M.highlight = function(group, highlights)
|
|||
vim.cmd(cmd)
|
||||
end
|
||||
|
||||
M.syntax_stack = function()
|
||||
local line = vim.fn.line('.')
|
||||
local col = vim.fn.col('.')
|
||||
if vim.fn.exists("*synstack") then
|
||||
local ids = vim.fn.synstack(line, col)
|
||||
P(vim.fn.map(ids, 'synIDattr(v:val, "name")'))
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue