Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bloznelis/before.nvim

Jump to the last edit in Neovim
https://github.com/bloznelis/before.nvim

lua neovim neovim-plugin

Last synced: 11 days ago
JSON representation

Jump to the last edit in Neovim

Awesome Lists containing this project

README

        

# before.nvim

## Purpose
Track edit locations and jump back to them, like [changelist](https://neovim.io/doc/user/motion.html#changelist), but across buffers.

![peeked](https://github.com/bloznelis/before.nvim/assets/33397865/1130572d-dd75-4a07-9c79-9afc91b5d67a)

## Installation
### lazy.nvim
```lua
{
'bloznelis/before.nvim',
config = function()
local before = require('before')
before.setup()

-- Jump to previous entry in the edit history
vim.keymap.set('n', '', before.jump_to_last_edit, {})

-- Jump to next entry in the edit history
vim.keymap.set('n', '', before.jump_to_next_edit, {})

-- Look for previous edits in quickfix list
vim.keymap.set('n', 'oq', before.show_edits_in_quickfix, {})

-- Look for previous edits in telescope (needs telescope, obviously)
vim.keymap.set('n', 'oe', before.show_edits_in_telescope, {})
end
}
```

### Configuration
#### Settings
```lua
require('before').setup({
-- How many edit locations to store in memory (default: 10)
history_size = 42
-- Wrap around the ends of the edit history (default: false)
history_wrap_enabled = true
})
```
#### Telescope picker
```lua
-- You can provide telescope opts to the picker as show_edits_in_telescope argument:
vim.keymap.set('n', 'oe', function()
before.show_edits_in_telescope(require('telescope.themes').get_dropdown())
end, {})
```

#### Register Telescope extension

You may also register the extension via telescope:

```lua
require 'telescope'.setup({ '$YOUR_TELESCOPE_OPTS' })
require 'telescope'.load_extension('before')
```

Then call via vimscript:

```vim
:Telescope before
```

or lua:

```lua
require 'telescope'.extensions.before.before
```