Giter VIP home page Giter VIP logo

jabs.nvim's Introduction

JABS.nvim

Just Another Buffer Switcher is a minimal buffer switcher window for Neovim written in Lua.

How minimal? One command and one window minimal!

JABS shows exactly what you would expect to see with :buffers or :ls, but in a prettier and interactive way.

Requirements

  • Neovim ≥ v0.5
  • A patched nerd font for the buffer icons

Installation

You can install JABS with your plugin manager of choice. If you use packer.nvim, simply add to your plugin list:

use 'matbme/JABS.nvim'

Usage

As previously mentioned, JABS only has one command: :JABSOpen, which opens JABS' window.

By default, you can navigate between buffers with j and k as well as <Tab> and <S-Tab>, and jump to a buffer with <CR>. When switching buffers the window closes automatically, but it can also be closed with <Esc> or q.

You can also open a preview window for the buffer selected under the cursor with <S-p>, which by default appears above JABS' window. See below how to change its default behavior.

Configuration

All configuration happens within the setup function, which you must call inside your init.lua file even if you want to stick with the defaut values. Alternatively, you can redefine a number of parameters to tweak JABS to your liking such as the window's size, border, and placement.

A minimal configuration keeping all the defaults would look like this:

require 'jabs'.setup {}

A more complex config changing every default value would look like this:

require 'jabs'.setup {
    -- Options for the main window
    position = 'center', -- center, corner. Default corner
    width = 80, -- default 50
    height = 20, -- default 10
    border = 'single', -- none, single, double, rounded, solid, shadow, (or an array or chars). Default shadow

    -- Options for preview window
    preview_position = 'left', -- top, bottom, left, right. Default top
    preview = {
        width = 40, -- default 70
        height = 60, -- default 30
        border = 'single', -- none, single, double, rounded, solid, shadow, (or an array or chars). Default double
    },

    -- Default highlights
    highlight = {
        current = "StatusLine",
        split = "StatusLine",
        alternate = "WarningMsg",
        hidden = "ModeMsg",
        locked  = nil,
        read_only  = nil,
        changed  = nil,
        terminal  = nil,
    },

    -- Default symbols
    symbols = {
        current = "C", -- default 
        split = "S", -- default 
        alternate = "A", -- default 
        hidden = "H", -- default ﬘
        locked = "L", -- default 
        ro = "R", -- default 
        edited = "E", -- default 
        terminal = "T" -- default 
    },

   	-- the options below are ignored when position = 'center'
    col = ui.width,  -- Window appears on the right
    row = ui.height/2, -- Window appears in the vertical middle
}

Default Keymaps

Key Action
j or <Tab> navigate down
k or <S-Tab> navigate up
D close buffer
<CR> jump to buffer
s open buffer in horizontal split
v open buffer in vertical split
<S-p> open preview for buffer

If you don't feel like manually navigating to the buffer you want to open, you can type its number before <CR>, s, or v to quickly split or switch to it.

Symbols

Future work

JABS is in its infancy and there's still a lot to be done. Here's the currently planned features:

  • Switch to buffer by typing its number
  • Preview buffer
  • Close buffer with keymap (huge thanks to @garymjr)
  • Open buffer in split
  • Sort modes (maybe visible and alternate on top)
  • Custom keymaps

Suggestions are always welcome 🙂!

jabs.nvim's People

Contributors

amirhhashemi avatar hampustagerud avatar matbme avatar raafatturki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.