Learn VIM and don’t die in the attempt IV char jump
All files are store in this repo
Jump for characters
Also we need to move into our file
cd medium-articles-vim/examples/dont_die_attempt_iv
Also opened the file using vim 4_file.txt
Before continue we can see the numbers
:set nu <Enter>
With these the terminal now show us the number for every line, made more easy the comprehension information about the current line
Now the interface update with number in one part of our file, this numbers are the indexes for every line in the file.
No jump so fast for how to we can jump easily in our lines, lets go!!
Go to end and beginning
Now we can move more fast in the current line, using the $
and 0
with these results
Move to the line 4 first, for move into this line we can use
:4<Enter>
Now you see the current line contain a lot of words using a Lorem Impsum
that’s a words collide that you can use to fill a huge text field
Press the $
key, this key send the cursor in the last part of the line content
Also another part when we can check the current position is near to the corner of right bottom with a “coordinates” for current cursor position
Now we move to the beginning for the line using the 0
key
So we continue with this sections related to how to we can move fast in vim
Find the occurrences
Now we discovered how to move between beginning to the end of the line, but how to we can move more specifically in the line, so in this part we discover how to move using a character.
In the same line :4 <Enter>
we find the first t
in the current line
ft
Now, we identify that we need to move to the 4th occurrence for t
from the current position
4ft
But I forget that I stay one t
ahead, so we need backwards one time
Ftm
We are used normally a number for the commands, but you think works for reverse?
Jump in brackets
One of a bigger part for our path is how to we can move into the brackets, if you try to use the f
command doesn’t work, so we need to explore another way for that, for this part we explore the command <Shift>+5
for jump directly into the brackets. When we talk about brackets we covered this {[(
and this )]}
We need to move to the line 8 :8 <Enter>
we find the first bracket
in the current line
<Shift>+5
If you repeat the option you start a loop between in open and closes brackets
Exit
For finish this little session for jump moves and jump between brackets, you can use a :q!
for q
quit, but what’s doing the !
admiration symbol, just in case that you modify the file this symbol save your life for involuntary modifications.
Exercise
Use the jump section for move into the next 2T
and do the loop in to the {}
brackets also in the []
too.
Download from this repo the files and execute this task:
>> Next section