Python Classroom
  • Introduction
  • About Python Classroom
  • Python Cloud Options
    • CS50 IDE
      • CS50 IDE Overview
      • CS50 IDE and Python
      • CS50 IDE Debugging
      • CS50 IDE Shortcuts
      • Linux Bash Shell
      • Vim Mode
        • Vim Tutorial
    • CS50 Sandbox
    • PythonAnywhere
    • Repl.it
  • Python Curriculum Map
    • Pedagogy
      • Python Professional Development
      • Teaching Tips
      • Assessment Tips
      • Rubrics
      • Activities
        • Picture Activity
        • Map Activity
        • Crossing the Bridge
        • NIM
        • Mastermind
        • Cards
          • Card Deck Algorithms
          • Sorting Cards
        • River Crossing
          • Jealous Boyfriends
          • Cannibals and Priests
          • Family
          • Police and the Thief
          • Humans and Monkeys
          • Moving Money
        • Crossing the River
        • Traveling Salesperson
        • Logic Problems
        • CIA Crack the Code
        • IQ Test
        • Puzzles
    • AP Computer Science Principles Framework
  • Python Philosphy
    • How to Practice Python
  • microbit
  • Turtle Graphics
    • Turtle Examples
    • Turtle Activities
    • Turtle Maze Problems
    • Turtle Graphics with loops
    • Turtle Snake
    • Turtle Graphics with Conditionals
  • Output
    • Output Examples
    • Output Mistakes
  • Variables
    • Variable Data Type Examples
    • Variable Role Examples
    • Variables Mistakes
    • Variables Problems
  • Math
    • Math Examples
    • Math Mistakes
    • Math Problems
    • Math Self Check
  • Input
    • Input Examples
    • Input Mistakes
    • Input Problems
  • Decisions
    • if
      • if Examples
      • if Mistakes
      • if Problems
    • if else
      • if else Examples
      • if else Problems
      • if / if else Problems
    • if elif else
      • if elif else Examples
      • if elif else Problems
    • nested if
      • nested if Examples
      • nested if Problems
    • Logical Operators
      • Logical Operators Examples
    • Adventure Game Project
  • Loops
    • while loop - count up
      • Examples
      • Problems
    • while loop - countdown
      • Examples
      • Problems
    • while loop - sentinel value
      • Problems
    • while loop - sentinel menu
      • Problems
    • for loop - range (one argument)
      • Examples
      • Problems
    • for loop - range (two arguments)
      • Problems
    • for loop - range (three arguments)
      • Problems
  • Lists
    • Lists - Numbers
      • Problems
    • Lists - Strings
      • Problems
      • Shopping Project
  • Dictionaries
  • String Methods
  • Functions
    • Variable Scope
    • Functions - no parameters
    • Functions - one parameter
    • Functions - return
    • Functions - lists
  • Files
  • Classes
    • Inheritance
  • Python Projects
    • Adventure Game
    • Restaurant Project
    • Trivia Game
    • Family Tree Project
  • Raspberry Pi
    • Raspberry Pi Models
    • Raspberry Pi Setup
  • Roblox
  • Glossary
Powered by GitBook
On this page
  • Command Mode
  • Exit Commands
  • File Manipulation Commands
  • Text Deletion Commands
  • Yank Commands
  • Paste
  • Undo
  • Change from command mode to insert mode
  • Insert Mode
  • Change from insert mode to command mode

Was this helpful?

  1. Python Cloud Options
  2. CS50 IDE

Vim Mode

PreviousLinux Bash ShellNextVim Tutorial

Last updated 5 years ago

Was this helpful?

Vim is an editor to create or edit a text file.

Command Mode

In the command mode, user can move around the file, delete text, etc.

Key

Explanation

h

Moves the cursor one character to the left

l

Moves the cursor one character to the right

k

Moves the cursor up one line

j

Moves the cursor down one line

nG or :n

Cursor goes to the specified (n) line

^F

(CTRl F) Forward screenful

^B

Backward screenful

^f

One page forward

^b

One page backward

^U

Up half screenful

^D

Down half screenful

$

Move cursor to the end of current line

0

Move cursor to the beginning of current line

w

Forward one word

b

Backward one word

Exit Commands

:wq

Write file to disk and quit the editor

:q!

Quit (no warning)

:q

Quit (a warning is printed if a modified file has not been saved)

ZZ

Save workspace and quit the editor (same as :wq)

File Manipulation Commands

:w

Write workspace to original file

:w file

Write workspace to named file

:e file

Start editing a new file

:r file

Read contents of a file to the workspace

Text Deletion Commands

x

Delete character

dw

Delete word from cursor on

db

Delete word backward

dd

Delete line

d$

Delete to end of line

d^

Delete to beginning of line

Yank Commands

yy

yank current line

y$

yank to end of current line from cursor

yw

yank from cursor to end of current word

Paste

p

paste below cursor

P

paste above cursor

Undo

u

Undo last change

U

Restore line

Change from command mode to insert mode

From command mode to insert mode type a/A/i/I/o/O ( see details below)

Insert Mode

In the insert mode, user can insert text.

Changing mode from one to another

Change from insert mode to command mode

From insert mode to command mode type Esc (escape key)

Some useful commands for VIM

Key

Explanation

a

Append text following current cursor position

A

Append text to the end of current line

i

Insert text before the current cursor position

I

Insert text at the beginning of the cursor line

o

Open up a new line following the current line and add text there

O

Open up a new line in front of the current line and add text there

To create a page break, while in the insert mode, press the CTRL key

And l. ^L will appear in your text and will cause the printer to start

A new page.

Other Useful Commands

Most commands can be repeated n times by typing a number, n, before

the command. For example 10dd means delete 10 lines.

. Repeat last command

cw Change current word to a new word

r Replace one character at the cursor position

R Begin overstrike or replace mode � use ESC key to exit

:/ pattern Search forward for the pattern

:? pattern Search backward for the pattern

n (used after either of the 2 search commands above to

continue to find next occurrence of the pattern.

:g/pat1/s//pat2/g replace every occurrence of pattern1 (pat1) with

Source: http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html