mirror of
https://github.com/jbranchaud/til
synced 2026-01-02 22:58:01 +00:00
Add Use The Terminal Inside A Vim Session as a Vim til
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
|
||||
|
||||
_1067 TILs and counting..._
|
||||
_1068 TILs and counting..._
|
||||
|
||||
---
|
||||
|
||||
@@ -1216,6 +1216,7 @@ _1067 TILs and counting..._
|
||||
- [Turning Off Search Highlighting](vim/turning-off-search-highlighting.md)
|
||||
- [Unloading A Buffer](vim/unloading-a-buffer.md)
|
||||
- [Use Active Window With BufExplorer](vim/use-active-window-with-bufexplorer.md)
|
||||
- [Use The Terminal Inside A Vim Session](vim/use-the-terminal-inside-a-vim-session.md)
|
||||
- [Using vim-surround With A Visual Selection](vim/using-vim-surround-with-a-visual-selection.md)
|
||||
- [Verbose Commits With Fugitive](vim/verbose-commits-with-fugitive.md)
|
||||
- [View Commit History of a File](vim/view-commit-history-of-a-file.md)
|
||||
|
||||
26
vim/use-the-terminal-inside-a-vim-session.md
Normal file
26
vim/use-the-terminal-inside-a-vim-session.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Use The Terminal Inside A Vim Session
|
||||
|
||||
With [the release of Vim 8.1](https://www.vim.org/vim-8.1-released.php) comes
|
||||
the ability to open a terminal window _within_ a Vim session.
|
||||
|
||||
The `:terminal` command (or `:term` for short) opens up a buffer window that
|
||||
looks like a strange mix between any old Vim session and your terminal's shell
|
||||
prompt.
|
||||
|
||||
Once the `:terminal` window is open, you can hit `i` to switch to
|
||||
_terminal-mode_. This puts the cursor on the shell prompt so that you can start
|
||||
executing shell commands. Once in this mode, you most of your keybindings will
|
||||
be ignored as Vim is providing terminal emulation.
|
||||
|
||||
Once you are done with the terminal, you can type `exit` like you would in any
|
||||
other shell and it will terminate that process.
|
||||
|
||||
Alternatively, you can hit `Ctrl-\ Ctrl-n` which takes you out of terminal-mode
|
||||
and back into Normal mode. From here, you can use all the Vim things to
|
||||
navigate, search, yank, etc. from the terminal output.
|
||||
|
||||
You can also (if `hidden` is set), switch to another buffer. The Vim `:term`
|
||||
buffer is preserved and you can return to it later, hitting `i` to start
|
||||
interacting with it again.
|
||||
|
||||
See `:h :term` for more details.
|
||||
Reference in New Issue
Block a user