Problem
I am trying to map the F10
key with theterminal bash %
command so I can execute the current open file with bash in a split pane setup (this functions works). The problem is when I try to add the key combo CTRL-W R
to swap the vim pane positions in the mapping, the positions do not swap. When I type CTRL-W R
manually, it works.
This is the line that I have in my .vimrc
nnoremap <F10> :terminal bash % <cr> <C-w> <C-r>
I have also tried adding a pipe and changing noremap
to map
but that did not solve anything.
map <F10> :terminal bash % <cr> | <C-w> r
Question
Is is there a way to combine Vim commands (eg :terminal bash %
) with CTRL-W R
in a single nnoremap
line?
<C-w>...
commands for normal mode operations since it's a normal mode command. In the command like you should try to use:h :wincmd
instead (this is why this command exists). Otherwise the right approach to execute normal mode commands in the command line is to use:h :normal
:nnoremap <f10> :terminal bash %<enter><C-w>r
) does it work?:terminal bash %
. tThat paned seemed to have been locked which prevented<C-w>r
. It also prevented me from typing any command with:
. I would have to CTRL-WW to go back to the original pane to swap positions.