Updated where leader key is set and made var in lv-settings (#474)

- Setting leader-key in the init.lua file. You want to set the leader as
  soon as possible so that it's the same everywhere. With the leader
  being set in the lua/lv-which-key/init.lua it resulted in mappings that
  used `<leader>` in the lua/keymappings.lua mapping the the defualt
  leader-key of `\`
- Added the O.leader_key to the lv-settings.lua file so the leader-key
  can be set there, which seems to make more sense.
- Added handling for when the leader-key is `<Space>`. This could be
  made more robust to include other special keys, but I don't think
  many/any of the other special keys would be used as a leader-key (ie
  <BS>, <CR>, <Tab>, <Esc>, <Up|Down|Right|Left>, etc.)

Co-authored-by: Christian Chiarulli <chris.machine@pm.me>
This commit is contained in:
Ian S. Pringle 2021-06-26 14:31:40 -04:00 committed by GitHub
parent 60175ee0d6
commit 2cf8580eb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View file

@ -1,5 +1,15 @@
require('lv-globals')
vim.cmd('luafile '..CONFIG_PATH..'/lv-settings.lua')
-- Set leader
if O.leader_key == ' ' or O.leader_key == 'space' then
vim.api.nvim_set_keymap('n', '<Space>', '<NOP>', {noremap = true, silent = true})
vim.g.mapleader = ' '
else
vim.api.nvim_set_keymap('n', O.leader_key, '<NOP>', {noremap = true, silent = true})
vim.g.mapleader = O.leader_key
end
require('settings')
require('lv-gitblame')
require('lv-matchup')
@ -34,8 +44,6 @@ if O.extras then
require('lv-vimtex')
end
-- TODO is there a way to do this without vimscript
vim.cmd('source '..CONFIG_PATH..'/vimscript/functions.vim')