File: comment.vim

package info (click to toggle)
vim 2%3A9.1.2103-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 93,456 kB
  • sloc: ansic: 433,730; cpp: 6,399; makefile: 4,597; sh: 2,397; java: 2,312; xml: 2,099; python: 1,595; perl: 1,419; awk: 730; lisp: 501; cs: 458; objc: 369; sed: 8; csh: 6; haskell: 1
file content (29 lines) | stat: -rw-r--r-- 1,207 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
vim9script

# Maintainer: Maxim Kim <habamax@gmail.com>
# Last Update: 2025 Mar 21
# 2025 Jun 22 by Vim Project: add <Plug> mappings #17563

import autoload 'comment.vim'

nnoremap <silent> <expr> <Plug>(comment-toggle) comment.Toggle()
xnoremap <silent> <expr> <Plug>(comment-toggle) comment.Toggle()
nnoremap <silent> <expr> <Plug>(comment-toggle-line) comment.Toggle() .. '_'
nnoremap <silent> <expr> <Plug>(comment-toggle-end) comment.Toggle() .. '$'

onoremap <silent> <Plug>(comment-text-object-inner) <scriptcmd>comment.ObjComment(v:true)<CR>
onoremap <silent> <Plug>(comment-text-object-outer) <scriptcmd>comment.ObjComment(v:false)<CR>
xnoremap <silent> <Plug>(comment-text-object-inner) <esc><scriptcmd>comment.ObjComment(v:true)<CR>
xnoremap <silent> <Plug>(comment-text-object-outer) <esc><scriptcmd>comment.ObjComment(v:false)<CR>

if get(g:, 'comment_mappings', true)
  nmap gc <Plug>(comment-toggle)
  xmap gc <Plug>(comment-toggle)
  nmap gcc <Plug>(comment-toggle-line)
  nmap gC <Plug>(comment-toggle-end)

  omap ic <Plug>(comment-text-object-inner)
  omap ac <Plug>(comment-text-object-outer)
  xmap ic <Plug>(comment-text-object-inner)
  xmap ac <Plug>(comment-text-object-outer)
endif