0

I am editing a DocBook XML file and want to validate it by running a custom command validate_cmd. In my plugin, i'm running the following:

let term_buff_no = term_start(validate_cmd, {'term_rows': 10})

The problem is that i dont want the vim to focus the newly opened terminal buffer but instead keep the editing buffer opened and continue working. How to do that?

2
  • What about :normal! <C-w>p?
    – husB
    Jun 22 at 14:15
  • 1
    @husB aka :wincmd p
    – D. Ben Knoble
    Jun 22 at 16:20

1 Answer 1

0

After the terminal buffer is opened, you can switch back to the previous window with the keys <C-w>p.

For non-interactive use (such as in a script), you may append those keystrokes with :normal! <C-w>p. Equivalently -- as Ben mentioned in the comments -- you may use :wincmd p.


FYI, from the documentation of :normal,

:norm[al][!] {commands}                 *:norm* *:normal*
            Execute Normal mode commands {commands}.  This makes
            it possible to execute Normal mode commands typed on
            the command-line.  

            If the [!] is given, mappings will not be used.

and from the documentation of :wincmd,

:[count]winc[md] {arg}
        Like executing CTRL-W [count] {arg}.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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