ghillb / cybu.nvim Goto Github PK
View Code? Open in Web Editor NEWNeovim plugin that offers context when cycling buffers in the form of a customizable notification window.
License: MIT License
Neovim plugin that offers context when cycling buffers in the form of a customizable notification window.
License: MIT License
It would be great if you could add an option in the setup()
to control the allowed maxsize of icons and shift the file_name
to the right accordingly. Currently with the plenary truncate, 2col wide icons can get truncated to nothingness.
Great plugin, thanks a lot :)
Add an option to show / hide buffer number
Thanks
The <Plug>…
mappings look nicer, but they prevent the plugin from being lazy-loaded. By directly using function() require('cybu').cycle('prev') end
instead, it is possible to lazy-load the plugin.
While I got those from searching the code base, I think it might make sense to replace <Plug>…
everywhere with require…
, so users can get the benefit of quicker loading.
Hello!
I generally have several nvim instances running in a multiplexer, as I work on different projects concurrently. I noticed that cybu lists all buffers open in any of my nvim instances, instead of listing the buffers open only in the current instance. Do you think this could be fixed?
It would be great to support grapple.nvim
(alternative to Harpoon). This could be done by considering the grapple tags instead of open buffers. Additionally, it could be better to just allow the user to provide a function which returns a list of buffers in cybu
's config (the default would be nvim's internal buffer list), so that grapple
, harpoon
and any other similar plugins can be integrated by the user in the config, instead of having specific integrations with each possible plugin.
Thanks for the really useful plugin, I've been enjoying it a lot! :)
Is it possible to switch to the buffer immediately after releasing all keys? I'm using the 'most recent' feature with the default keybinds ("J", "K"), which means I press shift+j/k to select the entry. What would be brilliant is if I could keep shift pressed while moving up/down the list with j/k. Once I have arrived at the desired entry, I release shift and cybu switches to the selected buffer. In this case the limited display_time
would also not be needed, making things easier if you're having to hunt a bit for the relevant buffer name. Can this already be achieved? If not, would this be a feature you'd like to see in your plugin?
Thanks!
This plugin is perfect for my worfklow, but there is one thing missing that I would love to see.
I would love to be able to change how the plugin determines if a file is "Used" for the buffer cycle next and prev commands
Given the following open buffers in order of recently used
file1 < open
file2
file3
I have been editting file1, and I now want to jump back and forth between file1 and file3 with a single cycle next.
In other words I want to have the following buffers
file1
file2 < open
file3
file1
file2
file3 < open
file3 < open
file1
file2
As you can see this will only move the buffer to MRU if you have actually moved your cursor in that buffer.
The problem right now with how last_used
and immediate
works is that cybu
considers a file to be "used" as soon as BufEnter is called. And obviously with immediate
mode this happens for every file you cycle to.
So with this current setup, it will be impossible for me to get my buffers the way that I want.
Using switch: on_close
and tweaking the display_time
but this is not ideal, as it doesn't feel as responsive to me.
This is kind of how iPhones work. If you swap between open apps, it will only consider the app you just opened to be the MRU if you actually did something on that app.
Just did a fresh install of Cybu.nvim on latest stable nvim 0.9.0
nnoremap <tab> <Plug>(CybuPrev)
nnoremap <S-tab> <Plug>(CybuNext)
Then I get this error:
E5108: Error executing lua vim/shared.lua:0: t: expected table, got nil
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'validate'
vim/shared.lua: in function 'tbl_contains'
...r/.local/share/nvim/plugged/cybu.nvim/lua/cybu/utils.lua:87: in function 'is_filter_
active'
...er/.local/share/nvim/plugged/cybu.nvim/lua/cybu/init.lua:389: in function 'cycle'
[string ":lua"]:1: in main chunk
Since you are basically implementing a kind of Alt-Tab
within Neovim, how would you think of changing the order of the displayed buffers to most recently used. This would then refelect the Alt-Tab
Behaviour to 100% :)
Is is possible to configure Cybu to cycle buffers in an MRU fashion? Similar to what Telescope
is doing
For example, with sort_mru=true
:
:Telescope buffers path=%:p:h initial_mode=insert select_buffer=true sort_mru=true<CR>
In my setup, I use neovim-session-manager to manage my session,When switching sessions, the buffer of buye becomes invalid.
The specific errors are shown below:
E5108: Error executing lua: vim/_editor.lua:0: nvim_exec2(): Vim:Error executing Lua callback: .../.local/share/AstroNvim/lazy/cybu.nvim/lua/cybu/init.lua:228: Invalid buffer id: 15
stack traceback:
[C]: in function 'nvim_buf_set_lines'
.../.local/share/AstroNvim/lazy/cybu.nvim/lua/cybu/init.lua:228: in function 'get_cybu_buf'
.../.local/share/AstroNvim/lazy/cybu.nvim/lua/cybu/init.lua:376: in function 'populate_state'
.../.local/share/AstroNvim/lazy/cybu.nvim/lua/cybu/init.lua:394: in function 'cycle'
...bo/.local/share/AstroNvim/lazy/cybu.nvim/plugin/cybu.lua:13: in function <...bo/.local/share/AstroNvim/lazy/cybu.nvim/plugin/cybu.lua:12>
[C]: in function 'nvim_exec2'
vim/_editor.lua: in function 'cmd'
/home/zibo/.config/astronvim/lua/user/lsp/mappings.lua:25: in function </home/zibo/.config/astronvim/lua/user/lsp/mappings.lua:23>
stack traceback:
[C]: in function 'nvim_exec2'
vim/_editor.lua: in function 'cmd'
/home/zibo/.config/astronvim/lua/user/lsp/mappings.lua:25: in function </home/zibo/.config/astronvim/lua/user/lsp/mappings.lua:23>
I found that these changes fixed the issue for me:
diff --git a/lua/cybu/init.lua b/lua/cybu/init.lua
index 79a25c2..7af13a3 100644
--- a/lua/cybu/init.lua
+++ b/lua/cybu/init.lua
@@ -208,7 +208,7 @@ end
cybu.get_cybu_buf = function()
local cybu_buf
- if not _state.cybu_buf then
+ if not _state.cybu_buf or not vim.api.nvim_buf_is_valid(_state.cybu_buf) then
cybu_buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_option(cybu_buf, "filetype", "cybu")
vim.api.nvim_buf_set_option(cybu_buf, "buftype", "nofile")
I get this error (Cybu: nvim-web-devicons enabled, but not installed
) on starting Neovim and I assume it's because the repository changed from kyazdani42/nvim-web-devicons
to nvim-tree/nvim-web-devicons
.
When i set:
style = {
path = "absolute",
}
The i see this error:
E5108: Error executing lua ...re/nvim/site/pack/packer/opt/cybu.nvim/lua/cybu/init.lua:68: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
[C]: in function 'ipairs'
...re/nvim/site/pack/packer/opt/cybu.nvim/lua/cybu/init.lua:68: in function 'get_widths'
...re/nvim/site/pack/packer/opt/cybu.nvim/lua/cybu/init.lua:273: in function 'populate_state'
...re/nvim/site/pack/packer/opt/cybu.nvim/lua/cybu/init.lua:289: in function 'cycle'
[string ":lua"]:1: in main chunk
Bufstop plugin has a "speed" mode which lets user cycle through last specified number of buffers viewed, so I can do things like
https://github.com/mihaifm/bufstop
This is fast and puts convenient limit on a list of buffers to cycle through when there are many open.
Any thoughts about implementing a similar approach in this plugin?
After a fresh install and using the Quick Start config, I get the following error:
Cybu: nvim-web-devicons enabled, but not installed
Icons are not shown, but all functions work perfectly
I am struggling with customization. I want to switch between history without a popup window.
Is it possible? How I can achieve this?
PS For what is the auto mode?
👋🏼,
First off, I want to say thank you - I'm really loving this plugin!
In my setup, I use bufignore.nvim
to unlist Git ignored buffers once they are hidden. However, I've encountered an issue with Cybu when I move through the entire list of buffers it provides. When it encounters an unlisted buffer, Cybu silently stops working, and I have to use bnext
to move to another listed buffer.
This behavior can be easily replicated with the following steps:
vim.defer.fn
to unlist one of the buffers with a delay of 1-2 seconds.Hello, thank you for this amazing plugin.
I use this plugin for setting neovim to transparent: "xiyaowong/nvim-transparent", and when transparency is on, the cybu current buffer line highlight disappears.
Option to show Cybu window on <C-i>
. <C-o>
, Telescope jumps, as well as vanilla :bprev
/:bnext
etc, instead of hardcoded CybuPrev
/CybuNext
commands.
Can i maybe hack that behavior somehow without changing the code?
I've tried the following:
vim.api.nvim_create_autocmd('BufWinEnter', {
group = vim.api.nvim_create_augroup('nrv#cybu_show_on_buffer_switch', {}),
callback = function()
require('cybu').populate_state()
require('cybu').show_cybu_win(require('cybu').get_cybu_win_pos())
end,
})
And it sort of works, but the current file displays incorrectly: if i switch between two files multiple times like with <C-o><C-i><C-o><C-i>
the highlighted file cycles bottom-up indefinitely instead of highlighting two files back and forth. Jumping to a file with Telescope, gf
etc. also selects file incorrectly.
And then if i open unusual buffer like help
or lsp hover, the error is thrown: init.lua:357: attempt to perform arithmetic on a nil value
.
init.lua
:
local use = require('packer').use
require('packer').startup(function()
use 'tpope/vim-unimpaired'
use({
"ghillb/cybu.nvim",
branch = "main", -- timely updates
-- branch = "v1.x", -- won't receive breaking changes
requires = { "kyazdani42/nvim-web-devicons", "nvim-lua/plenary.nvim"}, -- optional for icon support
config = function()
local ok, cybu = pcall(require, "cybu")
if not ok then
return
end
cybu.setup()
vim.keymap.set("n", "[b", "<Plug>(CybuPrev)")
vim.keymap.set("n", "]b", "<Plug>(CybuNext)")
vim.keymap.set({"n", "v"}, "<c-s-tab>", "<plug>(CybuLastusedPrev)")
vim.keymap.set({"n", "v"}, "<c-tab>", "<plug>(CybuLastusedNext)")
end,
})
end)
:Verbose nmap [b
n [b <Plug>(unimpaired-bprevious)
Last set from ~/.local/share/nvim/site/pack/packer/start/vim-unimpaired/plugin/unimpaired.vim line 51
I noticed that if I have a quickfix window open, then it will show up in the cycle list and then I won't be able to cycle out of that buffer when it's selected. I think that this is because the exclude settings are not being taken into account when populating the list of buffers to cycle through. I found that these changes fixed the issue for me:
diff --git a/lua/cybu/init.lua b/lua/cybu/init.lua
index 3a384be..f02ac14 100644
--- a/lua/cybu/init.lua
+++ b/lua/cybu/init.lua
@@ -30,6 +30,9 @@ cybu.get_bufs = function()
if 1 ~= vim.fn.buflisted(id) then
return false
end
+ if vim.tbl_contains(c.opts.exclude, vim.fn.getbufvar(id, "&filetype")) then
+ return false
+ end
return true
end, vim.api.nvim_list_bufs())
Love the plugin btw 🙂
Hi, thank you for your plugin, it works very well.
When using it, I have some trouble to focus on the filenames, as they are always change when cycling through the list. For me at least, it would be more interesting to keep the names at the same position in the list, and change the position of the highlight instead.
I guess it would still have to keep the same behavior when the buffer list is longer than the window height.
It would be great to have some supports for harpoon https://github.com/ThePrimeagen/harpoon next & prev files
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.