The best about :terminal for me is that I can use vim controls to navigate and search output and also visual mode for copying output.
Also really nice is that you can define shortcuts or macros that execute things in the terminal.
When I run :terminal in a vertical split I like to use it for things like go test. Then I define a macro like this qq^Li^P^M^[^Hq and I can use @q to re run the tests.
I think it's also important to allow ESC key to get out of terminal mode:
" `ESC` in terminal to exit insert mode
" Can still escape in nested vim using ctrl-c
if has('nvim')
tnoremap <esc> <C-\><C-n>
endif
And I use these shortcuts to quickly open a terminal:
" Go terminal - Open a terminal v-split
nnoremap gt :term<Space>
" Opens terminal and runs selction as cmd
vnoremap gt "ty<C-W>v:term <C-R>t<CR>
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The best about
:terminal
for me is that I can use vim controls to navigate and search output and also visual mode for copying output.Also really nice is that you can define shortcuts or macros that execute things in the terminal.
When I run
:terminal
in a vertical split I like to use it for things likego test
. Then I define a macro like thisqq^Li^P^M^[^Hq
and I can use@q
to re run the tests.I think it's also important to allow ESC key to get out of terminal mode:
And I use these shortcuts to quickly open a terminal: