Giter VIP home page Giter VIP logo

hbac.nvim's Introduction

Hello there! ๐Ÿ

hbac.nvim's People

Contributors

al-ce avatar axkirillov avatar ditsuke avatar nimjii avatar tom-kuca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hbac.nvim's Issues

Cooperate with early-retirement

Trying to get this to work well with early-retirement.nvim... Is there a way to hook pinning a buffer so that I can set vim.b.ignore_early_retirement = true on the buffer as well and make early-retirement.nvim also ignore pinned buffers?

Allow for custom Telescope mappings (or provide a way to customize the <CR> action)

I like my Telescope <CR> action to be select_drop as opposed to just select, but this plugin currently does not give me a way to specify that. Ideally there'd be a way to just add custom mappings somewhere, but for my purpose just a way to select the <CR> action would be sufficient.

I'll currently work around this by hijacking attach_mappings to inject my own mappings, but I recognize that this is wildly fragile and would like to not need to do that.

Given that the customization for actions in this plugin is somewhat different from what I'm used to (i.e., there's a set of functions you assign mappings to, as opposed to assigning functions to mappings), I don't really know how (and if) you'd like to do this, but I can take a crack at a PR if a direction for how a user would specify this in the config is suggested.

Close edited buffers if threshold is reached

I've set a pretty small threshold(7) so I can always navigate with tabs across buffers. However, when I edit many files in one go, I simply can't open buffers till I close ones.
My proposition is to add an option to close edited buffers if they are saved and there is no place for opening a new buffer.
I can try implementing the feature, but first say pls, if there is any alternative already presented already..

Feat. request: higher priority for unnamed (empty) buffers

First of all - thank you for the plugin. It will bring sanity to my buffer-apocalypse I sometimes have ๐Ÿ™Œ

One of my biggest problems (in general) is the unnamed empty buffers. I tend to have a lot of them open because VIM likes to spam them on many occasions (i.e., when going to netrw).

Is it possible to prioritize removing the empty buffers when the threshold is met?

Thank you!

pressing 'i' in telescope extension

Odd issue, can't quite track it down, but I get the following error if I open the telescope extension a second time and press i anywhere in the buffer name I am searching for... Has anyone seen similar?

E5108: Error executing lua: ...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:269: attempt to call upvalue 'key_func' (a table value)
stack traceback:
        ...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:269: in function <...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:268>

Sort telescope results by recency

When I have a lot of files open, I usually end up navigating exclusively through Hbac Telescope. I don't know how feasible it is, but I would love to be able to see the results in it sorted by most recently viewed.

I don't know if nvim has some concept of when a buffer was last open and visibile, and I'm sure it would get a little complicated like if you have splits with multiple files open... https://github.com/nvim-telescope/telescope-frecency.nvim is something in that space, but it has to use a sqlite database to do it.

No buffers were wiped out: bwipe 1

Steps to reproduce

  1. mininal init.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  "axkirillov/hbac.nvim",
  "olimorris/persisted.nvim",
  "nvim-telescope/telescope.nvim",
  "nvim-lua/plenary.nvim",
}, {})

require("persisted").setup({ autoload = true })
require("hbac").setup({ })
  1. open nvim and edit 11 different files to create 10 buffer
  2. close nvim
  3. open nvim and here are the erros
[persisted.nvim]: Error loading the session! vim/_editor.lua:0: VimEnter Autocommands for "*"..script nvim_exec2() called at Vi
mEnter Autocommands for "*":0../home/martins3/.local/share/nvim/sessions/%home%martins3%core%linux@@main.vim, line 93: Vim(bwip
eout):E517: No buffers were wiped out: bwipe 1
Press ENTER or type command to continue

If require("hbac").setup({ }) is commented, the error message disappeared.

Additional information

  1. I changed the session manager plugin to "rmagatti/auto-session", nothing changed.
  2. nvim version:
NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1693350652

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/nix/store/4wq4i3zfc9g0g5b0d94rm36d9pfa4fqz-neovim-unwrapped-0.9.4/share/nvim

pass telescope picker opts properly

As @ditsuke and @technicalpickles have mentioned, the Telescope picker isn't implementing opts that a user might expect from a buffer picker, which is more or less the picker we were trying to imitate. This is my fault for not looking back at the buffer picker as a model towards the end of the PR.

Here's the structure of the builtin buffer picker (link)

  pickers
    .new(opts, {
      prompt_title = "Buffers",
      finder = finders.new_table {
        results = buffers,
        entry_maker = opts.entry_maker or make_entry.gen_from_buffer(opts),
      },
      previewer = conf.grep_previewer(opts),
      sorter = conf.generic_sorter(opts),
      default_selection_index = default_selection_idx,
    })
    :find()

and here's the hbac 'pin' picker as of release v1.2.0 (link)

M.pin_picker = function(opts)
  local attach_mappings = require("hbac.telescope.attach_mappings")
  local make_finder = require("hbac.telescope.make_finder").make_finder
  opts = opts or {}
    pickers
      .new(opts, {
        prompt_title = "Hbac Pin States",
        finder = make_finder(),
        sorter = telescope_conf.generic_sorter(opts),
        attach_mappings = attach_mappings.attach_mappings,
        previewer = telescope_conf.file_previewer(opts),
      })
      :find()
end

My oversight was not giving make_finder() the opts table and checking for the relevant builtin buffer picker opts in the function that builds the finder results (get_entries()). Since the sorter and the previewer functions are called straight from Telescope, I just stopped thinking about the opts.

So, we need to pass the opts table to the function that builds the finder. The function that checks the opts and filters the buffer list is unexposed in the Telescope code unfortunately. The blunt thing to do would be to just copy that code into the make_finder function and make any relevant changes (this is what I'm trying on my local repo). (EDIT: since we're refreshing the picker after most actions, this make_finder call needs the opts too)

The builtin buffer picker also has the default_selection_index key which is needed for setting the row position correctly if sort_lastused is true and ignore_current_buffer is false, so we would need to access that after its value is updated.

Sorry for the oversight, I hope the indication to the code is useful.

Persist pinned buffers

Is it possible to persist the list of pinned buffers using a plugin like auto-session?

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.