Skip to content

Per-window buffer history tracker and navigation utility.

License

Notifications You must be signed in to change notification settings

veigaribo/winhist.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

winhist.nvim

Allows per-window buffer history tracking for backwards and forwards navigation.

Installation

Adjust to your liking.

lazy.nvim

---@module 'lazy'
---@type LazyPluginSpec
return {
	'veigaribo/winhist.nvim',
	lazy = false, -- Start tracking histories as soon as possible.

	---@module 'winhist'
	---@type WinHistOptions
	opts = {
		-- Maximum history size *per window*, in number of buffers.
		-- Default is 100.
		max_history_height = 100,
	},

	config = function(_, opts)
		local winhist = require('winhist')
		winhist.setup(opts)

		-- Load the previous buffer.
		vim.keymap.set('n', '<leader>b[', winhist.previous)
		-- Load the next buffer (in case you went to a previous one).
		vim.keymap.set('n', '<leader>b]', winhist.next)
		-- Print the histories, if you are curious.
		vim.keymap.set('n', '<leader>b?', winhist.dump)
	end,
}

Known issues

There seems to be some way to destroy windows that this plugin is not detecting. So, over time, it may end up tracking more windows than there actually are. If you notice that's happening to you, you can run the prune function like so:

:lua require('winhist').prune()

This should remove tracking for every nonexistent window.

About

Per-window buffer history tracker and navigation utility.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages