Vim Cheat Sheet

Movement h — Move cursor left j — Move cursor down k — Move cursor up l — Move cursor right H — Move to top of screen M — Move to middle of screen L — Move to bottom of screen w — Jump forwards to the start of a word W — Jump forwards to the start of a word (words can contain punctuation) e — Jump forwards to the end of a word E — Jump forwards to the end of a word (words can contain punctuation) b — Jump backwards to the start of a word B — Jump backwards to the start of a word (words can contain punctuation) ge — Jump backwards to the end of a word gE — Jump backwards to the end of a word (words can contain punctuation) % — Move cursor to matching character ((), {}, []) 0 — Jump to the start of the line ^ — Jump to the first non-blank character of the line $ — Jump to the end of the line g_ — Jump to the last non-blank character of the line gg — Go to the first line of the document G — Go to the last line of the document gd — Move to local declaration gD — Move to global declaration fx — Jump to next occurrence of character x tx — Jump to before next occurrence of character x Fx — Jump to the previous occurrence of character x Tx — Jump to after previous occurrence of character x zz — Center cursor on screen Ctrl+d — Move cursor and screen down 1/2 page Ctrl+u — Move cursor and screen up 1/2 page Insert Mode i — Insert before the cursor I — Insert at the beginning of the line a — Insert (append) after the cursor A — Insert (append) at the end of the line o — Open a new line below the current line O — Open a new line above the current line ea — Insert (append) at the end of the word Ctrl+t — Indent (move right) line one shiftwidth Ctrl+d — De-indent (move left) line one shiftwidth Ctrl+n — Auto-complete next match Ctrl+p — Auto-complete previous match Edit r — Replace a single character R — Replace more than one character, until ESC is pressed J — Join line below to the current one with one space in between gJ — Join line below to the current one without space in between gwip — Reflow paragraph g~ — Switch case up to motion gu — Change to lowercase up to motion gU — Change to uppercase up to motion cc — Change (replace) entire line c$ or C — Change (replace) to the end of the line ciw — Change (replace) entire word cw or ce — Change (replace) to the end of the word s — Delete character and substitute text (same as cl) S — Delete line and substitute text (same as cc) xp — Transpose two letters (delete and paste) u — Undo U — Restore (undo) last changed line Ctrl+r — Redo . — Repeat last command Indent >> — Indent (move right) line one shiftwidth << — De-indent (move left) line one shiftwidth >% — Indent a block with () or {} (cursor on brace) <% — De-indent a block with () or {} (cursor on brace) >ib — Indent inner block with () >at — Indent a block with <> tags 3== — Re-indent 3 lines =% — Re-indent a block with () or {} (cursor on brace) =iB — Re-indent inner block with {} gg=G — Re-indent entire buffer ]p — Paste and adjust indent to current line Visual Mode v — Start visual mode, mark lines, then do a command (like yank) V — Start linewise visual mode o — Move to other end of marked area Ctrl+v — Start visual block mode O — Move to other corner of block aw — Mark a word ab — A block with () aB — A block with {} at — A block with <> tags ib — Inner block with () iB — Inner block with {} it — Inner block with <> tags Visual Commands > — Shift text right < — Shift text left y — Yank (copy) marked text d — Delete marked text ~ — Switch case u — Change marked text to lowercase U — Change marked text to uppercase Cut and Paste yy — Yank (copy) a line 2yy — Yank (copy) 2 lines yw — Yank (copy) the characters of the word from the cursor position to the start of the next word yiw — Yank (copy) word under the cursor yaw — Yank (copy) word under the cursor and the space after or before it y$ or Y — Yank (copy) to end of line p — Paste after cursor P — Paste before cursor gp — Paste after cursor and leave cursor after the new text gP — Paste before cursor and leave cursor after the new text dd — Delete (cut) a line 2dd — Delete (cut) 2 lines dw — Delete (cut) the characters of the word from the cursor position to the start of the next word diw — Delete (cut) word under the cursor daw — Delete (cut) word under the cursor and the space after or before it :3,5d — Delete lines starting from 3 to 5 :g/{pattern}/d — Delete all lines containing pattern :g!/{pattern}/d — Delete all lines not containing pattern d$ or D — Delete (cut) to the end of the line x — Delete (cut) character Registers :reg[isters] — Show registers content "xy — Yank into register x "xp — Paste contents of register x "+y — Yank into the system clipboard register "+p — Paste from the system clipboard register Special registers: ...

2014-04-07 · 7 min · Ivan Franjic

Writing faster WebDriver tests

Some day ago I met with a friend and had nice chat about testing. Eventually we came to a topic about Selenium. He’s been using Selenium mostly for simple test cases, but now he was thinking of using it to test some reporting functionality. His concern was if Selenium is actually the right tool to help him with that. At that point I said that Selenium is the best free tool for functional testing of web apps that we have now, but it’s another thing how good it actually is. It all depends how you use it and for what. ...

2013-01-25 · 3 min · Ivan Franjic

Team Foundation Server Express

Of all the new developer tools and products that Microsoft launched this fall, Team Foundation Server Express got most of my attention. The fact that it’s free and that it comes with reasonable limitations compared to full version, shows that Microsoft is really dedicated to making it’s platform stronger. This blog post won’t cover all the features that are included or not, I’ll just focus on those that are most interesting. ...

2012-12-25 · 2 min · Ivan Franjic

Disabling Google Ads

Some time ago I was doing some Selenium Webdriver tests for a website with Google Ads. For QA environment the ads were disabled through some website configuration, but for Staging environment everything was set up as on Live, and so the ads were enabled. However, this caused some problems when running Webdriver tests. What happened is that on some pages the Webdriver would timeout because the requests made by Google Ads scripts were taking too long. ...

2012-12-15 · 2 min · Ivan Franjic

Switching to English

It’s been more than a year and a half since I started this blog and as every blog author, I haven’t written as much as I wanted, but this has been a great year so far, with a lot of great things happening at work and in my personal life and I’m not a bit sorry for not having more time to blog. So this blog post won’t be about me promising that I’ll blog more (or less :) it’s an announcement that all future posts will be in English. This is a decision which I’ve made after some thinking and a lot of encouragement from friends and colleagues. ...

2012-12-12 · 1 min · Ivan Franjic