vim tricks

Here are some tricks in everyone’s favorite editor, vim.

In command mode

To indent a file:

=G

To indent between matching brackets (go over the bracket)

=%

To copy to the X clipboard or Windows clipboard using the keyboard (as opposed to the vim clipboard)
I normally highlight the text using ‘v’ to go into visual mode and then
“+y

To copy to the X clipboard, I’ve found it can be easier than the crossed out jazz to set your terminal short cuts . I tend to use CTRL+SHIFT+C for copy, CTRL+SHIFT+V for paste. This also has the advantage of working regardless of editor.
These can be handy!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: