0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

Merge 1a0309793ef3bc78c2c3c909b6c99e65af32dcb9 into a494ce1c64a2637719a5c1339abf19ec7c48089c

This commit is contained in:
dkearns 2025-07-04 11:10:31 +02:00 committed by GitHub
commit ad6480b833
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 37 additions and 12 deletions

View File

@ -1,4 +1,4 @@
*motion.txt* For Vim version 9.1. Last change: 2025 Apr 03 *motion.txt* For Vim version 9.1. Last change: 2025 May 29
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -809,12 +809,12 @@ m< or m> Set the |'<| or |'>| mark. Useful to change what the
start and end position. start and end position.
*:ma* *:mark* *E191* *:ma* *:mark* *E191*
:[range]ma[rk] {a-zA-Z'} :[range]ma[rk] {a-zA-Z`'[]<>}
Set mark {a-zA-Z'} at last line number in [range], Set mark {a-zA-Z`'[]<>} at last line number in
column 0. Default is cursor line. [range], column 0. Default is cursor line.
*:k* *:k*
:[range]k{a-zA-Z'} Same as :mark, but the space before the mark name can :[range]k{a-zA-Z`'[]<>} Same as :mark, but the space before the mark name can
be omitted. be omitted.
This command is not supported in |Vim9| script, This command is not supported in |Vim9| script,
because it is too easily confused with a variable because it is too easily confused with a variable

View File

@ -1,7 +1,7 @@
" Vim syntax file " Vim syntax file
" Language: Vim help file " Language: Vim help file
" Maintainer: The Vim Project <https://github.com/vim/vim> " Maintainer: The Vim Project <https://github.com/vim/vim>
" Last Change: 2024 Dec 25 " Last Change: 2025 May 29
" Former Maintainer: Bram Moolenaar <Bram@vim.org> " Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Quit when a (custom) syntax file was already loaded " Quit when a (custom) syntax file was already loaded
@ -100,7 +100,7 @@ syn match helpSpecial "\[+-]N\>"ms=s+4
syn match helpSpecial "^\t-\?\zsNs\?\s"me=s+1 syn match helpSpecial "^\t-\?\zsNs\?\s"me=s+1
" highlighting N of cinoptions-values in indent.txt " highlighting N of cinoptions-values in indent.txt
syn match helpSpecial "^\t[>enf{}^L:=lbghNEpti+cC/(uUwWkmMjJ)*#P]N\s"ms=s+2,me=e-1 syn match helpSpecial "^\t[>enf{}^L:=lbghNEpti+cC/(uUwWkmMjJ)*#P]N\s"ms=s+2,me=e-1
syn match helpSpecial "{[-a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}" syn match helpSpecial "{[-a-zA-Z0-9`'"*+/:%#=[\]<>.,]\+}"
syn match helpSpecial "\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1 syn match helpSpecial "\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1
syn match helpSpecial "<[-a-zA-Z0-9_]\+>" syn match helpSpecial "<[-a-zA-Z0-9_]\+>"
syn match helpSpecial "<[SCM]-.>" syn match helpSpecial "<[SCM]-.>"

View File

@ -451,8 +451,7 @@ EXTERN char e_str_exists_add_bang_to_override[]
INIT(= N_("E189: \"%s\" exists (add ! to override)")); INIT(= N_("E189: \"%s\" exists (add ! to override)"));
EXTERN char e_cannot_open_str_for_writing_2[] EXTERN char e_cannot_open_str_for_writing_2[]
INIT(= N_("E190: Cannot open \"%s\" for writing")); INIT(= N_("E190: Cannot open \"%s\" for writing"));
EXTERN char e_argument_must_be_letter_or_forward_backward_quote[] // E191 unused
INIT(= N_("E191: Argument must be a letter or forward/backward quote"));
EXTERN char e_recursive_use_of_normal_too_deep[] EXTERN char e_recursive_use_of_normal_too_deep[]
INIT(= N_("E192: Recursive use of :normal too deep")); INIT(= N_("E192: Recursive use of :normal too deep"));
#ifdef FEAT_EVAL #ifdef FEAT_EVAL

View File

@ -9110,11 +9110,17 @@ ex_mark(exarg_T *eap)
return; return;
} }
if (VIM_ISDIGIT(eap->arg[0])) // viminfo write marks only
{
semsg(_(e_invalid_argument_str), eap->arg);
return;
}
pos = curwin->w_cursor; // save curwin->w_cursor pos = curwin->w_cursor; // save curwin->w_cursor
curwin->w_cursor.lnum = eap->line2; curwin->w_cursor.lnum = eap->line2;
beginline(BL_WHITE | BL_FIX); beginline(BL_WHITE | BL_FIX);
if (setmark(*eap->arg) == FAIL) // set mark if (setmark(*eap->arg) == FAIL) // set mark
emsg(_(e_argument_must_be_letter_or_forward_backward_quote)); semsg(_(e_invalid_argument_str), eap->arg);
curwin->w_cursor = pos; // restore curwin->w_cursor curwin->w_cursor = pos; // restore curwin->w_cursor
} }

View File

@ -4701,7 +4701,7 @@ nv_mark(cmdarg_T *cap)
if (checkclearop(cap->oap)) if (checkclearop(cap->oap))
return; return;
if (setmark(cap->nchar) == FAIL) if (VIM_ISDIGIT(cap->nchar) || setmark(cap->nchar) == FAIL)
clearopbeep(cap->oap); clearopbeep(cap->oap);
} }

View File

@ -225,9 +225,29 @@ endfunc
func Test_mark_error() func Test_mark_error()
call assert_fails('mark', 'E471:') call assert_fails('mark', 'E471:')
call assert_fails('mark "', 'E471:')
call assert_fails('mark _', 'E475:')
call assert_fails('mark 0', 'E475:')
call assert_fails('mark 9', 'E475:')
call assert_fails('mark .', 'E475:')
call assert_fails('mark ^', 'E475:')
call assert_fails('mark (', 'E475:')
call assert_fails('mark )', 'E475:')
call assert_fails('mark {', 'E475:')
call assert_fails('mark }', 'E475:')
call assert_fails('mark xx', 'E488:') call assert_fails('mark xx', 'E488:')
call assert_fails('mark _', 'E191:')
call assert_beeps('normal! m~') call assert_beeps('normal! m~')
call assert_beeps('normal! m0')
call assert_beeps('normal! m9')
call assert_beeps('normal! m.')
call assert_beeps('normal! m^')
call assert_beeps('normal! m(')
call assert_beeps('normal! m)')
call assert_beeps('normal! m{')
call assert_beeps('normal! m}')
call setpos("'k", [0, 100, 1, 0]) call setpos("'k", [0, 100, 1, 0])
call assert_fails("normal 'k", 'E19:') call assert_fails("normal 'k", 'E19:')