Bug 490195 - [wish] gc to toggle comments
Summary: [wish] gc to toggle comments
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: Vi Input Mode (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-12 19:27 UTC by Diego Gangl
Modified: 2025-03-04 08:40 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.12
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Gangl 2024-07-12 19:27:03 UTC
SUMMARY

Kate has an action to toggle commenting using "ctrl+/". In Vim and NeoVim this is done using the "gc" movement.
It would be nice to have this movement in VIMode in kate, since it's muscle memory for many vimmers.

References:
https://github.com/neovim/neovim/pull/28176
https://github.com/numToStr/Comment.nvim
https://github.com/tpope/vim-commentary (the original)

Motions aren't super necessary as long as it also works from visual mode.
Comment 1 TraceyC 2024-07-18 20:40:11 UTC
This seems like it wouldn't be too much work to implement
Comment 2 Christoph Cullmann 2024-11-02 16:35:46 UTC
If somebody wants to add it, merge requests welcome.
Comment 3 Waqar Ahmed 2025-03-04 08:40:36 UTC
Git commit 4b9b8c5f9085c398ed52a05a2a99e79c06484913 by Waqar Ahmed, on behalf of Kshetrimayum Abo.
Committed on 04/03/2025 at 08:40.
Pushed by waqar into branch 'master'.

Add "gc" motion for vim to Toggle Comment

Used similar code for toggle comment by pressing shortcut "Ctrl+/"
and mapped it to "gc" in vim visual mode to toggle comment
FIXED-IN: 6.12

M  +10   -0    autotests/src/vimode/modes.cpp
M  +6    -0    src/vimode/modes/normalvimode.cpp
M  +2    -0    src/vimode/modes/normalvimode.h
M  +1    -0    src/vimode/modes/visualvimode.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/4b9b8c5f9085c398ed52a05a2a99e79c06484913