j
or k
keys is ineffective. In Vim, there are many ways to move vertically . I think that the two most useful ones are a jump on paragraphs and on screens. It depends on how far and how exactly you need to move.{
- Go to the beginning of the previous paragraph or block of code.}
- Jump to the end of the next paragraph or block of code.Ctrl+F
- Go forward one screen.Ctrl+B
- Go back one screen./
key, and backward search ?
.gi
: return to the last place where you entered the text. If you want, you can even move between all the places where the text was entered using g;
and g,
h
and l
keys is often a waste of time when we have t
and f
:t<char>
- Move forward until the next character appears.f<char>
- Move forward for the next occurrence of a character.T<char>
- Move back to the previous occurrence of the character.F<char>
- Move back past the previous occurrence of a character.w
, W
, b
, B
, e
and e
keys is also better. And here navigation with search is useful, and do not forget that you can copy, delete and change the text forward or back to the search result:y/search<Enter>
y?search<Enter>
d/search<Enter>
d?search<Enter>
c/search<Enter>
c?search<Enter>
*
or #
. It is amazing how much faster the work becomes when you master these hotkeys.d2wi
c
:c2w
.
).hjkl
to navigate, the arrows already seem clumsy because the fingers are in the center of the keyboard throughout the Vim session, which is convenient for blind printing. Similarly, the Home and End keys: although they work like most editors, there is no particular reason to use them when the ^
and $
equivalents are closer.noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
Ctrl+[
much closer and more convenient, you will quickly change your habits. As an option, you can consider comparing the rather useless Caps Lock key on the Esc operating system or even unusual combinations, such as jj
. Although this is a slightly radical proposition, it works well for many people:inoremap jj <Esc>
I
and A
In addition, they make the action repeatable for other lines where the same operation may be necessary.o
and O
to create a new line below and above, respectively, and simultaneously enter insert mode on it.d
with the appropriate motion or text object. Again, this action is repeatable and means that you are not holding Backspace. In general, if you hold a key in Vim, there is probably a faster way.@:
for a command or n / N for a search; Vim does not forget the last search. If it was not the latest command or search, but it is definitely in the history, type q:
or q/
, find it in the list and press Enter.&
to repeat on the current line of the last replacement. You can repeat it on all lines by typing g&
.@@
.Source: https://habr.com/ru/post/442110/
All Articles