Skip to content

Add drop command for buffers#2131

Merged
Conni2461 merged 2 commits into
nvim-telescope:masterfrom
n0bra1n3r:buffer-drop
Aug 13, 2022
Merged

Add drop command for buffers#2131
Conni2461 merged 2 commits into
nvim-telescope:masterfrom
n0bra1n3r:buffer-drop

Conversation

@n0bra1n3r

@n0bra1n3r n0bra1n3r commented Aug 13, 2022

Copy link
Copy Markdown
Contributor

Description

Adds vim's drop command for opening buffers:

:dr[op] [++opt] [+cmd] {file} ..
Edit the first {file} in a window.
- If the file is already open in a window change to that
window.
- If the file is not open in a window edit the file in the
current window. If the current buffer can't be abandoned,
the window is split first.
- Windows that are not in the argument list or are not full
width will be closed if possible.
The argument-list is set, like with the :next command.
The purpose of this command is that it can be used from a
program that wants Vim to edit another file, e.g., a debugger.
When using the :tab modifier each argument is opened in a
tab page. The last window is used if it's empty.
Also see ++opt and +cmd.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Added a call to require"telescope.actions.set".edit(bufnr, "drop") for my buffers mapping.
  • Executed mapping on a selected buffer in the Telescope buffers list.

Configuration:

  • Neovim version (nvim --version): v0.7.2
  • Operating system and version: Windows 11

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

@n0bra1n3r
n0bra1n3r marked this pull request as draft August 13, 2022 01:43
@n0bra1n3r
n0bra1n3r marked this pull request as ready for review August 13, 2022 02:17
@n0bra1n3r
n0bra1n3r marked this pull request as draft August 13, 2022 02:18
@n0bra1n3r
n0bra1n3r marked this pull request as ready for review August 13, 2022 02:31
@kkharji

kkharji commented Aug 13, 2022

Copy link
Copy Markdown
Member

Oh wow I never knew this a thing a nvim. Pretty useful. Thanks

@Conni2461

Copy link
Copy Markdown
Member

Thanks :)

(new feature, will not be backported to 0.1.x)

@Conni2461
Conni2461 merged commit d793de0 into nvim-telescope:master Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants