Skip to content

Instantly share code, notes, and snippets.

@mahemoff
Last active October 24, 2025 20:08
Show Gist options
  • Save mahemoff/8967b5de067cffc67cec174cb3a9f49d to your computer and use it in GitHub Desktop.
Save mahemoff/8967b5de067cffc67cec174cb3a9f49d to your computer and use it in GitHub Desktop.

Revisions

  1. mahemoff revised this gist Jan 23, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ tmap <Leader>T <c-w>:tab term ++close<cr>

    # Navigation Tips

    To be proficient with this, get familiar with Vim's regular window and tab features because terminal is built directly on top of them. The terminmal is just another editor window with some special handling.
    To be proficient with this, get familiar with Vim's regular window and tab features because terminal is built directly on top of them. The terminal is just another editor window with some special handling.

    With terminal in a split window, you can use Vim's regular window commands, e.g. `ctrl-w n` and `ctrl-w p` to move between next and previous windows in the current tab (which could be a regular editing window or another terminal, it doesn't matter). See `:help windows`.

  2. mahemoff revised this gist Oct 31, 2020. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -36,4 +36,6 @@ Use `ctrl-w N` to switch to "terminal-normal mode", which will let you navigate

    `ctrl-w :` will open command mode like in regular Vim.

    `ctrl-w ""` will paste, which is useful if you want to enter something from a file in another window. More generally, you can paste recent or saved clipboard contents using `:ctrl-w " {reg}`, where `reg` identifies the register to paste. Type `ctrl-w :display` (or `ctrl-w :dis`) to see all available registers and their content.
    `ctrl-w ""` will paste, which is useful if you want to enter something from a file in another window. More generally, you can paste recent or saved clipboard contents using `:ctrl-w " {reg}`, where `reg` identifies the register to paste. Type `ctrl-w :display` (or `ctrl-w :dis`) to see all available registers and their content.

    <img src='https://i.imgur.com/TJ8Zd8B.jpg'>
  3. mahemoff revised this gist Oct 31, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -10,15 +10,15 @@ Why use this? Mainly because it saves you jumping to a separate terminal window.

    Here are some simple key bindings to help you spin up a new terminal easily. As they use the `++close` option, they'll automatically exit when the terminal exits, so just type `exit` or `ctrl-D`. Or to force-close it via Vim, `ctrl-w q!`

    <pre>
    ```vim
    " vim-powered terminal in split window
    map <Leader>t :term ++close<cr>
    tmap <leader>t <c-w>:term ++close<cr>
    tmap <Leader>t <c-w>:term ++close<cr>
    " vim-powered terminal in new tab
    map <Leader>T :tab term ++close<cr>
    tmap <Leader>T <c-w>:tab term ++close<cr>
    </pre>
    ```

    # Navigation Tips

  4. mahemoff revised this gist Oct 31, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Background
    # Vim has a Terminal Mode!

    Since v8.1 (May 2018), Vim has shipped with a built-in terminal. See https://vimhelp.org/terminal.txt.html or type `:help terminal` for more info.

  5. mahemoff revised this gist Oct 31, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -32,8 +32,8 @@ With terminal in a separate tab, again it's just regular Vim stuff. You can navi

    Mostly you'll use the terminal like any other terminal and just type in shell commands and so on. There's a few optional extras that will help you interact with the rest of Vim.

    Use `:ctrl-w N` to switch to "terminal-normal mode", which will let you navigate around. It could be useful to then copy content to the clipboard. Then return to regular terminal mode, simply type `i` just like how you'd enter insert mode from a regular window.
    Use `ctrl-w N` to switch to "terminal-normal mode", which will let you navigate around. It could be useful to then copy content to the clipboard. Then return to regular terminal mode, simply type `i` just like how you'd enter insert mode from a regular window.

    `:ctrl-w :` will open command mode like in regular Vim.
    `ctrl-w :` will open command mode like in regular Vim.

    `:ctrl-w ""` will paste, which is useful if you want to enter something from a file in another window. More generally, you can paste recent or saved clipboard contents using `:ctrl-w " {reg}`, where `reg` identifies the register to paste. Type `ctrl-w :display` (or `ctrl-w :dis`) to see all available registers and their content.
    `ctrl-w ""` will paste, which is useful if you want to enter something from a file in another window. More generally, you can paste recent or saved clipboard contents using `:ctrl-w " {reg}`, where `reg` identifies the register to paste. Type `ctrl-w :display` (or `ctrl-w :dis`) to see all available registers and their content.
  6. mahemoff revised this gist Oct 31, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ Why use this? Mainly because it saves you jumping to a separate terminal window.

    # Key Bindings

    These are some simple key bindings to help you spin up a new terminal easily. As they use the `++close` option, they'll automatically exit when the terminal exits, so just type `exit` or `ctrl-D`. Or to force-close it via Vim, `ctrl-w q!`
    Here are some simple key bindings to help you spin up a new terminal easily. As they use the `++close` option, they'll automatically exit when the terminal exits, so just type `exit` or `ctrl-D`. Or to force-close it via Vim, `ctrl-w q!`

    <pre>
    " vim-powered terminal in split window
  7. mahemoff revised this gist Oct 31, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,8 @@ Since v8.1 (May 2018), Vim has shipped with a built-in terminal. See https://vim

    Why use this? Mainly because it saves you jumping to a separate terminal window. You can also use Vim commands to manipulate a shell session and easily transfer clipboard content between the terminal and files you're working on.

    <img width='600' src='https://i.imgur.com/nS6getn.png' />

    # Key Bindings

    These are some simple key bindings to help you spin up a new terminal easily. As they use the `++close` option, they'll automatically exit when the terminal exits, so just type `exit` or `ctrl-D`. Or to force-close it via Vim, `ctrl-w q!`
  8. mahemoff created this gist Oct 31, 2020.
    37 changes: 37 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    # Background

    Since v8.1 (May 2018), Vim has shipped with a built-in terminal. See https://vimhelp.org/terminal.txt.html or type `:help terminal` for more info.

    Why use this? Mainly because it saves you jumping to a separate terminal window. You can also use Vim commands to manipulate a shell session and easily transfer clipboard content between the terminal and files you're working on.

    # Key Bindings

    These are some simple key bindings to help you spin up a new terminal easily. As they use the `++close` option, they'll automatically exit when the terminal exits, so just type `exit` or `ctrl-D`. Or to force-close it via Vim, `ctrl-w q!`

    <pre>
    " vim-powered terminal in split window
    map <Leader>t :term ++close<cr>
    tmap <leader>t <c-w>:term ++close<cr>

    " vim-powered terminal in new tab
    map <Leader>T :tab term ++close<cr>
    tmap <Leader>T <c-w>:tab term ++close<cr>
    </pre>

    # Navigation Tips

    To be proficient with this, get familiar with Vim's regular window and tab features because terminal is built directly on top of them. The terminmal is just another editor window with some special handling.

    With terminal in a split window, you can use Vim's regular window commands, e.g. `ctrl-w n` and `ctrl-w p` to move between next and previous windows in the current tab (which could be a regular editing window or another terminal, it doesn't matter). See `:help windows`.

    With terminal in a separate tab, again it's just regular Vim stuff. You can navigate Vim's regular window commands, e.g. `<c-w> n` and `<c-w> p` to move between next and previous windows in the current tab (which could be a regular editing window or another terminal, it doesn't matter). See `:help tabpage`.

    # In-Terminal Tips

    Mostly you'll use the terminal like any other terminal and just type in shell commands and so on. There's a few optional extras that will help you interact with the rest of Vim.

    Use `:ctrl-w N` to switch to "terminal-normal mode", which will let you navigate around. It could be useful to then copy content to the clipboard. Then return to regular terminal mode, simply type `i` just like how you'd enter insert mode from a regular window.

    `:ctrl-w :` will open command mode like in regular Vim.

    `:ctrl-w ""` will paste, which is useful if you want to enter something from a file in another window. More generally, you can paste recent or saved clipboard contents using `:ctrl-w " {reg}`, where `reg` identifies the register to paste. Type `ctrl-w :display` (or `ctrl-w :dis`) to see all available registers and their content.