I am in the process of converting my init.vim over to lua files instead. One thing I have been getting hung up on is that I can’t seem to set the leader key. In my init.vim I have the leader key set to space using let mapleader = ' '. I have tried using the idiomatic vim.g.maplader = ' ' in my lua setup but it is not working.
I also tried setting the leader key by using my version from the init.vim wrapped in a Neovim cmd vim.cmd 'let mapleader = " "' and that has not worked either. I am sure I am probably just missing something here. Any ideas?
So I think I figured it out. A syntax error in another file seemed to be causing an issue? I won’t claim that I fully understand what happened here, cause I don’t , but my mapping of the leader key appears to be working as intended now with a simple vim.g.mapleader = ' '
In case someone finds this thread:
I made the mistake to set mapleader after setting the keymaps with vim.keymap.set. vim.g.mapleader = ' ' works for me if I put it before the calls to vim.keymap.set. If you configure vim with both lua and vimsript, I suppose you have to consider the order in which the files are loaded.