nvim: Improve diagnostic sign click
This commit is contained in:
parent
68b7947137
commit
4038101664
3 changed files with 16 additions and 7 deletions
|
@ -12,7 +12,9 @@
|
||||||
(vim.diagnostic.config {:underline true
|
(vim.diagnostic.config {:underline true
|
||||||
:virtual_text false
|
:virtual_text false
|
||||||
:signs true
|
:signs true
|
||||||
:float {:border :rounded :source true}
|
:float {:border :rounded
|
||||||
|
:source true
|
||||||
|
:focusable false}
|
||||||
:update_in_insert false
|
:update_in_insert false
|
||||||
:severity_sort true})
|
:severity_sort true})
|
||||||
(sign "define DiagnosticSignError text= texthl=DiagnosticSignError linehl= numhl=")
|
(sign "define DiagnosticSignError text= texthl=DiagnosticSignError linehl= numhl=")
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
{:desc "Show Diagnostics"})
|
{:desc "Show Diagnostics"})
|
||||||
(keymap.set :n :<leader>dli :<cmd>LspInfo<CR> {:desc "LSP Info"})
|
(keymap.set :n :<leader>dli :<cmd>LspInfo<CR> {:desc "LSP Info"})
|
||||||
(keymap.set :n :<leader>dlr :<cmd>LspRestart<CR> {:desc "Restart LSP"})
|
(keymap.set :n :<leader>dlr :<cmd>LspRestart<CR> {:desc "Restart LSP"})
|
||||||
|
(keymap.set :n :<leader>ds #(vim.diagnostic.open_float {:scope :line})
|
||||||
|
{:desc "Show Diagnostics"})
|
||||||
(keymap.set :n :<leader>dtp :<cmd>TSPlaygroundToggle<CR>
|
(keymap.set :n :<leader>dtp :<cmd>TSPlaygroundToggle<CR>
|
||||||
{:desc "Toggle Treetsitter Playground"})
|
{:desc "Toggle Treetsitter Playground"})
|
||||||
(keymap.set :n :<leader>dn #(noice.cmd :telescope)
|
(keymap.set :n :<leader>dn #(noice.cmd :telescope)
|
||||||
|
|
|
@ -61,11 +61,16 @@
|
||||||
$1.sign.name)
|
$1.sign.name)
|
||||||
:on_click {:name :heirline_statuscolumn_diagnostic
|
:on_click {:name :heirline_statuscolumn_diagnostic
|
||||||
:callback (fn [self]
|
:callback (fn [self]
|
||||||
(let [mouse (vim.fn.getmousepos)]
|
(let [mouse (vim.fn.getmousepos)
|
||||||
(vim.schedule #(vim.diagnostic.open_float {:bufnr self.bufnr
|
line (- mouse.line 1)
|
||||||
:pos (- mouse.line
|
cursor-pos [mouse.line 0]]
|
||||||
1)
|
(api.nvim_win_set_cursor mouse.winid
|
||||||
:scope :line
|
cursor-pos)
|
||||||
:focusable false}))))}})
|
(vim.schedule #(vim.diagnostic.goto_next {:win_id mouse.winid
|
||||||
|
:float false}))
|
||||||
|
(vim.defer_fn #(vim.diagnostic.open_float {:bufnr self.bufnr
|
||||||
|
:pos line
|
||||||
|
:scope :line})
|
||||||
|
200)))}})
|
||||||
mod)
|
mod)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue