mapping: `<c-n>` and `<c-p>` navigation doesn't work if `]c` mapping already set

Open Beginner friendly
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
lua, vim
Domain
tooling

Research direction

Start in /plugin/ug.vim and inspect the and mappings, then reproduce the failure with an existing ]c mapping. Update the mappings so navigation does not recurse while preserving diff-mode and optional gitsigns behavior. Verify that both keys navigate hunks with and without the existing ]c mapping.

Written by the indexing model from the issue text.

Description

Afaict in /plugin/ug.vim, the <c-n> calling ]c recursively. With claude I have replaced them with

nmap <expr> <C-n> &diff
  \ ? "\<Cmd>normal! ]c\<CR>]n"
  \ : (luaeval('({pcall(require, "gitsigns")})[1]')
  \    ? '<cmd>lua require("gitsigns").next_hunk({wrap=false})<cr>'
  \    : ']n')

nmap <expr> <C-p> &diff
  \ ? "\<Cmd>normal! [c\<CR>[n"
  \ : (luaeval('({pcall(require, "gitsigns")})[1]')
  \    ? '<cmd>lua require("gitsigns").prev_hunk({wrap=false})<cr>'
  \    : '[n')
Dominant language
Lua
Stars
14
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.