From 9cfd7e2e4e986a4be06e3120c483524bc176ae43 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Wed, 5 Apr 2023 22:04:15 +0530 Subject: nvim: init.lua, add keybinding to toggle column 80 hint --- .config/nvim/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 51e4415..e083018 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -178,6 +178,15 @@ vim.o.termguicolors = true -- See `:help vim.keymap.set()` vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) +-- 80 column hint +vim.keymap.set('n', 'cc', function() + if vim.api.nvim_get_option_value('colorcolumn', {}) == '' then + vim.api.nvim_set_option_value('colorcolumn', '79', {}) + else + vim.api.nvim_set_option_value('colorcolumn', '', {}) + end +end, { desc = "[cc] Toggle 80 column hint" }) + -- Remap for dealing with word wrap vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) -- cgit v1.2.3