Giter Club home page Giter Club logo

bufpin.nvim's Introduction

๐Ÿ“Œ BufPin.nvim

BufPin.nvim is a plugin for displaying recent files and quickly switching between them. It features a togglable board that can move along with the window, helping you swiftly navigate through multiple files.

๐ŸŽฅ Demo

bufpin-demo.mp4

๐ŸŒŸ Features

  • The buffer list is automatically sorted based on the order of recently opened/switched files.
  • Shows the unsaved state of the file.
  • Use the "pinning" feature to keep files unaffected by the sorting rules, and quickly switch between them using custom keybindings.
  • The dynamic mini-menu automatically follows as you switch between windows.
  • Files of same name are automatically displayed with their parent directory.
  • The file list is separated by Git branch.

๐Ÿ’ช Differences from Harpoon or Others

  • Adds a list of recent files.
  • Persistent mini-menu aids in remembering file names.

๐Ÿ“ฆ Installation and keybindings

Lazy

return {
  '0x7a7a/bufpin.nvim',
  event = 'VeryLazy',
  dependencies = {
    'nvim-tree/nvim-web-devicons',
  },
  config = function()
    local bufpin = require('bufpin')
    bufpin.setup()

    -- You can customize the keys to whatever you like!
    -- stylua: ignore start
    vim.keymap.set('n', '<A-1>', function() bufpin.go_to(1) end, { desc = 'BufPin: go to file 1' })
    vim.keymap.set('n', '<A-2>', function() bufpin.go_to(2) end, { desc = 'BufPin: go to file 2' })
    vim.keymap.set('n', '<A-3>', function() bufpin.go_to(3) end, { desc = 'BufPin: go to file 3' })
    vim.keymap.set('n', '<A-4>', function() bufpin.go_to(4) end, { desc = 'BufPin: go to file 4' })
    vim.keymap.set('n', '<A-5>', function() bufpin.go_to(5) end, { desc = 'BufPin: go to file 5' })
    vim.keymap.set('n', '<C-e>', function() bufpin.toggle() end, { desc = 'BufPin: toggle board' })
    vim.keymap.set('n', '<leader>pp', function() bufpin.toggle_pin() end, { desc = 'BufPin: toggle pinned' })
    vim.keymap.set('n', '<leader>pr', function() bufpin.remove() end, { desc = 'BufPin: remove the current file from the board' })
    vim.keymap.set('n', '<leader>pa', function() bufpin.remove_all() end, { desc = 'BufPin: empty board' })
    vim.keymap.set('n', '<A-h>', function() bufpin.prev_pinned() end, { desc = 'BufPin: switch prev pinned file' })
    vim.keymap.set('n', '<A-l>', function() bufpin.next_pinned() end, { desc = 'BufPin: switch next pinned file' })
    -- stylua: ignore end
  end
}

All APIs can be found inlua/bufpin/init.lua

โš™๏ธ Default Setting

{
  rank = {
    num = 10, -- number of the files displayed on the board
  },
  storage = {
    dir = vim.fn.stdpath('cache') .. '/bufpin/',
    git_branch = true,
  },
  board = {
    mode = 'follow', -- follow or fixed on the right edge of the window
    pin_icon = '๓ฐƒ',
    border = 'none', -- single / double / rounder /none
    max_filename = 20, -- long filenames are replaced with ellipses

    -- can be a number (height of the window from top to bottom)
    -- border_height is automatically calculated based on the displayed content.
    float_height = function(border_height)
      -- the default is vertical-center
      local win_height = vim.fn.winheight(0)
      return math.floor((win_height - border_height) / 2)
    end,
  },
  ignore_ft = {
    'help',
    'http',
    'mason',
    'neotest-summary',
  },
}

๐Ÿค Other similar plugins

bufpin.nvim's People

Contributors

0x7a7a avatar

Stargazers

Edgars Burtnieks avatar Jonatan Branting avatar Marcos Romero Lamas avatar  avatar Tyler Wardhaugh avatar Ciel Yu avatar Will Hopkins avatar Yuta Katayama avatar andrey pechorin avatar Emille Henry avatar Adelar da Silva Queirรณz avatar  avatar

Watchers

 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.