• Stars
    star
    292
  • Rank 142,152 (Top 3 %)
  • Language
    Vim Script
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ‘Ί Sane buffer/window deletion.

vim-sayonara

This plugin provides a single command that deletes the current buffer and handles the current window in a smart way.

Basically you don't have to think in terms of :bdelete, :close, :quit etc. anymore. The plugin does that for you.

It reduces cognitive load and lets you focus on the main task: editing text.

:Sayonara

This deletes the current buffer and closes the current window.

:Sayonara!

This deletes the current buffer and preserves the current window.

Installation and Documentation

Use your favorite plugin manager, e.g. vim-plug:

Plug 'mhinz/vim-sayonara', { 'on': 'Sayonara' }

Read :h sayonara for more information about this plugin.

Details

First of all, :Sayonara or :Sayonara! will only delete the buffer, if it isn't shown in any other window. Otherwise :bdelete would close these windows as well. Therefore both commands always only affect the current window. This is what the user expects and is easy reason about.

If the buffer contains unsaved changes, you'll be prompted on what to do.

:Sayonara

* mark current buffer
* current window is the only window in current tabpage?
  true  => is there only one tabpage?
           true  => are there any other active buffers?
                    true  => switch to most recently used active buffer
                    false => Is g:sayonara_confirm_quit set?
                             true  => confirm whether to quit Vim
                             false => quit Vim
           false => close tabpage
  false => close window
* delete marked buffer unless it is shown in any other window

:Sayonara!

* mark current buffer
* are there any other active buffers?
  true  => switch to most recently used active buffer
  false => create an empty scratch buffer
* delete marked buffer unless it is shown in any other window

If a window with an associated location-list is closed, the location list will be closed as well.

Isn't this the same as bufkill?

No.

The biggest difference is that bufkill doesn't handle other windows and tabpages at all, so if you try to delete a buffer that is also shown in another window, multiple windows will be closed. Sayonara is more predictable in this regard, and, if at all, only closes the current window.

Bufkill also doesn't handle associated location lists.

Sayonara simply handles more corner cases and tries to make one command always Do The Right Thing whereas bufkill provides multiple commands so you always have to think about what you're trying to do.

Feedback

If you like this plugin, star it! It's a great way of getting feedback. The same goes for reporting issues or feature requests.

Contact: Twitter

More Repositories

1

vim-galore

πŸŽ“ All things Vim!
Vim Script
16,758
star
2

vim-startify

πŸ”— The fancy start screen for Vim.
Vim Script
5,301
star
3

vim-signify

βž• Show a diff using Vim its sign column.
Vim Script
2,689
star
4

neovim-remote

πŸ‘Œ Support for --remote and friends.
Python
1,735
star
5

vim-grepper

πŸ‘Ύ Helps you win at grep.
Vim Script
1,212
star
6

dotfiles

😈 Vim, git, zsh, tmux, and other goodies.
Shell
314
star
7

vim-mix-format

Vim integration for the Elixir formatter.
Vim Script
222
star
8

vim-janah

Vim colorscheme.
Vim Script
194
star
9

vim-rfc

πŸ““ Query RFC database and download RFCs from within Vim.
Vim Script
108
star
10

vim-crates

Handle Cargo dependencies like a Rustavimean.
Vim Script
90
star
11

vim-lookup

Jump to the definition of variables or functions in VimL code.
Vim Script
58
star
12

vim-tree

🌲 Use tree(1) for quick navigation.
Vim Script
57
star
13

vim-hugefile

Speed up loading of large files.
Vim Script
55
star
14

vim-halo

πŸ˜‡ Visual highlight for your cursor.
Vim Script
49
star
15

vi-editor-history

Short history of editors.
46
star
16

vim-randomtag

πŸ’‘ Jump to random Vim documentation.
Vim Script
42
star
17

spotlight-cli

ο£Ώ Command-line tool for Spotlight.
Shell
36
star
18

brew-go

Manage Go tools via Homebrew.
Ruby
28
star
19

node-thesaurus-com

Look up synonyms/antonyms on thesaurus.com.
JavaScript
17
star
20

flauschix

My new POSIX-like operating system.
C
6
star
21

let-me-work

Chrome extension that helps focusing.
JavaScript
5
star
22

c-corner

C
4
star
23

gomali

Simple Markdown linter.
Go
4
star
24

sweepy

A simple threaded ping sweeping tool.
C
2
star