chrisgrieser/nvim-early-retirement

github github
pluginsplit-and-windowbuffer
stars 82
issues 1
subscribers 2
forks 2
CREATED

2023-03-31

UPDATED

last month


nvim-early-retirement 👴👵

Send buffers into early retirement by automatically closing them after x minutes of inactivity.

Makes the bufferline or :bnext less crowded.

Installation

-- packer
use {
    "chrisgrieser/nvim-early-retirement",
    config = function () require("early-retirement").setup() end,
}

-- lazy.nvim
{
    "chrisgrieser/nvim-early-retirement",
    config = true,
    event = "VeryLazy",
},

Configuration

-- default values
opts = {
    -- if a buffer has been inactive for this many minutes, close it
    retirementAgeMins = 20,

    -- filetypes to ignore
    ignoredFiletypes = {},

    -- ignore files matches this lua pattern (string.find); empty string 
    -- disables this setting
    ignoreFilenamePattern = "";

    -- will not close the alternate file
    ignoreAltFile = true,

    -- minimum number of open buffers for auto-closing to become active, e.g.,
    -- by setting this to 4, no auto-closing will take place when you have 3 
    -- or less open buffers. Note that this plugin never closes the currently 
    -- active buffer, so a number < 2 will effectively disable this setting.
    minimumBufferNum = 1, 

    -- will ignore buffers with unsaved changes. If false, the buffers will
    -- automatically be written and then closed.
    ignoreUnsavedChangesBufs = true,

    -- ignore non-empty buftypes, for example terminal buffers
    ignoreSpecialBuftypes = true,

    -- ignore visible buffers ("a" in `:buffers`). buffers open in a window, 
    -- or in a tab are consider visible by vim
    ignoreVisibleBufs = true,

    -- ignore unloaded buffers. session-management plugin often add buffers
    -- to the buffer list without loading them
    ignoreUnloadedBufs = false,

    -- uses vim.notify for plugins like nvim-notify
    notificationOnAutoClose = false,
}

Similar Plugins

  • Close unedited files: hbac

Credits

Thanks
To @nikfp and @xorg-dogma on Discord for their help.

About Me
In my day job, I am a sociologist studying the social mechanisms underlying the digital economy. For my PhD project, I investigate the governance of the app economy and how software ecosystems manage the tension between innovation and compatibility. If you are interested in this subject, feel free to get in touch.

Blog
I also occasionally blog about vim: Nano Tips for Vim

Profiles

Buy Me a Coffee