https://github.com/TheLazyCat00/racer-nvim
A Neovim plugin for cycling through key sequences with custom triggers.
https://github.com/TheLazyCat00/racer-nvim
Last synced: 10 days ago
JSON representation
A Neovim plugin for cycling through key sequences with custom triggers.
- Host: GitHub
- URL: https://github.com/TheLazyCat00/racer-nvim
- Owner: TheLazyCat00
- Created: 2025-03-20T17:06:08.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-04-19T11:05:01.000Z (19 days ago)
- Last Synced: 2025-04-19T16:21:03.069Z (19 days ago)
- Language: Lua
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- trackawesomelist - TheLazyCat00/racer-nvim (⭐4) - Overload ; and , with custom keymaps. (Recently Updated / [Apr 28, 2025](/content/2025/04/28/README.md))
- awesome-neovim-sorted - TheLazyCat00/racer-nvim
README
# racer-nvim 🏎
racer-nvim allows you to repeat the last jump forward or backward. It's similar to demicolon, but unlike [demicolon](https://github.com/mawkler/demicolon.nvim), this plugin works with any other plugin because the functionality isn't hardcoded per jump. That means if you later add more functionality to the keys you've configured with this plugin, you won't have to worry about it not working.
https://github.com/user-attachments/assets/a41debdc-459c-42f8-b141-5b84e0395e57
## Installation with [lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
{
"TheLazyCat00/racer-nvim",-- if you want to keep the defaults, do opts = {}
-- if opts is nil, lazy.nvim does not load the plugin
opts = {
triggers = {-- first element: key used to go backwards
-- last element: key used to go forwards
{"[", "]"},
{"F", "f"}
},-- allow other plugins to take over for certain keys
-- this is useful for plugins like flash.nvim or leap.nvim
-- keys specified here have to be also specified in the triggers section
-- this example is for flash.nvim
external = {
["f"] = require("flash.plugins.char").next,
["F"] = require("flash.plugins.char").prev,
}
}-- racer-nvim does not automatically configure the keymaps
-- this is a design choice because this makes it more customizable
keys = {
{";", "lua require('racer-nvim').prev()", mode = {"n", "x"}, desc = "Repeat previous"},
{",", "lua require('racer-nvim').next()", mode = {"n", "x"}, desc = "Repeat next"},
}
}
```Defaults:
```lua
{
triggers = {
{"[", "]"}
},
external = {}
}
```## Usage
1. Type a sequence starting with a trigger character (default: `[` or `]`)
2. Use the keymaps from your config to repeat the motion forwards or backwards## How It Works
1. When you type a sequence starting with a trigger character, racer-nvim records it
2. When you call `next()` or `prev()`, it replaces the first character with its corresponding pair (the one in the right direction)
and executes the new sequence
3. If an external function is defined for a trigger, it will be called insteadContributions are welcome! Feel free to open issues or submit pull requests.