Skip to content

emka.web.id

Menu
  • Home
  • Indeks Artikel
  • Tutorial
  • Tentang Kami
Menu

New Vim Tips

Posted on December 13, 2012 by Syauqi Wiryahasana
Here are some more Vim tips I collected recently:
  1. One can repeat the last t, f, T or F command which moves to the next specified character in a line, or right before that, using ;, and repeat in the opposite direction using ,. I discovered those after starting to read through the vim usr_* manuals.
  2. One can get the Unicode value of the character under the cursor using the :ascii command-line command or the ga normal mode command.
  3. If you want to find how many lines/words/etc. are in a visual block, you can select it using "v" and friends and then type g-Ctrl+G.
  4. Finally, you can pipe the contents of the buffer or a range to an external program and view its output temporarily. So you can say :w !grep 'FOO' | wc -l to find the number of lines containing 'FOO', or :'a,'bw !grep 'FOO' | wc -l within a range.
I should note that one thing that annoyed me lately, is the fact that after I have a visual selection (v or V), I sometimes press u instead ofy (because they are so nearby) and so cause the selection to become lowercase instead of yanking it. Happy Vimming!
Seedbacklink

Recent Posts

TENTANG EMKA.WEB>ID

EMKA.WEB.ID adalah blog seputar teknologi informasi, edukasi dan ke-NU-an yang hadir sejak tahun 2011. Kontak: kontak@emka.web.id.

©2024 emka.web.id Proudly powered by wpStatically