Terminal in neovim
Ocasionally I will sideline my WM1 (XMonad) or terminal multiplexer (tmux) in order to start a terminal session in nvim itself.
Sometimes it pays to use neovim’s builtin terminals because
- when already in neovim and in need of a terminal in order to quickly move forward with whatever it is I’m trying to do, it is convenient to spawn one and get shit done :poop:
- moving the neovim window around between workspaces or displays will always keep the related terminal close (i.e: I don’t have to move two windows around) or consider how to move the editor into a tmux session and then split it
- yanking text between buffers is a breeze
Start a neovim terminal through the :terminal command in neovim. You’ll get
dropped into insert mode so do yourself a favor and use the
Ctrl+\ Ctrl+n sequence to exit into normal mode. Of course, once in
normal mode you may return to insert mode using any of the keybindings that
you’re most comfortable with (in my case a or i).
Another, perhaps more practical, way to spawn a terminal is by using the
term scheme. Opening a file prefixed with term:// will result into the section
prefixed by the term:// to be executed in the terminal as in
:vsplit term://zshspawning a zsh :ocean: shell :shell:,:split term://htopspawning htop in a terminal and:edit term://bashspawning a bash shell :shell:.
So in conclusion,
- use the
:terminalcommand to spawn a terminal or - open a
term://*file, where*represents the executable to call in the terminal,
and remember the following mappings for convenience’s sake: