1
0
Fork 0
mirror of https://github.com/vim/vim synced 2025-04-12 20:56:12 +02:00

runtime(comment): fix syntax error

fixes: 
closes: 

Signed-off-by: Konfekt <Konfekt@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Konfekt 2024-09-30 19:30:34 +02:00 committed by Christian Brabandt
parent 5dd4ec0089
commit 0fb25515cc
No known key found for this signature in database
GPG key ID: F3F92DA383FDDE09
2 changed files with 4 additions and 4 deletions
runtime/pack/dist/opt/comment

View file

@ -1,7 +1,7 @@
vim9script
# Maintainer: Maxim Kim <habamax@gmail.com>
# Last Update: 2024-09-24
# Last Update: 2024-09-30
#
# Toggle comments
# Usage:
@ -24,7 +24,7 @@ export def Toggle(...args: list<string>): string
var first_col = indent(lnum1)
var start_col = getpos("'[")[2]
if len(cms_l) == 1 && lnum1 == lnum2 && first_col < start_col
var line_start = getline(lnum1)[0 : max(0, start_col - 2)]
var line_start = getline(lnum1)[0 : max([0, start_col - 2])]
var line_end = getline(lnum1)[start_col - 1 : -1]
line_end = line_end =~# $'^\s*{cms_l[0]}' ?
\ substitute(line_end, $'^\s*\zs{cms_l[0]}', '', '') :

View file

@ -1,4 +1,4 @@
*comment.txt* For Vim version 9.1. Last change: 2024 Sep 29
*comment.txt* For Vim version 9.1. Last change: 2024 Sep 30
VIM REFERENCE MANUAL
@ -27,7 +27,7 @@ To comment the rest of the line by `gC` whenever the filetype plugin
supports it (that is, whenever the comment marker precedes the code) and fall
back to `gcc` otherwise, add the following mapping to your vimrc: >
nnoremap <silent> <expr> gC comment.Toggle() .. '$'
nnoremap <silent> <expr> gC comment#Toggle() .. '$'
<
Note: using `gC` may not always result in valid comment markers depending on
the language used.