I want to search date format like 2019-07-12 11:22:33
.
but, in vi mode, :/2019-07-12 11:22:33
is not executed by white space.
how can I search 2019-07-12 11:22:33
?
(other format is not pretty)
I want to search date format like 2019-07-12 11:22:33
.
but, in vi mode, :/2019-07-12 11:22:33
is not executed by white space.
how can I search 2019-07-12 11:22:33
?
(other format is not pretty)
If :/2019-07-12 11:22:33
fails to match the whitespace, it is likely an indication that the whitespace in the date you're trying to match isn't a plain space but rather a tab or something. Try
:/2019-07-12\s11:22:33
to match any single whitespace character or
:/2019-07-12\s*11:22:33
to match any amount of whitespace (including zero).
(And as an aside, not that you don't need to drop to the colon prompt to search, you could search directly from command mode by just starting your search with a slash. -- From the colon, the search will place your cursor at the start of the line where the match was found, from command mode, the search will place your cursor at the start of the match.)
"\ " will work.
Use backslash followed by white space.
e.g. looking for "cat del",
vi
implementations I know of, simply /cat del
+ Enter works for finding all cat del
occurrences in the file. No need of backslash + space.
:/cat del
(starting with a colon, /
in command mode) works to move to the start of the next line where the cat del
pattern occurs. I guess that may be OP's problem -- the cursor is put to the start of the line, not the start of the match. So your change to the Q which corrected the :/
into /
wasn't appropriate; I will revert it.