From 6bf4873b273e7a3331c7eeacb282e926a4d45ae2 Mon Sep 17 00:00:00 2001 From: utensil Date: Fri, 25 Oct 2024 22:29:31 +0800 Subject: [PATCH] Local leader key --- init.lua | 5 +++-- lazyvim-init.lua | 6 ++++++ trees/uts-002F.tree | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 69f21e8..c274a94 100644 --- a/init.lua +++ b/init.lua @@ -15,8 +15,9 @@ for k, v in pairs(options) do end -- set local leader - -vim.g.maplocalleader = " " +if vim.g.maplocalleader == nil then + vim.g.maplocalleader = " " +end -- https://github.com/LunarVim/Neovim-from-scratch/blob/master/lua/user/keymaps.lua diff --git a/lazyvim-init.lua b/lazyvim-init.lua index c30fa87..b50210c 100644 --- a/lazyvim-init.lua +++ b/lazyvim-init.lua @@ -2,7 +2,13 @@ local current_file = debug.getinfo(1, "S").source:sub(2) local current_dir = current_file:match "(.*/)" package.path = package.path .. ";" .. current_dir .. "?.lua" +-- override local leader before loading LazyVim, doesn't work, has to be in lua/lazyvim/config/options.lua +-- vim.g.maplocalleader = " " + +-- loading LazyVim dofile(current_dir .. "init.lua") + +-- override other settings after loading LazyVim dofile(current_dir .. "nvim-init.lua") vim.schedule(function() diff --git a/trees/uts-002F.tree b/trees/uts-002F.tree index 2e44a8d..84395cf 100644 --- a/trees/uts-002F.tree +++ b/trees/uts-002F.tree @@ -40,9 +40,9 @@ The leader key is used to trigger many key mappings in normal mode. The default leader key is a single space, represented by `` below. -๐ŸŒ•The default local leader key is not set. ๐Ÿ’คThe default local leader key is set to backslash. +๐ŸŒ• The default local leader key is not set. I've configure it to be two consecutive spaces. `,` is also a common choice. -I've configure it to be two consecutive spaces. `,` is also a common choice. +๐Ÿ’ค The default local leader key is set to backslash. I didn't change it. With plugin `whichkey` installed, `` and wait to see some useful mappings.