your text
I am pretty new to neovim so apologies :) I have to run a command using a plugin ToggleTerm (for a terminal)
:ToggleTerm direction=vertical size=50 dir=~/Desktop
which i can manually run but its to long to type out, for this reason I tried to set a keymap
vim.keymap.set("n", "<leader>t", vim.cmd [[ToggleTerm direction=vertical size=50 dir=~/Desktop]])
but my lsp says 'cannot assign nil
to parameter string | function
' and when i try to do :so
it gives me an error
Is there any way i can fix this ? any feedback is appreciated
(Sorry if this already has been asked, i cannot find this specific question anywhere)
SEe examples https://neovim.io/doc/user/lua.html#vim.keymap.set() . vim.cmd
executes the function now and returns nil
. You want to pass a handle to a function to execute later when the keymap is pressed.
vim.keymap.set("n", "<leader>t", function() vim.cmd [[ToggleTerm direction=vertical size=50 dir=~/Desktop]] end)