Code Monkey home page Code Monkey logo

bufdelete.nvim's Introduction

About Me

I'm Famiu (IPA pronunciation: fαmjʊ), I'm currently a student and like to contribute to Open Source projects in my free time.

Activity

Contact Information

bufdelete.nvim's People

Contributors

chanced avatar f1rstlady avatar famiu avatar isaksamsten avatar mehalter avatar spindensity avatar vlmonk avatar yelite 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

bufdelete.nvim's Issues

[Bug] After `BDelete`, focus will always go to first buffer

Neovim version
The output of nvim --version.

I use nightly, but it can be reproduce in 0.9.1 stable

NVIM v0.10.0-dev-585+g2e055e49a
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-10 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_TS_HAS_SET_MAX_START_DEPTH -I/__w/neovim/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/build/src/nvim/auto -I/__w/neovim/neovim/build/include -I/__w/neovim/neovim/build/cmake.config -I/__w/neovim/neovim/src -I/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

Describe the bug
A clear and concise description of what the bug is.

from

In the past, if I run :BDelete, current buffer will be deleted and I will be redirected to latest buffer I used, but from this commit: 4549ea1 , BDelete will always go to the first buffer in my nvim instance.

To Reproduce
Steps to reproduce the behavior:

  1. Open file1, file2, file3, file4 one by one, they will be open in buf1, buf2, buf3, buf4, now focus is on buf4
  2. :BDelete, buf4 disappear, focus will be on buf1

Expected behavior
I hope focus is on buf3 because buf3 is the latest buf I have worked on.

Provide a minimal configuration to reproduce the bug
I use bisect to find the behavior is changed from commit 4549ea1, commits before this are ok.

Invalid window id: 1010 when executing `:Bdelete!` with `ttyfast` option

Neovim version

$ nvim --version
NVIM v0.8.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.8.2/share/nvim"

Run :checkhealth for more info

Describe the bug
Failed to execute :Bdelete! to close lazy-lock.json file, when set ttyfast option, there's an error:
image

To Reproduce
use lazy.nvim install bufdelete.nvim plugin, and set ttyfast in init.vim, open lazy-lock.json file, then :Bdelete! to close it.

Expected behavior
Close correctly without error message.

Does this error occur in the minimal init file?
Use the following commands to download the minimal init file provided by bufdelete:
curl -fLO https://raw.githubusercontent.com/famiu/bufdelete.nvim/master/minimal_init.lua

Modify the file to your needs (if necessary), then load Neovim using:
nvim --noplugin -u minimal_init.lua

And check if your issue still occurs.

Provide modified minimal_init.lua
If you modified the minimal_init.lua that bufdelete provides by default in order to fit your configuration, put it here. Otherwise ignore this part.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here (eg: other plugins that may conflict with this plugin, configuration options that you think might cause the issue, etc.).

[Feature] Use the native confirmation dialogue

Is your feature request related to a problem? Please describe.
Right now, this plugin uses a handrolled function to confirm unsaved changes, etc.

Describe the solution you'd like
Vim already has a built-in that can handle this, see: :h confirm.

By using the built-in, the user will have a consistent interface and bindings for all confirmation dialogues, which is cool.

As a plus, plugins that overrides the built-in UI like noice.nvim will automatically integrate with this plugin for free.

Example usage:

:confirm bdelete " vimscript
vim.cmd.bdelete { mods = { confirm = true } } -- lua

[Feature] Restrict closing-by-search-term to only close a buffer if a single buffer matches the term.

Is your feature request related to a problem? Please describe.
When using Bdelete or Bwipe with a text/string parameter to close a buffer, if the term matches multiple buffers one will be closed seemingly at random. This is particularly problematic when a buffer's relative file path matches the term and not the file name.

Example:
My neovim config directory has the following files:

  • lua/neandrake/lazy.lua
  • lua/neandrake/lazy_plugins/bufdelete.lua
  • lua/neandrake/lazy_plugins/... .lua

I then run :Bdel lazy with the intent to close lazy.lua but bufdelete.lua ends up closing. This happens because the buffer's name is the relative-to-cwd path + filename of the file, in this case lua/neandrake/lazy_plugins/bufdelete.lua and lazy matched the path element lazy_plugins. Presumably this would happen not at random but first match in order of what buffers were opened first.

Describe the solution you'd like
Update matching behavior, or an option to do so, such that if multiple buffers match the search term then no buffers are closed. Alternatively only match on the filename part of the name, if it's reliable to do so.

Describe alternatives you've considered
Closing by buffer ID instead of by name matching.

Additional context
I use bufferline plugin to show UI-tabs for opened buffers, configured to display only the buffer's filename for each UI-tab. When using :Bd lazy I was confused to what happened as something had closed but not lazy.lua.

[Bug] After the last update now buffers are randomly opened

My mapping is:

        ["<M-q>"] = { "<CMD>lua require('bufdelete').bufdelete(0, true)<CR>", "Bufdelete current buffer" },

Before the last update, pressing <Alt+Q> correctly closed the buffer and switched to the following active one. When active buffers ended, an empy buffer was correctly displayed.

Now, following the last update, pressing <Alt+Q> close the current buffer and load a random one instead (I don't know if from MRU/history or one of the current active CWD, but for sure it wasn't active before that).

[Bug] bad argument #1 to 'ipairs' (table expected, got number)

Neovim version

NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

Describe the bug

After commits 3d34816 - 42ccf4f

E5108: Error executing lua: ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:192: bad argument #1 to 'ipairs' (table expected, got number)
stack traceback:
        [C]: in function 'ipairs'
        ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:192: in function 'get_target_buffers'
        ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:205: in function 'bufdelete'
        /home/barklan/.config/nvim/lua/config/keymaps_nvim.lua:17: in function </home/barklan/.config/nvim/lua/config/keymaps_nvim.lua:3>

To Reproduce

require('bufdelete').bufdelete(0)

Expected behavior

Delete current buffer

how to work with Bufferline?

thank you for the work
image
when i on app.js buffer, then, run require('bufdelete').bufdelete(0, true), will go to the first tab,not last tab
image

random error: invalid window id

|| E5108: Error executing lua: ...te/pack/packer/opt/bufdelete.nvim/lua/bufdelete/init.lua:61: Invalid window id: 1016
|| stack traceback:
|| 	[C]: in function 'nvim_win_set_buf'
|| 	...te/pack/packer/opt/bufdelete.nvim/lua/bufdelete/init.lua:61: in function 'buf_kill'
|| 	...te/pack/packer/opt/bufdelete.nvim/lua/bufdelete/init.lua:78: in function 'bufdelete'

I see this message, every once in a while when normally having 2 splits open and closing one of them using bufdelete(0, true) from the plugin.

That window id doesnt exist, and this error is shown, but the buffer still closes like it should after the error. Please advise as to how to debug this further.

Handle buffers not attached to windows

The commands provided by this plugin are not drop-in replacements for the built-in commands, because they cannot close buffers that are not attached to a window. This is due to if #windows == 0 then return end in the middle of buf_kill. This is inconvenient, because now, when I want to programmatically close a buffer, I have to first check whether it's attached to any windows and then call :bdelete or :Bdelete appropriately. Is there a reason for this restriction? It looks like the code will work fine without it, and it would make this plugin more general-purpose.

[Feature] Delete all other buffers

Is your feature request related to a problem? Please describe.
I'm often having to switch to a new problem/task within the same project and typically want to start this off by deleting all buffers except the one currently in focus, using :Bdelete.

Describe the solution you'd like
A new command or option for :Bdelete like :Bdelete others.

Describe alternatives you've considered
There are some other plugins that offer this functionality, but seems the functionality could naturally fit into this project as well.
This would would (at least to me) make it a one-stop-shop for buffer deletion.
E.g.:

I suppose the functionality probably can be implemented using the exposed lua functions as well (or provided as an example). I haven't ventured into this yet.

[Bug] Deleting a buffer that set 'bufhidden=delete' will trigger Vim error E516.

Neovim version
NVIM v0.10.0-dev-2175+gc8a27bae3

Describe the bug

E5108: Error executing lua: ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:151: Vim:E516: No buffers were deleted
stack traceback:
[C]: in function 'bdelete'
...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:151: in function 'buf_kill'
...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:230: in function 'bufdelete'

To Reproduce
Steps to reproduce the behavior:

  1. Open a buffer
  2. Run :set bufhidden=delete
  3. Run :Bdelete
  4. See error

Expected behavior
No error is triggered.

Provide a minimal configuration to reproduce the bug

Screenshots

Additional context

[Bug] Error message everytime i start nvim

Neovim version
The output of nvim --version.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Does this error occur in the minimal init file?
Use the following commands to download the minimal init file provided by bufdelete:
curl -fLO https://raw.githubusercontent.com/famiu/bufdelete.nvim/master/minimal_init.lua

Modify the file to your needs (if necessary), then load Neovim using:
nvim --noplugin -u minimal_init.lua

And check if your issue still occurs.

Provide modified minimal_init.lua
If you modified the minimal_init.lua that bufdelete provides by default in order to fit your configuration, put it here. Otherwise ignore this part.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here (eg: other plugins that may conflict with this plugin, configuration options that you think might cause the issue, etc.).

[request] Callback or event for when there's no next buffer

Please expose a config field or aucmd event to customize the behaviour when the last buffer is closed. For example, a user may want to open their dashboard plugin when closing all buffers.

Current:

README.md

If no buffer other than the target buffer was open, bufdelete.nvim creates an empty buffer and switches to it instead.

Desired

require'bufdelete'.setup {
  -- string | function
  on_close_last_buffer = ':Alpha'
}

or

vim.api.nvim_create_augroup('bufdelete', { clear = true })
vim.api.nvim_create_autocmd('User', {
  group = 'bufdelete',
  pattern = 'bufdelete_empty',
  command = ':Alpha',
})

Alternatives

This is possible without changing bufdelete.nvim:

---@author kikito
---@see https://codereview.stackexchange.com/questions/268130/get-list-of-buffers-from-current-neovim-instance
local function get_listed_buffers()
  local buffers = {}
  local len = 0
  for buffer = 1, vim.fn.bufnr('$') do
    if vim.fn.buflisted(buffer) == 1 then
      len = len + 1
      buffers[len] = buffer
    end
  end

  return buffers
end

function M.bufdelete(bufnum)
  require 'bufdelete'.bufdelete(bufnum, true)
  if #M.get_listed_buffers() == 1 and vim.api.nvim_buf_get_name(0) == '' then
    vim.cmd [[:Alpha]]
  end
end

But then the user needs to import and call that function anywhere they want this behaviour, for example in bufferline.nvim config:

bufferline.setup {
  options = {
    right_mouse_command = U.bufdelete,
    close_command = U.bufdelete,
  }
}

But this means the user has to remember each callsite. An event or callback field would allow the user to write that function once and use it automatically wherever.

[Bug] Error Triggered When Deleting Fugitive Buffer in Neovim

Neovim version
NVIM v0.10.0-dev-2433+g9418381cc-Homebrew

Describe the bug
An error occurs when attempting to delete any fugitive buffer using bufdelete.nvim. The specific error message is:

Error executing Lua callback: ...share/nvim/plugged/bufdelete.nvim/lua/bufdelete/init.lua:151: Vim:E516: No buffers were deleted.

To Reproduce

  • Install the fugitive and bufdelete.nvim plugins.
  • Open Neovim within a git repository.
  • Execute :Gedit : to open the fugitive status buffer.
  • Execute :Bdelete to attempt buffer deletion.

Expected behavior
The buffer should be deleted without triggering any errors.

Error when deleting buffer with `bufhidden=wipe`

If there are at least two buffers open, and the last buffer has bufhidden=wipe set on it, then using Bdelete errors with the following:

E5108: Error executing lua ...te/pack/packer/opt/bufdelete.nvim/lua/bufdelete/init.lua:60: Vim(bdelete):E516: No buffers were deleted: bd! 6

I could only make this happen if there are at least two normal buffers open and the buffer with the wipe option set on it is the last one. Minimal repro is basically to open three buffers, then (when on the last/most recent), set bufhidden=wipe and Bdelete.

I can't close Netrw with bufdelete function

I'm not sure if this a problem of this plugin, since I know Netrw is famous for being bugged, but previously I used vim-bbye and was able to successfully close Netrw with :Bdelete, although with this implementation it simply won't close, even with require('bufdelete').bufdelete(0, true).

Allow range command

When I try to close all buffer with :%Bdelete, I have this error:
image

Is it possible to allow range command?
Thank you. Nice plugin 👍

Show wrong next buffer

ls

However, vim.api.nvim_buf_is_loaded(2) return true. Therefore, when I delete buffer 29, buffer 2 will show next. I checked nvim-bufferline and found that they use vim.bo[buf].buflisted and vim.api.nvim_buf_is_valid(buf).

tree

one file opens in multiple buffers

Hi there , great plugin. If I have 3 files opened in 3 different split windows , lets say if I deleted 3rd buffer this happens :

  • 1st file stays at its original place
  • 2nd file opens in 3rd buffer too which has be already deleted.

check this :

simplescreenrecorder-2021-06-27_17.16.37.mp4

Cannot close unlisted buffers

Unlisted buffers, like started from :help or fern plugin, won't close.

Steps to reproduce:

  1. Open unlisted buffer via :help
  2. Try closing with :Bdelete
  3. Notice nothing happens

Workaround

  1. Open unlisted buffer via :help
  2. Make current buffer listed by setlocal buflisted or lua vim.o.buflisted = true
  3. Try closing with :Bdelete
  4. Notice buffer is closed as expected

[Not a bug]

Neovim version

NVIM v0.8.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser

Describe the bug
Neovim shows a warning when opened: Error detected while processing [config file]
When trying to update vim-plug, this error is shown:

Error detected while processing /home/slushee/.config/nvim/init.vim:
bufdelete.nvim: No buffers were deleted

The error doesn't happen when I comment out

require('bufdelete').bufdelete(0, true)

To Reproduce
Steps to reproduce the behavior:

  1. Install budelete.nvim with vim plug
  2. Add require('bufdelete').bufdelete(0, true) to the config file
  3. Open nvim / try to update vim-plug

Expected behavior
No error ocurring

Does this error occur in the minimal init file?
It does not.

Screenshots
image
image
image

Additional context
This had never happened until not too long ago.

Uncomfortable behavior change on buffer delete

Neovim version

NVIM v0.9.0-dev-34-g4bfbac05c
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-10 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/cmake.config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az447-843

Features: +acl +iconv +tui

Describe the bug

After this commit (bdaae05), when I load nvim session (:source /path/to/session/file) that has many buffers loaded, without navigating/switching to other buffers, bufdelete.nvim always showing New File if immediately close current buffer with :Bdelete. It also happens with :Bwipeout.

To Reproduce

Steps to reproduce the behavior:

  1. :mksession and quit
  2. open nvim then load session using :source
  3. without navigating to other buffer, close current buffer using :Bdelete
  4. See the new file [No name] instead of switching to other buffer

Expected behavior

When loading from session, it should switching to non unlisted buffer after closing buffer.

Does this error occur in the minimal init file?

Yes it does.

Screenshots

simplescreenrecorder-2022-10-07_13.52.48.mp4

Additional context

This behavior didn't exist in previous commits.

[Bug]

Neovim version

❯ nvim --version
NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.1/share/nvim"

Run :checkhealth for more info

Describe the bug

Error executing Lua callback: ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:161: Vim:Error executing lua callback: ....1/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:148: Vim:Error executing lua callback: Vim:E315: ml_get: invalid lnum: 1
stack traceback:
        [C]: in function 'bufload'
        vim/_editor.lua: in function 'region'
        ...ar/neovim/0.9.1/share/nvim/runtime/lua/vim/highlight.lua:35: in function 'range'
        ...share/nvim/lazy/nvim-ts-rainbow/lua/rainbow/internal.lua:82: in function 'update_range'
        ...share/nvim/lazy/nvim-ts-rainbow/lua/rainbow/internal.lua:186: in function 'cb'
        ...1/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:736: in function '_do_callback'
        ...1/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:176: in function 'invalidate'
        ...1/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:877: in function '_on_detach'
        ...r/neovim/0.9.1/share/nvim/runtime/lua/vim/treesitter.lua:73: in function <...r/neovim/0.9.1/share/nvim/runtime/lua/vim/treesitter.lua:69>
        [C]: in function 'bdelete'
        ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:161: in function 'buf_kill'
        ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:242: in function '_buf_kill_cmd'
        ...ocal/share/nvim/lazy/bufdelete.nvim/plugin/bufdelete.lua:4: in function <...ocal/share/nvim/lazy/bufdelete.nvim/plugin/bufdelete.lua:4>
stack traceback:
        [C]: in function '__newindex'
        ....1/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:148: in function 'destroy'
        ....1/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:184: in function 'on_detach'
        ....1/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:83: in function 'cb'
        ...1/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:736: in function '_do_callback'
        ...1/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:878: in function '_on_detach'
        ...r/neovim/0.9.1/share/nvim/runtime/lua/vim/treesitter.lua:73: in function <...r/neovim/0.9.1/share/nvim/runtime/lua/vim/treesitter.lua:69>
        [C]: in function 'bdelete'
        ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:161: in function 'buf_kill'
        ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:242: in function '_buf_kill_cmd'
        ...ocal/share/nvim/lazy/bufdelete.nvim/plugin/bufdelete.lua:4: in function <...ocal/share/nvim/lazy/bufdelete.nvim/plugin/bufdelete.lua:4>
stack traceback:
        [C]: in function 'bdelete'
        ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:161: in function 'buf_kill'
        ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:242: in function '_buf_kill_cmd'
        ...ocal/share/nvim/lazy/bufdelete.nvim/plugin/bufdelete.lua:4: in function <...ocal/share/nvim/lazy/bufdelete.nvim/plugin/bufdelete.lua:4>

Probably related to neovim/neovim#21416, but I don't understand the details.

To Reproduce
Steps to reproduce the behavior:

  1. Open any buffer
  2. :Bdelete

Expected behavior
No error

[Feature] Always open empty buffer when closing a buffer

Is your feature request related to a problem? Please describe.
I find it jarring when I have 2 buffers open in a split and upon closing one I now see the same file twice (once in each window)

Describe the solution you'd like
It'd be great if there was an option to allow the closed window to always be replaced with an empty buffer instead of another open buffer.

Describe alternatives you've considered
I checked the docs but didn't see anything related to this

[Feature] Provide a hook to ignore layout keep

Is your feature request related to a problem? Please describe.
Sometimes you have buffers for which you don't want to keep the layout, like Neogit or quickfix.

Describe the solution you'd like
It would be great to provide a hook, so users can decide to keep the layout or not.

Describe alternatives you've considered
Provide automatic integration with https://github.com/stevearc/stickybuf.nvim that I use.

[Bug] Cannot use `:Bdelete` in terminal buffer

Neovim version

NVIM v0.8.0
Build type: Release
LuaJIT 2.1.0-beta3
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

Describe the bug

Unable to use :Bdelete or :Bdelete! in terminal buffer (also applies to the lua API with require("bufdelete").bufdelete(...))

To Reproduce
Steps to reproduce the behavior:

  1. Open NeoVim (nvim)
  2. Open a terminal buffer (:terminal)
  3. Try to delete the buffer (:Bdelete or :Bdelete!)
  4. See error
Error executing Lua callback: ...te/pack/packer/opt/bufdelete.nvim/lua/bufdelete/init.lua:140: Vim:E89: term://~/.config/nvim/lua//221736:/bin/zsh will be killed (add ! to override)                                                                                     
stack traceback:                                                                                                                                                                                                                                                          
        [C]: in function 'bdelete'                                                                                                                                                                                                                                        
        ...te/pack/packer/opt/bufdelete.nvim/lua/bufdelete/init.lua:140: in function 'buf_kill'                                                                                                                                                                           
        ...te/pack/packer/opt/bufdelete.nvim/lua/bufdelete/init.lua:221: in function 'buf_kill_cmd'                                                                                                                                                                       
        ...te/pack/packer/opt/bufdelete.nvim/lua/bufdelete/init.lua:225: in function <...te/pack/packer/opt/bufdelete.nvim/lua/bufdelete/init.lua:225>    

Expected behavior

Close the terminal buffer

Does this error occur in the minimal init file?
Yes, this error still occurs

Provide modified minimal_init.lua
Not applicable, the provided minimal_init.lua file is sufficient for replicating this error.

Screenshots

2022-11-01_11:36:53_screenshot

Additional context

Terminal recording of this bug: https://asciinema.org/a/RmF9dYhGrlmSM7PMkebc21nkw

How could you delete all buffers other than the current one?

I have tried <cmd>%bdelete | e # | normal `"<cr> and it works, but when plugging in Bdelete instead of bdelete into that expression, I get the error bufdelete.nvim: Cannot use buffer name and buffer number at the same time. Is there a way to achieve this when using Bdelete?

Thanks!

[Feature] Delete or Wipe all hidden buffers

Hi,

I switched from close-buffers.nvim to this plugin a while ago mostly because of its ability to delete unlisted buffers which is life changing when you use sessions as heavily as I do.

One feature that I miss though is the hidden argument that allows to delete or wipe all hidden buffers at once which I find handy sometimes to clean up a session that got messy with a lot of open buffers before saving it again.

In a similar spirit, I have vim-bufonly installed for the only purpose of deleting all open buffers but the current one, I would love to be able to use one plugin only for all my buffer deletion needs.

I know I am actually requesting two different (but related) features, so tell me if you would rather have me open a separate one. I kind of got shy about posting two issues at once :)

Thank you for your time.

[Feature] If use the Bdelete in a modified buffer, could there be a UI selector?

Is your feature request related to a problem? Please describe.

If I try to use Bdelete in a modified buffer, some options will occur at the bottom of my terminal window. But since I use Bdelete via a keymap, it is hard for me to notice the bottom options.

image


Describe the solution you'd like

I would like a pop-up menu so that I can see the options well and select them. Just like the following image. (The dressing.nvim plugin is used as the selector in the image.)

image


Can this be achieved?

A strange delay when closing a buffer

Hi!

Maybe it's only me but I'm experiencing a strange delay when I delete a buffer.
The usual :bdelete is much faster.

I run the command using a keystroke:

vim.keymap.set("n", "<leader>c", "<cmd>Bdelete<cr>")

Is it correct?

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.