0

I try to create a shortcut in my Neovim config:

map <F3> :ALEFix<CR> :update<CR>

or

map<F3> :ALEFix<bar> :update<CR>

but when I press F3 command, the shortcuts are not executed at the same time. By first press goes ALEFix and by second update. How can I create shortcut which will run ALEFix and update one after another by one press?

Wanda Ichsanul Isra
  • 2,142
  • 10
  • 19

1 Answers1

0

Check Neovim vim.keymap.set()

vim.keymap.set("n","<F3>",function ()
    vim.cmd.ALEFix() --assuming a prebuilt cmd
    vim.cmd.update() -- will need to route to your actual cmd
end)

This is the format you're looking for.

For example in my lua file:

vim.keymap.set("n", "<leader>te",function ()
    vim.cmd.tabnew()
    vim.cmd.terminal()
end)

Which allow me to hit + t + e to open a new tab and terminal.

Yogev Neumann
  • 2,099
  • 2
  • 13
  • 24
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/34489705) – amycodes Jun 06 '23 at 17:18