14.06.2014 Views

vim 101 hacks

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Buyer: xiujuan lu (luxiujuan@gmail.com)<br />

Transaction ID: 85W16630AD8515549<br />

Vim <strong>101</strong> Hacks<br />

www.thegeekstuff.com<br />

Hack 60. Execute any Vim Command when opening a<br />

file<br />

By using the option –c you can execute any Vim command when opening a<br />

file.<br />

In the following example, after Vim opens the file, it will jump to line 50.<br />

$ <strong>vim</strong> -c ':50' filename.txt<br />

You can also execute multiple Vim commands from the command line:<br />

$ <strong>vim</strong> -c '' -c '' <br />

Hack 61. Execute Commands Stored in a File<br />

When you find yourself executing the same sequence of Vim commands<br />

frequently, you can store them in a file and execute them as shown below.<br />

$ <strong>vim</strong> –w repetitive_task.txt file_to_edit.txt<br />

97

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!