patch 9.1.1229: the comment plugin can be improved

Problem:  the comment plugin can be improved
Solution: add comment text objects "ic" and "ac"
          (Maxim Kim)

closes: #16938

Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Maxim Kim
2025-03-21 18:02:56 +01:00
committed by Christian Brabandt
parent 51a06ecee0
commit 9712a2534f
6 changed files with 451 additions and 8 deletions

View File

@ -1,9 +1,15 @@
vim9script
# Maintainer: Maxim Kim <habamax@gmail.com>
# Last Update: 2024-04-26
# Last Update: 2025 Mar 21
import autoload 'comment.vim'
nnoremap <silent> <expr> gc comment.Toggle()
xnoremap <silent> <expr> gc comment.Toggle()
nnoremap <silent> <expr> gcc comment.Toggle() .. '_'
onoremap <silent>ic <scriptcmd>comment.ObjComment(v:true)<CR>
onoremap <silent>ac <scriptcmd>comment.ObjComment(v:false)<CR>
xnoremap <silent>ic <esc><scriptcmd>comment.ObjComment(v:true)<CR>
xnoremap <silent>ac <esc><scriptcmd>comment.ObjComment(v:false)<CR>