Skip to content

feat(keymaps): expand smart skip and add QOL improvements - #3

Merged
TheOnliestMattastic merged 3 commits into
mainfrom
more-cowbell
Dec 31, 2025
Merged

feat(keymaps): expand smart skip and add QOL improvements#3
TheOnliestMattastic merged 3 commits into
mainfrom
more-cowbell

Conversation

@TheOnliestMattastic

@TheOnliestMattastic TheOnliestMattastic commented Dec 31, 2025

Copy link
Copy Markdown
Owner

User description

WHAT:

  • Enhanced <C-;> keymap to skip language keywords (then, do, end, else, elseif) in addition to closing punctuation; keywords are organized by filetype for easy extension to other languages (Python, JavaScript, etc.)
  • Added (Shift+Backspace) in insert mode to exit to normal mode faster than Esc
  • Overrode J keymap in normal mode to warn about CAPS LOCK instead of joining lines; use :join command for original behavior

WHY:

  • Smart keyword skipping reduces friction when writing code with auto-completed blocks (if...then...end, for...do...end, etc.)
  • Shift+Backspace is easier to reach and more ergonomic than Esc for insert mode exit
  • CAPS LOCK detection prevents accidental line joins when forgetting to unlock caps after exiting insert mode; a common workflow pain point

Updated CHANGELOG.md (v1.0.3) and README.md with new features. Updated KEYMAPS.md with new keybindings.


PR Type

Enhancement


Description

  • Enhanced <C-;> keymap to skip language keywords (then, do, end, else, elseif) in addition to closing punctuation

  • Added <S-BS> (Shift+Backspace) in insert mode to exit faster than Esc

  • Overrode J keymap in normal mode to warn about CAPS LOCK instead of joining lines

  • Updated documentation (CHANGELOG.md, README.md, KEYMAPS.md) and dependencies


Diagram Walkthrough

flowchart LR
  A["Smart Skip Enhancement"] --> B["Punctuation & Keywords"]
  A --> C["Insert Mode Exit"]
  A --> D["CAPS LOCK Detection"]
  B --> E["Filetype-aware keyword skipping"]
  C --> F["Shift+Backspace mapping"]
  D --> G["J keymap override with warning"]
  H["Documentation Updates"] --> I["CHANGELOG.md v1.0.3"]
  H --> J["KEYMAPS.md sections"]
  H --> K["README.md features"]
Loading

File Walkthrough

Relevant files
Enhancement
keymaps.lua
Smart skip enhancement and insert mode QOL improvements   

lua/config/keymaps.lua

  • Enhanced keymap to skip language keywords organized by filetype (lua:
    then, do, end, else, elseif) in addition to closing punctuation
  • Added (Shift+Backspace) mapping in insert mode to exit to normal mode
  • Added J keymap override in normal mode to warn about CAPS LOCK instead
    of joining lines
  • Improved code documentation with detailed WHAT/WHY/HOW comments for
    each feature
+53/-8   
Documentation
CHANGELOG.md
Version 1.0.3 changelog with new features                               

CHANGELOG.md

  • Added new v1.0.3 release section documenting smart keyword skipping,
    insert mode exit, and CAPS LOCK detection features
  • Documented filetype-aware keyword extension capability for future
    languages
  • Added documentation update note for KEYMAPS.md
+14/-0   
KEYMAPS.md
Keymap documentation for new features                                       

KEYMAPS.md

  • Renamed "Smart Closing Punctuation Skip" section to "Smart Skip" and
    updated description to include keywords
  • Added new "Insert Mode Control" section documenting keymap
  • Added new "Normal Mode Utilities" section documenting J CAPS LOCK
    detection keymap
+16/-4   
README.md
Feature highlights for new keymaps                                             

README.md

  • Added two new feature bullets highlighting smart text insertion with
    punctuation/keyword skipping
  • Added CAPS LOCK detection feature description explaining the J keymap
    override
+2/-0     
Dependencies
lazy-lock.json
Dependency version updates                                                             

lazy-lock.json

  • Updated conform.nvim commit hash
  • Updated nvim-lspconfig commit hash
  • Updated nvim-treesitter commit hash
+3/-3     

WHAT:
- Enhanced <C-;> keymap to skip language keywords (then, do, end, else, elseif)
  in addition to closing punctuation; keywords are organized by filetype for
  easy extension to other languages (Python, JavaScript, etc.)
- Added <S-BS> (Shift+Backspace) in insert mode to exit to normal mode faster
  than Esc
- Overrode J keymap in normal mode to warn about CAPS LOCK instead of joining
  lines; use :join command for original behavior

WHY:
- Smart keyword skipping reduces friction when writing code with auto-completed
  blocks (if...then...end, for...do...end, etc.)
- Shift+Backspace is easier to reach and more ergonomic than Esc for insert
  mode exit
- CAPS LOCK detection prevents accidental line joins when forgetting to unlock
  caps after exiting insert mode; a common workflow pain point

Updated CHANGELOG.md (v1.0.3) and README.md with new features.
Updated KEYMAPS.md with new keybindings.
@continue

continue Bot commented Dec 31, 2025

Copy link
Copy Markdown

All Green - Keep your PRs mergeable

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts


Unsubscribe from All Green comments

@qodo-code-review

qodo-code-review Bot commented Dec 31, 2025

Copy link
Copy Markdown
Contributor

PR Compliance Guide 🔍

(Compliance updated until commit aa07d5f)

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

🔴
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Missing nil guard: The new J keymap calls Snacks.notify.warn without verifying Snacks (and Snacks.notify)
exists, which can throw an error instead of degrading gracefully.

Referred Code
map("n", "J", function()
  Snacks.notify.warn("CAPS LOCK may be on—press <S-BS> to exit insert mode properly!")
end, { noremap = true, silent = true, desc = "CAPS LOCK Detection" })

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

Previous compliance checks

Compliance check up to commit 2b8b6d2
Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

🔴
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Missing nil guard: The new J mapping calls Snacks.notify.warn without verifying that Snacks/Snacks.notify
exists, which can cause a runtime error instead of graceful degradation.

Referred Code
map("n", "J", function()
  Snacks.notify.warn("CAPS LOCK may be on—press <S-BS> to exit insert mode properly!")
end, { noremap = true, silent = true, desc = "CAPS LOCK Detection" })

Learn more about managing compliance generic rules or creating your own custom rules

@qodo-code-review

qodo-code-review Bot commented Dec 31, 2025

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Conditionally trigger CAPS LOCK warning

Modify the J keymap to conditionally trigger the CAPS LOCK warning only when an
uppercase J is pressed, and execute the default join action otherwise.

lua/config/keymaps.lua [191-193]

 map("n", "J", function()
-  Snacks.notify.warn("CAPS LOCK may be on—press <S-BS> to exit insert mode properly!")
+  if vim.v.key == "J" then
+    Snacks.notify.warn("CAPS LOCK may be on—press <S-BS> to exit insert mode properly!")
+  else
+    vim.cmd("join")
+  end
 end, { noremap = true, silent = true, desc = "CAPS LOCK Detection" })
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly points out that the J keymap unconditionally blocks the join functionality and provides a much better implementation that conditionally warns for J (likely CAPS LOCK) while preserving the default behavior for j.

High
Prevent partial keyword matching bugs
Suggestion Impact:The commit changed the keyword matching from a prefix-with-whitespace regex to a boundary-aware find() pattern and only advanced the cursor by the keyword length, preventing partial matches.

code diff:

   for _, keyword in ipairs(keywords) do
-    -- Match keyword followed by optional whitespace
-    local match = remaining:match("^" .. keyword .. "%s*")
-    if match then
-      vim.api.nvim_win_set_cursor(0, { row, col + #match })
+    -- Match keyword followed by a word boundary (non-alphanumeric or end of line)
+    local match_start, match_end = remaining:find("^" .. keyword .. "($|%W)")
+    if match_start then
+      -- We only want to advance past the keyword itself, not the boundary character
+      vim.api.nvim_win_set_cursor(0, { row, col + #keyword })
       return

To prevent partial keyword matches like else in elseif, modify the regex to
include a word boundary, ensuring only whole keywords are skipped.

lua/config/keymaps.lua [161-168]

 for _, keyword in ipairs(keywords) do
-  -- Match keyword followed by optional whitespace
-  local match = remaining:match("^" .. keyword .. "%s*")
-  if match then
-    vim.api.nvim_win_set_cursor(0, { row, col + #match })
+  -- Match keyword followed by a word boundary (non-alphanumeric or end of line)
+  local match_start, match_end = remaining:find("^" .. keyword .. "($|%W)")
+  if match_start then
+    -- We only want to advance past the keyword itself, not the boundary character
+    vim.api.nvim_win_set_cursor(0, { row, col + #keyword })
     return
   end
 end

[Suggestion processed]

Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a bug in the new keyword skipping feature where partial keywords could be matched (e.g., else in elseif), and provides a robust fix using word boundaries.

Medium
General
Add alternative Exit mapping

Add as an alternative keymap to exit insert mode, as is not reliably supported
across all terminals.

lua/config/keymaps.lua [180]

 map("i", "<S-BS>", "<Esc>", { noremap = true, silent = true, desc = "Exit Insert Mode" })
+map("i", "<C-h>", "<Esc>",   { noremap = true, silent = true, desc = "Exit Insert Mode" })

[Suggestion processed]

Suggestion importance[1-10]: 5

__

Why: The suggestion correctly notes that <S-BS> can be unreliable in some terminals and proposes adding <C-h> as a common and more compatible alternative, improving the usability of the new feature.

Low
  • Update

Comment thread lua/config/keymaps.lua
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Comment thread lua/config/keymaps.lua Outdated
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
@TheOnliestMattastic
TheOnliestMattastic merged commit 9779063 into main Dec 31, 2025
2 checks passed
@TheOnliestMattastic
TheOnliestMattastic deleted the more-cowbell branch December 31, 2025 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant