Vi Cheatsheet

a -> Append cursor (After position)
i -> Insert cursor (At position)
esc -> Remove cursor if active
:wq -> Save and quit
:q -> Ask to save and quit
:q! -> Quit without saving
dd -> Cut the line
yy -> Copy the line
p -> Paste the line
:n -> Go to line n
/text -> Search for ‘text’
n -> Jump to next match when search is active
0 -> Go to the beginning of the line
$ -> Go to the end of the line
G -> Go to the end of the document
yn + arrow down -> Copy the current line with next n lines
yn + arrow up -> Copy the current line with previous n lines

Gamification: http://vim-adventures.com (Even though it’s for vi not vim there shouldn’t be any major differences as mentioned here.)

Use Sublime Text to Bulk Rename Your Files

There are two cool plugins: One is dired, which allows you to use Sublime Text to manage your files and folders; and another is Text Pastry, which helps you to put increasing numbers to the multi-selected cursors (Of course, it is more than that, just not in this case).

Go ahead and combine this two. Yes, giving numbered names to contents of a folder. There were (in fact, probably still are) utilities existed that people buy for. Why pay, when you can do it with plugins?

First, install dired and Text Pastry plugins from Sublime Text Package Control. No need to restart, just get into it directly by pressing Cmd+Shift+P -> dired: Goto Anywhere -> Goto Directory and then hit enter. It doesn’t matter what directory you are getting into since you can now navigate between folders thanks to dired.

Now, you can see the contents of the directory you are currently inside of, and you can see the shortcuts for navigation. Goto a directory that you want to bulk rename contents of and then press R. Now you can rename the files by using great abilities of Sublime Text such as locating matches, inserting multiple cursors and all.

bulk-rename-files-using-sublime-text-dired-and-text-pastry

Assume that you have a set of images that were taken during one of your trips and you want to rename them like -> trip_1.jpg, trip_2.jpg and so. You opened the folder in Sublime, selected all the images (lines), set all of the names to trip_.jpg and placed your multi cursors after _ (before .). Now what? Just hit Cmd+Shift+P again and then select Text Pastry: From 1 To X. That’s it. Now all of your files have numbers increased by 1 at the end of their names. Hit Ctrl+Enter to save changes and you’re good to go.

Important Note: Dired is no longer maintained so it will not appear on the package control. The developer was kind enough to share the latest working copy so I’ve uploaded it to Github. Install instructions can be found inside README.md. To download: https://github.com/kublaios/dired