Skip to content

Instantly share code, notes, and snippets.

View TrevorHurst's full-sized avatar
😎
Big Chillin'

Trevor Hurst TrevorHurst

😎
Big Chillin'
View GitHub Profile
@TrevorHurst
TrevorHurst / Neovim terminal tab context switcher.md
Last active November 7, 2024 21:28
NVIM terminal tab context switcher

The following code is a remap to allow Ctrl+j to open a terminal tab which you can switch in and out of in vim. This is similar to VSCode's Ctrl+j shortcut but it is a full screen switch; it would be easier to implement it how VSCode does it but I like this better. Feel free to use this at your leisure!

Last_active_buffer = nil  -- Variable to store the last active buffer

local function toggle_terminal_window()
        -- Save the currently active buffer before switching to the terminal
        Last_active_buffer = vim.api.nvim_get_current_buf()

Keybase proof

I hereby claim:

  • I am trevorhurst on github.
  • I am tshurst (https://keybase.io/tshurst) on keybase.
  • I have a public key ASC2lQsjP0DgQ1K3Hf1KTYl7KIaX55k4iPPCK05zwBKeIQo

To claim this, I am signing this object: