pyratelog

personal blog
git clone git://git.pyratebeard.net/pyratelog.git
Log | Files | Refs | README

commit ab639d193500c5fb24cfb85df430f701dee9c3c8
parent a95fc7dab42d6186c1ddd2bf6e3caf6c34bb8c09
Author: pyratebeard <root@pyratebeard.net>
Date:   Thu, 20 Oct 2022 15:39:34 +0100

shell_shocked

Diffstat:
Aentry/shell_shocked.md | 23+++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)

diff --git a/entry/shell_shocked.md b/entry/shell_shocked.md @@ -0,0 +1,23 @@ +I didn't know that vim could open a terminal in a window split. + +Usually I have vim in a tmux session so can split the tmux window to get a terminal. Occasionally I would use `:shell`, which opens a shell in the current terminal but backgrounds vim so you have to exit the shell to return. This is useful but it can be beneficial to keep your vim buffer open while running a command, and vim may not be in a tmux session. + +As of vim 8.2 the terminal feature is natively supported. Neovim also has this feature natively. To see if your vim has this feature incant the following in vim +``` +:echo has('terminal') +``` + +If the output is `1` then you have the terminal feature. + +To simply open a terminal in a window split incant +``` +:terminal +``` +or +``` +:term +``` + +You can append a command, which once completed will open the output in vim ready for editing. + +This is a cool feature, and even though it has been around a while now it is fun to always be learning vim.