Transforming and Substituting Text Complete

This commit is contained in:
2025-08-22 19:25:59 +03:00
parent 57042bd21c
commit 3f067bd029
2 changed files with 55 additions and 0 deletions

BIN
.searching.txt.swo Normal file

Binary file not shown.

View File

@@ -490,6 +490,8 @@ Line mode:
and even all the lines in the file, etc. and even all the lines in the file, etc.
* <line-number> : On which line number this command to be executed. * <line-number> : On which line number this command to be executed.
To execute the command on same line as cursor,
don't mention <line-number>.
* <start-line-number>,<end-line-number> : From the starting line number * <start-line-number>,<end-line-number> : From the starting line number
to the ending line number to to the ending line number to
@@ -503,3 +505,56 @@ Line mode:
:1,5s/<old>/<new>/g :1,5s/<old>/<new>/g
It will do the same form line number 1 to 5. It will do the same form line number 1 to 5.
:/<Pattern-1>/,/<Pattern-2>/s/<old>/<new>/g
It will do the same from line which has pattern matching with
with <Pattern-1> and ending with line which has pattern
matching with pattern <Pattern-2>.
------------------------------------
$ = last line; . = current line
:.,$s/<old>/<new>/g
% = All the line (entire file)
:%s/<old>/<new>/g
-----------------------------------
For including character such as "/" for <old> and <new>
we can use "\" which is a escape character.
For ex:
:s/\/<old>\//\/<new>\//
OR
we can use other non-alphanumeric character as a separator.
For ex:
:s#/<old>/#/<new>/
%% TIPS %%
To set options in VIM, we can use :set <option> command.
* To set a option to show the line number of the current opened file in the vim
we use:
:set nu
* To undo this:
:set nonu
* To toggle the current configuration.
:set nu!