From e3bad09e9fc7cdceafd59992d8d10c34f51fc597 Mon Sep 17 00:00:00 2001 From: Andy Teijelo Date: Thu, 10 Nov 2022 12:02:57 -0500 Subject: [PATCH] Add keymap to clean screen n to hide signcolumn, line numbers and virtual text --- lua/user/keymaps.lua | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index b3ac209..40ec4e1 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -99,10 +99,10 @@ keymap("n", "", "lua require'dap'.terminate()", opts) -- Shift+F5 --keymap("n", "di", "VimspectorBalloonEval", opts) -- move.nvim -vim.keymap.set('n', '', ':MoveLine(1)', opts) -vim.keymap.set('n', '', ':MoveLine(-1)', opts) -vim.keymap.set('x', '', ':MoveBlock(1)', opts) -vim.keymap.set('x', '', ':MoveBlock(-1)', opts) +keymap('n', '', ':MoveLine(1)', opts) +keymap('n', '', ':MoveLine(-1)', opts) +keymap('x', '', ':MoveBlock(1)', opts) +keymap('x', '', ':MoveBlock(-1)', opts) -- disable arrow keys keymap("n", "", "", opts) @@ -124,10 +124,19 @@ keymap("i", "", "", opts) keymap("i", "", "gj", opts) keymap("i", "", "gk", opts) --- gitsigns --- vim.keymap.set('n', 'hp', 'Gitsigns preview_hunk', opts) --- vim.keymap.set('n', 'hb', function() gs.blame_line{full=false} end, opts) --- vim.keymap.set('n', 'hB', function() gs.blame_line{full=true} end, opts) +local function clean_screen() + vim.o.number = not vim.o.number; + --if not vim.diagnostic.get_next() then return end + if vim.o.number then + vim.diagnostic.show() + vim.opt.signcolumn = "yes" + else + vim.diagnostic.hide() + vim.opt.signcolumn = "no" + end +end + +keymap("n", "n", clean_screen, opts) local function otherkeymaps() local ok