matbme / jabs.nvim Goto Github PK
View Code? Open in Web Editor NEWJust Another Buffer Switcher for Neovim
License: GNU General Public License v3.0
Just Another Buffer Switcher for Neovim
License: GNU General Public License v3.0
Hello,
Awesome project!
Sometimes it takes a while to focus on the file name after opening the panel, is it possible to create custom highlight for file name?
Thanks!
I use tpope's obsession plugin a lot and noticed that after restoring a session the buffer names are empty in JABS. :ls
properly shows all names but JABS doesn't seem to pick them up.
Could it be possible to extend the plugin to allow switching to a different buffer with a single (or almost single) key press?
I imagine that instead of displaying buffer numbers the plugin could display labels (from the set provided by the users) next to each buffer item. Typing j
would for example open first buffer, but using a modifier like SHIFT+j
would open it in the vertical split.
When you open the preview window in JABS the keymap for q
get's overwritten for that buffer. That's hard coded:
-- function M.previewBuf()
[...]
-- Close preview with "q"
api.nvim_buf_set_keymap(buf, "n", "q",
[[:lua require'jabs'.closePreviewBuf()<CR>]],
{ nowait = true, noremap = true, silent = true })
[...]
The mapping still exists after the preview window is closed and if you open the same buffer in a different window -- for editing -- the mapping is still active (and calls closePreviewBuf
).
If q
would not be mapped to any other command this might not be toooooo bad, but q
is mapped to start a recording by default and that's not possible anymore.......
As an example, in the setup below, I have a couple of buffers opened: init.vim
, mappings.lua
(in the second tab), plugins_portable.lua
, and plugins_complete.lua
(in the first tab). init.vim
is currently focused.
If I press Enter in mappings.lua
, it'll open it in the current window, overriding init.vim
. Same for any other buffer. It'll open the buffer in the current window focused (which happens to be init.vim
).
My feature request, is that I could press a key (perhaps g), and I could go to that buffer's window if it's already opened. In the example above, pressing g on mapping.lua
would jump to the second window, as it's already opened there. Pressing g on plugins_portable.lua
would jump to the first tab, first window (where it's currently opened), etc.
This would make navigating between currently opened buffers very convenient.
I'm sorry to bother you again, but I have found an other bug:
When opening buffers with file names that have certain characters in them I get the following:
I have tested with some characters (not that many) and looks like -
, +
, %
produce this problem. There could be more, but that should be enough to prove the point.
-
is a very common file name character...
Hello,
i have a problem with JABS, when i run it (like :JABSOpen), i get an error.
For plugins i use Lazy.
This is my neovim lua config for JABS:
...
{"matbme/JABS.nvim",
keys = {
{ "<leader>b", "<cmd>JABSOpen<CR>" },
},
config = function ()
require("jabs").setup ({
position = {"center", "center"},
border = 'single',
keymap = {
close = "d",
h_split = "h",
v_split = "v",
preview = "p",
},
use_devicons = true
})
end},
...
This is error message:
E5108: Error executing lua ~/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:546: Invalid 'group': 'JABS'
stack traceback:
[C]: in function 'nvim_clear_autocmds'
~.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:546: in function 'close'
~.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:621: in function 'open'
[string ":lua"]:1: in main chunk
When i open i got this error:
E5108: Error executing lua ...share/nvim/site/pack/packer/start/JABS.nvim/lua/jabs.lua:269: assertion failed!
stack traceback:
[C]: in function 'assert'
...share/nvim/site/pack/packer/start/JABS.nvim/lua/jabs.lua:269: in function 'updatePos'
...share/nvim/site/pack/packer/start/JABS.nvim/lua/jabs.lua:611: in function 'open'
[string ":lua"]:1: in main chunk
neovim version = v0.9.0
Hello,
When I call :JABSOpen when the JABS window is already opened, it breaks the entire plugin (I have to restart nvim for it work again) and gives me this error:
E5108: Error executing lua /home/canada/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:557: Invalid buffer id: 2
stack traceback:
[C]: in function 'nvim_buf_delete'
/home/canada/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:557: in function 'close'
/home/canada/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:621: in function 'open'
[string ":lua"]:1: in main chunk
from this issue #9 :JABSOpen should toggle but that doesn't work for me
When user focuses outside of JABS' window, it should be closed.
This can happen:
(Since discussion are disabled this becomes an issue... ;)
As you noticed, I worked on (a) JABS (branch/fork) in the last couple of days. The result is what I call expJABS at the moment.
The question to me is how to go on with (exp)JABS at this state, because expJABS code differs heavily from the regular JABS code.
To give you a brief heads up this is the introduction to the expJABS README
experimental JABS is an experimental branch / fork of JABS. It started
as a branch to fix a couple of issues and turned into an refactored and
extended version of JABS. It's backwards compatible and looks and behaves
(almost) exactly the same as regular JABS.
expJASB differs to regular JABS in the following points:
- aggressively refactored to gain better maintanability and extendibility:
- used lua-patterns and vim-api to replace homebrewed solutions
- stateless (no global state)
- added features:
- sort files by most recently used (merge into JABS/master)
- improved positioning (merged into JABS/master)
- show closed (unlisted) buffers and restore them
- wipe a buffer if a closed (unlisted) buffer gets deleted again
- switch to buffers when they are already open
- help popup
- highlight the filename seperately
- mouse support for selecting buffers
- fixed some bugs and issues.....
- changed some default values
and a showcase:
I'd like to maintain expJABS and like to share it, but I don't know how a coexistence with JABS could look like. That's what this discussion is supposed to be about.
Would you mind having a look at it?
Do you have any ideas / opinions about it?
PS: https://github.com/jeff-dh/expJABS.nvim that's the branch I'm talking about ;)
Hi,
Just an idea, but when opening the list, it would be nice if the previously selected buffer is already highlighted.
This will allow for fast switching between 2 files while still having the option to go to another.
Thanks for the great plugin!
First off, this plugin is wonderful, great job!
I was trying out it and noticed that the cursor doesn't go back to JABS the preview is closed, instead the cursor goes back to the first open pane.
Am I missing something?
Calling :JABSOpen
when there is already a JABS window opens another JABS window, and this can cause some weird effects. If :JABSOpen
is called multiple times in a non-floating window, multiple JABS windows are opened in the same position. If :JABSOpen
is called inside a JABS window (which can happen if a keybinding mapped to :JABSOpen
is pressed multiple times), another JABS window is opened in a position one line and one column off from the original position.
Maybe :JABSOpen
can be changed to something that toggles the JABS window (:JABSToggle
)?
Hello,
i wanted to try out this plugin but it behaves very strangely.
open neovim without arguments - it opens a readonly scratchpad (my custom dashboard). :ls
will show nothing
1.1. execute :JABSOpen
1.1 error in jabs.lua:141: attempt to index local 'linenr' (a nil value)
open three buffers via :e ...
1.1. execute :JABSOpen
1.1 error in jabs.lua:130: attempt to concatenate local 's' (a table value)
open two buffers via :e ...
1.1. execute :JABSOpen
1.1. no error
At some point, i got an error in jabs.lua: 186: Invalid window id after reopening it.
At some point, i also got an error after opening buffers via TeleScope...
Versions:
---> the first window will be the current window afterwards
a call similar to: api.nvim_set_current_win(M.back_win)
when closing jabs should fix the issue
E5108: Error executing lua /Users/user/.vim/plugged/JABS.nvim/lua/jabs.lua:100: attempt to concatenate local 'symbol' (a โ
nil value)
If i press enter it takes me to an empty pane.
This is a feature request:
It would be really nice if the buffers in the list were numbered (with number that make sense, 0 to n-1 for exemple).
And you just would need to type the corresponding number to switch.
I didn't see any plugin that do that, it would be really cool !
Using the default config I cannot open jabs
.
E5108: Error executing lua ...share/nvim/site/pack/packer/start/JABS.nvim/lua/jabs.lua:332: Must specify 'width'
stack traceback:
[C]: in function 'nvim_open_win'
...share/nvim/site/pack/packer/start/JABS.nvim/lua/jabs.lua:332: in function 'open'
[string ":lua"]:1: in main chunk
NVIM v0.8.0-dev+285-g52623ce93
Build type: Release
LuaJIT 2.1.0-beta3
Hello, thanks for the wonderful plugin.
I have an autocommand that center the window each time I switch buffer:
vim.api.nvim_create_autocmd("BufWinEnter", {
pattern = "*",
callback = function()
vim.cmd("normal! zz")
end,
})
Which works every time I use bnext
and brev
, but it doesn't when I jump with JABS.
Can you please give me a hand on this? I have been struggling for quite some time.
Keep up with the excellent work!
I have no idea why the buffers in vim and neovim have so ridiculous buffer number,
but if I want to switch to a buffer by typing it's number, I don't want to type 53
or some other huge number.
If the numbers of the buffer coud stay one-digit (nobody use more that 9 buffers so often), it would be really nice !
It would be nice if it was possible to restore buffers deleted with JABS(undo and redo). See this Stack Overflow answer on how to restore buffers manually.
neovim 0.7.0
I experience a couple of situations where JABS fails to launch properly.
hidden
nvim option.%
in the shada
option. %
makes it so that when I launch nvim without a file it remembers the buffers from previous time. Of course I have to launch it like that to produce the problem.api.nvim_buf_add_highlight
somehow fails to set the highlights and that brakes the rest of JABS. When I remove that function and related things, JABS seems to work fine (but the text disappears of course).
I don't know enough about coding to tell you more.
I get the following error when I try to open jabs:
Error in packer_compiled: ...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:82: Vim(lua):E5108: Error executing lua ...l/share/nvim/site/pack/packer/opt/JABS.nvim/lua/jabs.lua:289: One of 'relative' and 'external' must be used
Here's my packer configuration:
use({ "matbme/JABS.nvim", opt = true, cmd = { "JABSOpen" } })
And my vim version:
NVIM v0.5.0
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdi
agnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim/src/neovim-0.5.0/build/config -I/build/neovim/src/neovim-0.5.0/src -I/usr/include -I/build/neovim/src/neovim-0.5.0/build/src/nvim/auto -I/build/neovim/src/neovim-0.5.0/build/include
Compiled by builduser
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
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.