pyratelog

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

20221020-shell_shocked.md (1168B)


      1 I didn't know that [vim](TK){target="_blank" rel="noreferrer"} could open a terminal in a window split.
      2 
      3 Usually I have vim in a [tmux](TK){target="_blank" rel="noreferrer"} 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 buffer open while running a command, and vim may not be in a tmux session.
      4 
      5 As of vim 8 the terminal feature is natively supported.  Neovim also has this feature natively.  To see if your vim has this feature incant the following
      6 ```
      7 :echo has('terminal')
      8 ```
      9 
     10 If the output is `1` then you have it.
     11 
     12 To simply open a terminal in a split incant
     13 ```
     14 :terminal
     15 ```
     16 or
     17 ```
     18 :term
     19 ```
     20 
     21 You can append a command, which once completed will open the output in a buffer ready for editing.
     22 
     23 This is a cool feature, and I will probably use it quite a bit.  It is great fun to be constantly learning vim, even finding features that have been around for a while.
     24 
     25 For more information on the terminal feature check out the help page
     26 ```
     27 :help terminal
     28 ```