1

Say my cursor is in a Vim terminal.

Normally I press Ctrl w Ctrl w to flip to from the Vim terminal to my buffer.

How do I do that with vimscript?

I tried the whole CTRL+SHIFT+V thing when writing the vimscript and it only gives me a W when I press CTRL+W afterwards; I was expecting ^w.

6
  • CTRL+SHIFT+V giving you a W is quite surprising.
    – romainl
    Feb 23 at 18:00
  • @romainl Sorry bad wording; it's been fixed.
    – leeand00
    Feb 23 at 18:02
  • Why CTRL+SHIFT+V? It's CTRL+V.
    – romainl
    Feb 23 at 18:05
  • @romainl The SHIFT makes the V uppercase and gives you the green carrot.
    – leeand00
    Feb 23 at 18:13
  • It doesn't have to be uppercase. Control characters make no difference between uppercase and lowercase.
    – romainl
    Feb 23 at 18:20

2 Answers 2

1

I would do:

call feedkeys("\<C-w>w", "n")
1

I would do:

wincmd w

The :wincmd command is quite useful in Vim script, and as far as I know it's faster than using feedkeys().

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.