New answers tagged substitute
1
vote
Add newline after every paragraph in log file in vi editor
I would do:
:%s/\d\{4}-\d\{2}-\d\{2} \d\{2}:\d\{2}:\d\{2}/\r&/
Or:
:%s/\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d/\r&/
It inserts a new line after every date in the format you specified.
1
vote
Accepted
Search and replace text in visual range but not entire line
You could do:
:'<,'>s/\%V /-/
Where \%V match only if the next character is within the visual range.
For more information see :help /\%V
Top 50 recent answers are included
Related Tags
substitute × 340regular-expression × 97
replace × 31
search × 25
vimscript × 17
visual-mode × 16
neovim × 14
global-command × 14
ex-mode × 11
key-bindings × 9
macro × 9
command-line × 8
register × 7
vimrc × 6
cut-copy-paste × 6
multiple-lines × 6
find × 6
cursor-movement × 5
formatting × 5
repeated-commands × 5
search-replace × 5
indentation × 4
normal-mode × 4
functions × 4
whitespace × 4