Some default Vim Commands, after reading a book on how to use Vim 😁
Navigation:
k
for upj
for downh
for leftl
for rightx
→ Deletes the Character under the Cursor.
→ Repeats the Previous commando
👉 will create a line below the cursor and go to INSERT
mode.O
will create a line above the cursor and go to INSERT
modeu
→ undos x
~
will change the case of the letter under the Cursordd
→ Deletes current line>G
→ ↑s indendations till EOF<G
→ ↓s the indendation of the filedaw
will delete an entire wordd<n>w
will delete n words in the line
d2w
will delete 2 wordsd7w
will delete 7 wordsy
to copy the items under the cursor.d
to cut the items under the cursorp
to paste items after the cursor and P
to paste items before the cursorVim search is friendly 😁
To search we can use /{regex pattern}
. Use n to move to the next match and N to move back
We can use the /{search}
method to find the word and use the motion cgn
to change the word and enter the new word. Then go back to NORMAL
mode and pressing n to go to next character and use .
to repeat the motion. Downside is that this is manual and tedious.
To search and replace on a single line we can use the :s
command
:s/{search_pattern}/{replace_pattern}/{options}
To replace all the occureneces in the file we can use :%s
instead of :s
Learn more about [[Terminal in NeoVim]]
Thanks to my friend Andrew Bastin for Suggesting me Floaterm, I use Floaterm Now.
A Floating terminal inside NeoVim. How cool is That??? As mentioned in "[[Terminal in NeoVim]]" the NORMAL
mode Keybinding is a tad hard, so as a noob vim user, I added the binding to ESC
key. It's easier for me that way. I also remapped a few things to get terminal a bit easier from the NORMAL
mode.
nmap fn :FloatermNew zsh<CR> nmap ft :FloatermToggle<CR> nmap fp :FloatermNext<CR> nmap fk :FloatermKill<CR> nmap fo :FloatermPrev<CR>
For remapping the command from the terminal I used this 👇
tnoremap <ESC> <C-\><C-n>
Check out [[Tabs and Panes in Vim]]