From 6347a00023002fa4d609cfebd031c14d6618f32c Mon Sep 17 00:00:00 2001 From: siduck Date: Sat, 4 Dec 2021 21:04:04 +0530 Subject: [PATCH] add mapping, highlights for keybind cheatsheet | disable indentline in it --- lua/colors/highlights.lua | 24 ++++++++++++++++++++++-- lua/core/default_config.lua | 1 + lua/core/mappings.lua | 2 +- lua/plugins/configs/others.lua | 1 + 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lua/colors/highlights.lua b/lua/colors/highlights.lua index 5d2fcd0..75e5580 100644 --- a/lua/colors/highlights.lua +++ b/lua/colors/highlights.lua @@ -21,6 +21,7 @@ local purple = colors.purple local red = colors.red local white = colors.white local yellow = colors.yellow +local orange = colors.orange local one_bg3 = colors.one_bg3 -- functions for setting highlights @@ -45,7 +46,7 @@ fg("EndOfBuffer", black) -- For floating windows fg("FloatBorder", blue) -bg("NormalFloat", one_bg) +bg("NormalFloat", darker_black) -- Pmenu bg("Pmenu", one_bg) @@ -138,10 +139,29 @@ bg("TelescopeNormal", darker_black) fg_bg("TelescopePreviewTitle", black, green) fg_bg("TelescopePromptTitle", black, red) -fg_bg("TelescopeResultsTitle", darker_black,darker_black) +fg_bg("TelescopeResultsTitle", darker_black, darker_black) bg("TelescopeSelection", black2) +-- keybinds cheatsheet + +fg_bg("CheatsheetBorder", black, black) +bg("CheatsheetSectionContent", black) +fg("CheatsheetHeading", white) + +local section_title_colors = { + white, + blue, + red, + green, + yellow, + purple, + orange, +} +for i, color in ipairs(section_title_colors) do + vim.cmd("highlight CheatsheetTitle" .. i .. " guibg = " .. color .. " guifg=" .. black) +end + -- Disable some highlight in nvim tree if transparency enabled if ui.transparency then bg("NvimTreeNormal", "NONE") diff --git a/lua/core/default_config.lua b/lua/core/default_config.lua index 6c73a9d..1791f7e 100644 --- a/lua/core/default_config.lua +++ b/lua/core/default_config.lua @@ -116,6 +116,7 @@ M.mappings = { -- custom = {}, -- custom user mappings misc = { + cheatsheet = "ch", close_buffer = "x", copy_whole_file = "", -- copy all contents of current buffer line_number_toggle = "n", -- toggle line number diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 0036234..9e5f84a 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -31,7 +31,6 @@ M.misc = function() map("n", "", ":noh ") -- center cursor when moving (goto_definition) - -- yank from current cursor to end of line map("n", "Y", "yg$") @@ -81,6 +80,7 @@ M.misc = function() end local function required_mappings() + map("n", maps.misc.cheatsheet, ":lua require('nvchad.cheatsheet').show() ") -- show keybinds map("n", maps.misc.close_buffer, ":lua require('core.utils').close_buffer() ") -- close buffer map("n", maps.misc.copy_whole_file, ":%y+ ") -- copy whole file content map("n", maps.misc.new_buffer, ":enew ") -- new buffer diff --git a/lua/plugins/configs/others.lua b/lua/plugins/configs/others.lua index e44ed8e..310118f 100644 --- a/lua/plugins/configs/others.lua +++ b/lua/plugins/configs/others.lua @@ -33,6 +33,7 @@ M.blankline = function() "lspinfo", "TelescopePrompt", "TelescopeResults", + "nvchad_cheatsheet", }, buftype_exclude = { "terminal" }, show_trailing_blankline_indent = false,