Skip to content

JetBrain's file switcher, for neovim ๐Ÿ˜ <C-Tab> like a pro and jump between open buffers โค๏ธ

License

Notifications You must be signed in to change notification settings

neovim-idea/switcher-nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

46 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

GitHub Tag Lua Neovim

switcher-nvim

JetBrain's file switcher, for neovim ๐Ÿ˜
DEFAULT (JetBrains) CHEVRON ICON MARGINS MIXED
default chevron icon margins mixed

Usage

Hit <C-Tab> to open the switcher; hit it some more to select the buffer you're interested into. If you don't do anything for 500ms (configurable, see below), the popup will close, and the selected buffer will be displayed.

<C-Tab> traverses buffers from the most recently opened, to the oldest; if you want to "go back" to a previous buffer in the list, simply hit <C-S-Tab> as many times as you need.

Also, <C-S-Tab> does open the switcher, but it will start from the bottom of the list (aka the oldest buffer you've opened).

Installation

Requirements:

Lazy

Important

The plugin must NOT be lazy loaded!

{
  "neovim-idea/switcher-nvim",
  lazy = false,
  dependencies = {
    "nvim-lua/plenary.nvim",
    "nvim-tree/nvim-web-devicons"
  },
}

Packer

use {
  "neovim-idea/switcher-nvim",
  requires = {
    "nvim-lua/plenary.nvim",
    "nvim-tree/nvim-web-devicons"
    }
}

Plug

Plug "nvim-lua/plenary.nvim"
Plug "nvim-tree/nvim-web-devicons"
Plug "neovim-idea/switcher-nvim"

Setup

switcher-nvim comes already with sensible configuration options; just remember to call require("switcher-nvim").setup() and that's it, and you're good to go!

However, in case you'd like to change shortcuts or indicator appearances, you can tweak the options here below:

return {
  "neovim-idea/switcher-nvim",
  config = function()
    require("switcher-nvim").setup({
      --[[General]]
      traverse_forwards = {
        mode = { "n", "i" },
        lhs = "<C-Tab>",
        opts = { noremap = true, desc = "Traverse Open Buffers from most recently accessed first" },
      },
      traverse_backwards = {
        mode = { "n", "i" },
        lhs = "<C-S-Tab>",
        opts = { noremap = true, desc = "Traverse Open Buffers from least recently accessed first" },
      },
      --[[Selection]]
      selection = {
        timeout_ms = 500,
        icon_margin_left = "", -- or "[", "<<<" ... any string, really :) 
        icon_margin_right  = "", -- or "]", ">>>" ...
        chevron = "", -- or "๓ฐ…‚" , "๓ฑžฉ", "-->" ...
      },
      --[[Borders]]
      borders = { "โ”€", "โ”‚", "โ”€", "โ”‚", "โ•ญ", "โ•ฎ", "โ•ฏ", "โ•ฐ" }, -- or { "โ•", "โ•‘", "โ•", "โ•‘", "โ•”", "โ•—", "โ•", "โ•š" }
  })
  end,
}

Styling

Should you desire to change the colors of the popup and buffer lines, you can do so by applying customized highlights to the following highlight groups

NeovimIdeaSwitcherCursor
NeovimIdeaSwitcherCursorLine
NeovimIdeaSwitcherCursorLineNC
NeovimIdeaSwitcherNormal
NeovimIdeaSwitcherNormalNC
NeovimIdeaSwitcherFloatBorder

Todo

  • add tests!
  • protect main branch!
  • check if there are more than 2 buffers open, before opening the popup
  • start from the 2nd
  • walk the list in reverse order via C-S-Tab
    • and start from the last element
  • add a right side panel for the actions

Buy me a ๐Ÿบ

BTC 12CQ1L7qQvF3pPXhAgomnSfWaVkL19nV5F

About

JetBrain's file switcher, for neovim ๐Ÿ˜ <C-Tab> like a pro and jump between open buffers โค๏ธ

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages