0

This works, but it's pretty ugly, just wondering if there's a better way:

vim.cmd[[exec "g\<Tab>"]]

None of these work:

vim.cmd.normal("g<Tab>")
vim.cmd.normal("g\<Tab>")
vim.cmd.normal("g\\<Tab>")
vim.cmd.exec("normal g<Tab>")
vim.cmd.exec("normal g\<Tab>")
vim.cmd.exec("normal g\\<Tab>")
1
  • I’m actually shocked the first one works; that should be doing the equivalent of :global<Tab><enter> which is kind of meaningless. In Vim I would expect execute 'normal!' "g\<Tab>" to work, but that depends on Vim’s string processing. What happens if you embed a literal tab in your commands (actually typing something like normal! g<C-v><tab>)?
    – D. Ben Knoble
    Feb 27 at 21:29

1 Answer 1

1

Tab is simply a tab, so vim.cmd.normal"g\t" works.

Also, in general, you may want to make use of nvim_replace_termcodes() function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.