Fork me on GitHub

A Great Vim Cheat Sheet

Note: If you’re decent at vim and want your mind blown, check out Advanced Vim.

I’ve compiled a list of essential vim commands that I use every day. I then give a few instructions on how to making vim as great as it should be, because it’s painful without configuration.

Cursor movement (Inside command/normal mode)

The four directions in VIM - hjkl

Insert/Appending/Editing Text

Marking text (visual mode)

Visual commands

Type any of these while some text is selected to apply the action

Cut and Paste

Exiting

Search/Replace

Working with multiple files

Marks

Marks allow you to jump to designated points in your code.

General

Making Vim actually useful

Vim is quite unpleasant out of the box. For example, typeing :w for every file save is awkward and copying and pasting to the system clipboard does not work. But a few changes will get you much closer to the editor of your dreams.

.vimrc

Plugins

        --- a/xactions.py
        +++ b/xactions.py
        @@ -1542,9 +1542,9 @@ class _vi_big_p(ViTextCommandBase):
                     fragments = state.registers['"']

        -        if state.mode == modes.VISUAL:
        +        #if state.mode == modes.VISUAL:
                     # Populate registers with the text we're about to paste.
        -            state.registers['"'] = prev_text
        +            # state.registers['"'] = prev_text

                 sels = list(self.view.sel())
                 if len(sels) == len(fragments):
        @@ -1640,14 +1640,14 @@ class _vi_p(ViTextCommandBase):
                     print("Vintageous: Nothing in register \".")
                     return

        -        if state.mode == modes.VISUAL:
        -            # force register population. We have to do it here
        -            # vi_cmd_data = {
        -            #     "synthetize_new_line_at_eof": True,
        -            #     "yanks_linewise": False,
        -            # }
        -            prev_text = state.registers.get_selected_text(self)
        -            state.registers['"'] = prev_text
        +      #  if state.mode == modes.VISUAL:
        +      #      # force register population. We have to do it here
        +      #      # vi_cmd_data = {
        +      #      #     "synthetize_new_line_at_eof": True,
        +      #      #     "yanks_linewise": False,
        +      #      # }
        +      #      prev_text = state.registers.get_selected_text(self)
        +      #      state.registers['"'] = prev_text

Switch Caps Lock and Escape

Other

I don’t personally use these yet, but I’ve heard other people do!