This is a draft cheat sheet. It is a work in progress and is not finished yet.
                    
        
                
        
            
                                
            
                
                                                
                                
    
    
            Vi Global
        
                        
                                                                                    
                                                                                            :o file # open file  | 
                                                                                 
                                                                                            
                                                                                            :saveas file  # save file as  | 
                                                                                 
                                                                                            
                                                                                            :close        # close current pane  | 
                                                                                 
                                                                         
                             
    
    
            Exit
        
                        
                                                                                    
                                                                                            :w              # write (save) the file, but don't exit  | 
                                                                                 
                                                                                            
                                                                                            :w !sudo tee %  # write out the current file using sudo  | 
                                                                                 
                                                                                            
                                                                                            :wq or :x or ZZ # write (save) and quit  | 
                                                                                 
                                                                                            
                                                                                            :q              # quit (fails if there are unsaved changes)  | 
                                                                                 
                                                                                            
                                                                                            :q!       # quit and throw away unsaved changes  | 
                                                                                 
                                                                         
                             
    
    
            Insert mode - inserting/appending text
        
                        
                                                                                    
                                                                                            i        # insert before the cursor  | 
                                                                                 
                                                                                            
                                                                                            I        # insert at the beginning of the line  | 
                                                                                 
                                                                                            
                                                                                            A        # insert (append) at the end of the line  | 
                                                                                 
                                                                                            
                                                                                            Esc      # exit insert mode  | 
                                                                                 
                                                                         
                             
                             | 
                                                                              | 
                                                        
                                
    
    
            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 y$       # yank (copy) to end of line  | 
                                                                                                                        x        # delete (cut) character  | 
                                                                                 
                                                                                            
                                                                                            p        # put (paste) the clipboard after cursor  | 
                                                                                                                        P        # put (paste) before cursor  | 
                                                                                 
                                                                                            
                                                                                            dd       # delete (cut) a line  | 
                                                                                                                        2dd       # delete (cut) 2 lines  | 
                                                                                 
                                                                                            
                                                                                            D        # delete (cut) to the end of the line  | 
                                                                                                                        d0       # delete (cut) to the begining of the line  | 
                                                                                 
                                                                         
                             
                             | 
                                                                              | 
                                                        
                                
    
    
            Editing
        
                        
                                                                                    
                                                                                            xp       # transpose two letters (delete and paste)  | 
                                                                                 
                                                                                            
                                                                                            u        # undo  | 
                                                                                 
                                                                                            
                                                                                            Ctrl + r # redo  | 
                                                                                 
                                                                         
                             
    
    
            Visual commands
        
                        
                                                                                    
                                                                                            >       # shift text right  | 
                                                                                 
                                                                                            
                                                                                            <       # shift text left  | 
                                                                                 
                                                                                            
                                                                                            y       # yank (copy) marked text  | 
                                                                                 
                                                                                            
                                                                                            d       # delete marked text  | 
                                                                                 
                                                                                            
                                                                                            ~       # switch case  | 
                                                                                 
                                                                         
                             
    
    
            Search
        
                        
                                                                                    
                                                                                            /pattern       # search for pattern  | 
                                                                                 
                                                                                            
                                                                                            :vimgrep /pattern/ {file} # search for pattern in multiple files  | 
                                                                                 
                                                                                            
                                                                                            :cn                       # jump to the next match  | 
                                                                                 
                                                                                            
                                                                                            :cp                       # jump to the previous match  | 
                                                                                 
                                                                         
                             
    
    
            Marking text (visual mode)
        
                        
                                                                                    
                                                                                            v        # start visual mode, mark lines, then do a command (like y-yank)  | 
                                                                                 
                                                                                            
                                                                                            V        # start linewise visual mode  | 
                                                                                 
                                                                                            
                                                                                            o        # move to other end of marked area  | 
                                                                                 
                                                                         
                             
                             | 
                                                                              | 
                                                        
                                
    
    
            Cursor movement
        
                        
                                                                                    
                                                                                            h        # move cursor left  | 
                                                                                 
                                                                                            
                                                                                            j        # move cursor down  | 
                                                                                 
                                                                                            
                                                                                            k        # move cursor up  | 
                                                                                 
                                                                                            
                                                                                            l        # move cursor right  | 
                                                                                 
                                                                                            
                                                                                            H        # move to top of screen  | 
                                                                                 
                                                                                            
                                                                                            L        # move to bottom of screen  | 
                                                                                 
                                                                                            
                                                                                            w        # jump forwards to the start of a word  | 
                                                                                 
                                                                                            
                                                                                            e        # jump forwards to the end of a word  | 
                                                                                 
                                                                                            
                                                                                            0        # jump to the start of the line  | 
                                                                                 
                                                                                            
                                                                                            $        # jump to the end of the line  | 
                                                                                 
                                                                                            
                                                                                            gg       # go to the first line of the document  | 
                                                                                 
                                                                                            
                                                                                            G        # go to the last line of the document  | 
                                                                                 
                                                                                            
                                                                                            5G       # go to line 5  | 
                                                                                 
                                                                                            
                                                                                            Ctrl + b # move back one full screen  | 
                                                                                 
                                                                                            
                                                                                            Ctrl + f # move forward one full screen  | 
                                                                                 
                                                                                            
                                                                                            Ctrl + d # move forward 1/2 a screen  | 
                                                                                 
                                                                                            
                                                                                            Ctrl + u # move back 1/2 a screen  | 
                                                                                 
                                                                         
                             
                             |