Skip to content

Commit 9dfa313

Browse files
committed
patch 8.1.1270: cannot see current match position
Problem: Cannot see current match position. Solution: Show "3/44" when using the "n" command and "S" is not in 'shortmess'. (Christian Brabandt, closes #4317)
1 parent ed5ab2a commit 9dfa313

8 files changed

Lines changed: 353 additions & 53 deletions

File tree

runtime/doc/options.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,7 @@ A jump table for the options with a short description can be found at |Q_op|.
17891789
'scrolloff' + 0 no scroll offset
17901790
'shelltemp' - {unchanged} {set vim default only on resetting 'cp'}
17911791
'shiftround' + off indent not rounded to shiftwidth
1792-
'shortmess' & "" no shortening of messages
1792+
'shortmess' & "S" no shortening of messages
17931793
'showcmd' & off command characters not shown
17941794
'showmode' & off current mode not shown
17951795
'sidescrolloff' + 0 cursor moves to edge of screen in scroll
@@ -6563,8 +6563,8 @@ A jump table for the options with a short description can be found at |Q_op|.
65636563
function to get the effective shiftwidth value.
65646564

65656565
*'shortmess'* *'shm'*
6566-
'shortmess' 'shm' string (Vim default "filnxtToO", Vi default: "",
6567-
POSIX default: "A")
6566+
'shortmess' 'shm' string (Vim default "filnxtToOS", Vi default: "S",
6567+
POSIX default: "AS")
65686568
global
65696569
This option helps to avoid all the |hit-enter| prompts caused by file
65706570
messages, for example with CTRL-G, and to avoid some other messages.
@@ -6604,6 +6604,8 @@ A jump table for the options with a short description can be found at |Q_op|.
66046604
q use "recording" instead of "recording @a"
66056605
F don't give the file info when editing a file, like `:silent`
66066606
was used for the command
6607+
S do not show search count message when searching, e.g.
6608+
"[1/5]"
66076609

66086610
This gives you the opportunity to avoid that a change between buffers
66096611
requires you to hit <Enter>, but still gives as useful a message as

runtime/doc/pattern.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@ use <Esc> to abandon the search.
152152
All matches for the last used search pattern will be highlighted if you set
153153
the 'hlsearch' option. This can be suspended with the |:nohlsearch| command.
154154

155+
When 'shortmess' does not include the "S" flag, Vim will automatically show an
156+
index, on which the cursor is. This can look like this: >
157+
158+
[1/5] Cursor is on first of 5 matches.
159+
[1/>99] Cursor is on first of more than 99 matches.
160+
[>99/>99] Cursor is after 99 match of more than 99 matches.
161+
[?/??] Unknown how many matches exists, generating the
162+
statistics was aborted because of search timeout.
163+
164+
Note: the count does not take offset into account.
165+
155166
When no match is found you get the error: *E486* Pattern not found
156167
Note that for the |:global| command this behaves like a normal message, for Vi
157168
compatibility. For the |:s| command the "e" flag can be used to avoid the
@@ -299,6 +310,14 @@ when executing a pattern takes a long time and when checking for messages on
299310
channels a callback is invoked that also uses a pattern or an autocommand is
300311
triggered. In most cases this should be fine, but if a pattern is in use when
301312
it's used again it fails. Usually this means there is something wrong with
313+
the pattern.
314+
315+
*E956*
316+
In very rare cases a regular expression is used recursively. This can happen
317+
when executing a pattern takes a long time and when checking for messages on
318+
channels a callback is invoked that also uses a pattern or an autocommand is
319+
triggered. In most cases this should be fine, but if a pattern is in use when
320+
it's used again it fails. Usually this means there is something wrong with
302321
the pattern.
303322

304323
==============================================================================

src/option.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,7 +2449,7 @@ static struct vimoption options[] =
24492449
{(char_u *)8L, (char_u *)0L} SCTX_INIT},
24502450
{"shortmess", "shm", P_STRING|P_VIM|P_FLAGLIST,
24512451
(char_u *)&p_shm, PV_NONE,
2452-
{(char_u *)"", (char_u *)"filnxtToO"}
2452+
{(char_u *)"S", (char_u *)"filnxtToOS"}
24532453
SCTX_INIT},
24542454
{"shortname", "sn", P_BOOL|P_VI_DEF,
24552455
(char_u *)&p_sn, PV_SN,
@@ -3311,7 +3311,7 @@ set_init_1(int clean_arg)
33113311
if (mch_getenv((char_u *)"VIM_POSIX") != NULL)
33123312
{
33133313
set_string_default("cpo", (char_u *)CPO_ALL);
3314-
set_string_default("shm", (char_u *)"A");
3314+
set_string_default("shm", (char_u *)SHM_POSIX);
33153315
}
33163316

33173317
/*

src/option.h

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -183,27 +183,29 @@
183183
#define COCU_ALL "nvic" /* flags for 'concealcursor' */
184184

185185
/* characters for p_shm option: */
186-
#define SHM_RO 'r' /* readonly */
187-
#define SHM_MOD 'm' /* modified */
188-
#define SHM_FILE 'f' /* (file 1 of 2) */
189-
#define SHM_LAST 'i' /* last line incomplete */
190-
#define SHM_TEXT 'x' /* tx instead of textmode */
191-
#define SHM_LINES 'l' /* "L" instead of "lines" */
192-
#define SHM_NEW 'n' /* "[New]" instead of "[New file]" */
193-
#define SHM_WRI 'w' /* "[w]" instead of "written" */
194-
#define SHM_A "rmfixlnw" /* represented by 'a' flag */
195-
#define SHM_WRITE 'W' /* don't use "written" at all */
196-
#define SHM_TRUNC 't' /* truncate file messages */
197-
#define SHM_TRUNCALL 'T' /* truncate all messages */
198-
#define SHM_OVER 'o' /* overwrite file messages */
199-
#define SHM_OVERALL 'O' /* overwrite more messages */
200-
#define SHM_SEARCH 's' /* no search hit bottom messages */
201-
#define SHM_ATTENTION 'A' /* no ATTENTION messages */
202-
#define SHM_INTRO 'I' /* intro messages */
203-
#define SHM_COMPLETIONMENU 'c' /* completion menu messages */
204-
#define SHM_RECORDING 'q' /* short recording message */
205-
#define SHM_FILEINFO 'F' /* no file info messages */
206-
#define SHM_ALL "rmfixlnwaWtToOsAIcqF" /* all possible flags for 'shm' */
186+
#define SHM_RO 'r' // readonly
187+
#define SHM_MOD 'm' // modified
188+
#define SHM_FILE 'f' // (file 1 of 2)
189+
#define SHM_LAST 'i' // last line incomplete
190+
#define SHM_TEXT 'x' // tx instead of textmode
191+
#define SHM_LINES 'l' // "L" instead of "lines"
192+
#define SHM_NEW 'n' // "[New]" instead of "[New file]"
193+
#define SHM_WRI 'w' // "[w]" instead of "written"
194+
#define SHM_A "rmfixlnw" // represented by 'a' flag
195+
#define SHM_WRITE 'W' // don't use "written" at all
196+
#define SHM_TRUNC 't' // truncate file messages
197+
#define SHM_TRUNCALL 'T' // truncate all messages
198+
#define SHM_OVER 'o' // overwrite file messages
199+
#define SHM_OVERALL 'O' // overwrite more messages
200+
#define SHM_SEARCH 's' // no search hit bottom messages
201+
#define SHM_ATTENTION 'A' // no ATTENTION messages
202+
#define SHM_INTRO 'I' // intro messages
203+
#define SHM_COMPLETIONMENU 'c' // completion menu messages
204+
#define SHM_RECORDING 'q' // short recording message
205+
#define SHM_FILEINFO 'F' // no file info messages
206+
#define SHM_SEARCHCOUNT 'S' // search stats: '[1/10]'
207+
#define SHM_POSIX "AS" // POSIX value
208+
#define SHM_ALL "rmfixlnwaWtToOsAIcqFS" // all possible flags for 'shm'
207209

208210
/* characters for p_go: */
209211
#define GO_TERMINAL '!' /* use terminal for system commands */

0 commit comments

Comments
 (0)