Stop editing at 10% of Vim's power. Master registers, :norm, fuzzy completion, linematch diff, and 16 more Vim tips and tricks. Tested on latest Vim 9.2.

Full guide here: https://ostechnix.com/vim-tricks/

#Vim #Vimtips #Vimtricks #Editor #Opensource #Linux

20 Vim Tricks That Will Change How You Edit - OSTechNix

Stop editing at 10% of Vim's power. Master registers, :norm, fuzzy completion, linematch diff, and 16 more Vim tricks. Tested on Vim 9.2.

OSTechNix

One of my favorite vim tricks for substitution for deleting the text within two brackets of any type and start typing:

Lets say you have this line:
`console.log("my text", [1, 2, 3])`
When your cursor is within that line,
ci" -> replace the text within double quotes
ci( -> replace the whole text between parenthesis
ci[ -> replace content of the array

#vimtober #vim #vimtricks

Just completed the #vim tutorial

$ vimtutorial

Didn’t even know it existed until I stumbled across it in the help documents.

Some cool things I learned:

1. :set hls ic is

makes it so that when you search partial highlights are made as you type, case is ignored and results are all highlighted. super useful. Added to my .vimrc

2. ce

Cut to end of word Simple little command that I think I knew existed but never really absorbed until I actually read about it and practiced it.

I had been using dwi to accomplish the same thing: delete a word and insert.

3. CTRL_G

find your location in a file.

4. :<partial command> CTRL_D

show command options. Super helpful for when you are hunting for a special help doc.

5. :'<,'>w and :r

selective write out and retrieve commands. YOU CAN SAVE A SELECTED PART OF A FILE AS A NEW FILE. Then, when you so desire, you can retrieve the contents of any file with the retrieve command and paste them under your cursor.  

6. <num>G

same as :<line number>. Jumps to a line in vim.

7. :!<shell command>

Executes a shell command. I knew about this one. Still have yet to really try it. Might come in handy more often when writing Python  and I want to execute a file after editing it without opening a new terminal.

Altogether, I think it was time well spent.

What are your favorite #vimtricks ?

Copy to system clipboard from #vim guide:

1. In your ~/.vimrc set
set clipboard=unnamed

2. Open a file and yank whatever you want, in this example we yank lines 4 and 5 to system clipboard; in command mode, type 4,5y *
set ts=2
set sts=2
set sw=2
filetype off
filetype plugin indent on
syntax on
set expandtab

3. Profit
Paste anywhere you want
filetype off
filetype plugin indent on

#vimTricks #vimTips

I am training up my left hand escape key pinky finger. #vimtricks

And when you need the full completion madness in the command line, for example when you're editing complex Regular Expression statements, simply type `q:` from normal mode and you get the full Vim editing power in an editable command history window.
Simply type your command line statement (or select an older one) and press <CR> to execute the command line under the cursor. See :help q:

#Vim #Vi #Editor #Programming #VimTips #VimTricks

#Vim hint of the week (because I'm searching this regulary again):
You can insert the word under the cursor while in command mode with:
<CTRL-R><CTRL-W>
This comes in handy when you want to [s]ubstitute a word, without having it to retype again.

:%s/<CTRL-R><CTRL-W>/newWord/g

#Vim #Vi #Editor #Programming #VimTips #VimTricks

How To Comment Out Multiple Lines At Once In Vim Editor #vim #linux #VimTricks #CLI
https://www.ostechnix.com/comment-multiple-lines-vim-editor/
How To Comment Out Multiple Lines At Once In Vim Editor - OSTechNix

This brief guide explains five different ways to comment out multiple lines at once in Vim editor in Linux operating systems.

OSTechNix
@[email protected] i'll try to contribute to the #vimtrick hashtag as soon as i learn new things.
of course, it would be great if everybody tagged their most useful #vimtricks here!