Skip to content

genesy/repeatable.nvim

Repository files navigation

repeatable.nvim

> Makes custom keymaps repeatable

📋 Installation

Package manager Snippet

wbthomason/packer.nvim

-- stable version
use {"repeatable.nvim", tag = "*" }
-- dev version
use {"repeatable.nvim"}

junegunn/vim-plug

-- stable version
Plug "repeatable.nvim", { "tag": "*" }
-- dev version
Plug "repeatable.nvim"

folke/lazy.nvim

-- stable version
require("lazy").setup({{"repeatable.nvim", version = "*"}})
-- dev version
require("lazy").setup({"repeatable.nvim"})

⚙ Configuration

Note: The options are also available in Neovim by calling :h repeatable.options

require("repeatable").setup({
    opts = {
      -- define the functions you want to be repeatable
      functions = {
        next_git_hunk = function()
          require('gitsigns').nav_hunk('next', { greedy = true })
        end
        prev_hunk = function()
          gitsigns.nav_hunk('prev', { greedy = true })
        end,
        next_diagnostic = function()
          vim.diagnostic.goto_next({
            float = false,
          })
        end,
  
        prev_diagnostic = function()
          vim.diagnostic.goto_prev({
            float = false,
          })
        end,
      }
    }
})

-- then set your keymaps

local r = require('repeatable')
vim.keymap.set({ 'n' }, '<leader>xn', function()
  r.call('next_diagnostic')
end, { desc = 'Next diagnostic' })

vim.keymap.set({ 'n' }, '<leader>xp', r.keymap('prev_diagnostic'), { desc = 'Previous diagnostic' })
-- r.k(function_name) will also work as keymap

⌨ Contributing

PRs and issues are always welcome. Make sure to provide as much context as possible when opening one.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published