From: Huck Boles Date: Mon, 17 Apr 2023 15:56:36 +0000 (-0500) Subject: lsp toggle keymap X-Git-Url: https://git.huck.website/?a=commitdiff_plain;h=8da8d74858546f9a940feb658fc438b35e55d672;p=nvim.git lsp toggle keymap --- diff --git a/lua/map.lua b/lua/map.lua index 222793d..7edea0a 100644 --- a/lua/map.lua +++ b/lua/map.lua @@ -5,44 +5,53 @@ vim.keymap.set( 'n', 't', ':tabnew ' ) vim.keymap.set( 'n', 'B', 'bnext' ) -- move through virtual lines -vim.keymap.set( 'n', 'j', 'gj' ) -vim.keymap.set( 'n', 'k', 'gk' ) +vim.keymap.set( 'n', 'j', 'gj' ) +vim.keymap.set( 'n', 'k', 'gk' ) -- quick redo last macro -vim.keymap.set( 'n', 'Q', '@@' ) +vim.keymap.set( 'n', 'Q', '@@' ) -- center the screen for movement commands -vim.keymap.set( 'n', '', 'za' ) -vim.keymap.set( 'n', 'n', 'nzz' ) -vim.keymap.set( 'n', 'N', 'Nzz' ) -vim.keymap.set( 'n', '', 'zz' ) -vim.keymap.set( 'n', '', 'zz' ) -vim.keymap.set( 'n', '', 'zz' ) -vim.keymap.set( 'n', '', 'zz' ) +vim.keymap.set( 'n', '', 'za' ) +vim.keymap.set( 'n', 'n', 'nzz' ) +vim.keymap.set( 'n', 'N', 'Nzz' ) +vim.keymap.set( 'n', '', 'zz' ) +vim.keymap.set( 'n', '', 'zz' ) +vim.keymap.set( 'n', '', 'zz' ) +vim.keymap.set( 'n', '', 'zz' ) -- normal mode line splitting and joining -vim.keymap.set( 'n', 'H', 'izzO' ) -vim.keymap.set( 'n', 'L', 'izzi' ) -vim.keymap.set( 'n', 'K', 'Jx' ) +vim.keymap.set( 'n', 'H', 'izzO' ) +vim.keymap.set( 'n', 'L', 'izzi' ) +vim.keymap.set( 'n', 'K', 'Jx' ) -- toggle ui elements -vim.keymap.set( 'n', '_', 'nohlsearch' ) +vim.keymap.set( 'n', '_', 'nohlsearch' ) -- quick plugin editing vim.keymap.set( 'n', '=', 'tabnew ~/.config/nvim/init.lua' ) vim.keymap.set( 'n', 'q', 'Lazy' ) -- autosave -vim.keymap.set( 'i', '', 'update' ) +vim.keymap.set( 'i', '', 'update' ) -- better terminal movement keys -vim.keymap.set('t', '', [[]], opts) -vim.keymap.set('t', '', [[]], opts) +vim.keymap.set('t', '', [[]] ) +vim.keymap.set('t', '', [[]] ) -- lsp diagnostic navigation -vim.keymap.set('n', 'n', vim.diagnostic.goto_next, opts) -vim.keymap.set('n', 'p', vim.diagnostic.goto_prev, opts) -vim.keymap.set('n', 'd', vim.diagnostic.hide, opts) -vim.keymap.set('n', 'D', vim.diagnostic.show, opts) -vim.keymap.set('n', 'R', vim.lsp.buf.rename, opts) -vim.keymap.set('n', 'k', vim.lsp.buf.hover) +vim.keymap.set('n', 'n', vim.diagnostic.goto_next ) +vim.keymap.set('n', 'p', vim.diagnostic.goto_prev ) +vim.keymap.set('n', 'R', vim.lsp.buf.rename ) +vim.keymap.set('n', 'k', vim.lsp.buf.hover ) +vim.keymap.set('n', 'd', + function() + if vim.g.visible_diagnostics then + vim.diagnostic.disable() + vim.g.visible_diagnostics = false + else + vim.diagnostic.enable() + vim.g.visible_diagnostics = true + end + end, +opts) diff --git a/lua/settings.lua b/lua/settings.lua index f860d1f..25c5792 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -6,6 +6,8 @@ vim.g.netrw_browse_split = 4 vim.g.netrw_winsize = 20 vim.g.netrw_liststyle = 4 +vim.g.visible_diagnostics = true + vim.o.mousefocus = true vim.o.mousemodel= 'extend'