# Some Vim Tips and Learning Resources

> 

Published: 2012-04-02
URL: https://kaochenlong.com/some-vim-tips-and-learning-resources

---

I&#39;m still pretty new to Vim and keep practicing Vim everyday, and also started to learn some VimScript by myself, I found some nice learning resources and some easy but AWESOME key combinations.

&lt;!-- more --&gt;

## Learning Resources

### Screencasts

- [VimCasts](http://vimcasts.org/)
- [Derek Wyatt&#39;s Blog](http://www.derekwyatt.org/category/vim/)
- [Vim Essential Plugins](http://net.tutsplus.com/sessions/vim-essential-plugins/)

### Books and Articles

- [A Byte of Vim](http://www.swaroopch.org/notes/Vim), it has kinds of translations, including the [traditional chinese](http://www.swaroopch.org/notes/Vim_zh-tw) version(not finish yet).
- [Learn the Vi and Vim editors](http://www.amazon.com/Learning-Vim-Editors-Arnold-Robbins/dp/059652983X/), published by Oreilly.
- Vi iMproved, you can buy a copy from [Amazon](http://www.amazon.com/exec/obidos/ASIN/0735710015/stichtingiccfhol), or download it for free, it&#39;s available as a [PDF](http://www.truth.sk/vim/vimbook-OPL.pdf)!
- [Learn Vimscript the Hard Way](http://learnvimscriptthehardway.stevelosh.com/)
- IBM DeveloperWorks VimScript Serial part [1](http://www.ibm.com/developerworks/linux/library/l-vim-script-1/index.html), [2](http://www.ibm.com/developerworks/linux/library/l-vim-script-2/index.html), [3](http://www.ibm.com/developerworks/linux/library/l-vim-script-3/index.html), [4](http://www.ibm.com/developerworks/linux/library/l-vim-script-4/index.html), [5](http://www.ibm.com/developerworks/linux/library/l-vim-script-5/index.html)

### Others

- `vimtutor` is a great resource, you can type `vimtutor` in terminal directly to launch it. there&#39;s also some translated version, ex: `vimtutor zh` would be the tranditional chinese version.
- last but not the least, the best resource is the built-in HELP manual, just type `:h something`, and you SHOULD read them through at least one time.

## Tips

- &lt;kbd&gt;d&lt;/kbd&gt; &lt;kbd&gt;w&lt;/kbd&gt; : delete a word from current cursor position.
- &lt;kbd&gt;d&lt;/kbd&gt; &lt;kbd&gt;i&lt;/kbd&gt; &lt;kbd&gt;w&lt;/kbd&gt; : delete the whold word which the cursor is parking.
- &lt;kbd&gt;d&lt;/kbd&gt; &lt;kbd&gt;f&lt;/kbd&gt; &lt;kbd&gt;Space&lt;/kbd&gt; : delete everything until finding the next &lt;kbd&gt;Space&lt;/kbd&gt; of the current line.
- &lt;kbd&gt;d&lt;/kbd&gt; &lt;kbd&gt;i&lt;/kbd&gt; &lt;kbd&gt;(&lt;/kbd&gt; : as above, but delete all words within the nearest parenthesis, &lt;kbd&gt;d&lt;/kbd&gt; &lt;kbd&gt;i&lt;/kbd&gt; &lt;kbd&gt;[&lt;/kbd&gt;, &lt;kbd&gt;d&lt;/kbd&gt; &lt;kbd&gt;i&lt;/kbd&gt; &lt;kbd&gt;&quot;&lt;/kbd&gt;, and &lt;kbd&gt;d&lt;/kbd&gt; &lt;kbd&gt;i&lt;/kbd&gt; &lt;kbd&gt;&#39;&lt;/kbd&gt; also do pretty much the same thing.
- &lt;kbd&gt;g&lt;/kbd&gt; &lt;kbd&gt;v&lt;/kbd&gt; : re-select last visual select.
- &lt;kbd&gt;m&lt;/kbd&gt; &lt;kbd&gt;a&lt;/kbd&gt; to create a marker named `a` at the current cursor, then by hitting &lt;kbd&gt;&#39;&lt;/kbd&gt; &lt;kbd&gt;a&lt;/kbd&gt; to jump to the `a` marker. You can use `a` to `z` as the name of the marker.
- `:.![command]` will dump the output of the command to your current editing window.
- `%!xxd` turn vim to a hex editor, and `%!xxd -r` will change it back.
- even you don&#39;t manage your file within any version control system, `:earlier 10m` can help you to change the current file back to 10 minites ago, and `:later 10m` will jump back to 10 minites later.
- `:undo 5` will go back by 5 changes, and `:undolist` will show you undo tree.
- you can grab web page source code into your editor directly, just like this `vim https://kaochenlong.com`

## Some crazy/stupid things

I use Vim almost everyday now, but to be more sophisticated in it, I did some stupid or crazy things.

First, I removed my ESC key from my keyboard temporarily to force myself using &lt;kbd&gt;Ctrl&lt;/kbd&gt; &lt;kbd&gt;[&lt;/kbd&gt;, instead of hitting &lt;kbd&gt;Esc&lt;/kbd&gt; to enter normal mode:

![](/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBb2dCIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--fb47370fbb1ca700dde887fb812002552ee9cba7/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFJQUJXa0NBQVE9IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--c7384179b79b360ce488e92f67a9c0795f833455/my_keyboard_with_esc.jpg)

Why? actually there&#39;s no good reason, just thought it might keep my fingers on main typing area in mode switching.

and second, I re-map the arrow keys to `&lt;NOP&gt;` to disable them, both in normal mode and insert mode:

    map &lt;UP&gt; &lt;NOP&gt;
    map &lt;DOWN&gt; &lt;NOP&gt;
    map &lt;LEFT&gt; &lt;NOP&gt;
    map &lt;RIGHT&gt; &lt;NOP&gt;
    inoremap &lt;UP&gt; &lt;NOP&gt;
    inoremap &lt;DOWN&gt; &lt;NOP&gt;
    inoremap &lt;LEFT&gt; &lt;NOP&gt;
    inoremap &lt;RIGHt&gt; &lt;NOP&gt;

You may think I&#39;m crazy, but I think it&#39;s a faster way to push those things into my muscle memory. I think there&#39;s no shortcut to master Vim, just keep using it everyday.

At last, [here](https://github.com/kaochenlong/eddie-vim) is my yet another vimrc configuration. If you have any other tips which are also AWESOME, please let me know :)

