from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites: www.linuxhowtos.org
toolsntoys.linuxhowtos.org



Last additions:
How to make X listen on port 6000

How to make X listen on port 6000

words:

34

views:

83053

userrating:

average rating: 1.2 (52 votes) (1=very good 6=terrible)


May, 25th 2007:
April, 26th 2007:
Apr, 10th. 2007:
Druckversion . pdf icon
You are here: Tutorials per portage category->app-editors->VI

2. Commands



Below you will find a cheat-sheet with vi commands. This cheat sheet will also come in handy in the next section of this document,
Practice Lesson #1.



vi cheat-sheet


a. cursor movements (items below are sometimes called objects):
h - left one character
l - right one character
j - down one line
k - up one line
w - right one word
b - back one word
$ - to the end of line
0 - to the beginning of the line
) - right one sentence
( - left one sentence
} - right one paragraph
{ - left one paragraph
Ctrl-F - forward one page
Ctrl-B - back one page
G - go to (without arguments, go to end of file)
b. deleting:
d - delete
then add one of the cursor movement symbols to
show what should be deleted, i.e.:
d$ - delete to end of line
d0 - delete to the beginning of the line
d} - delete to the end of paragraph
dd - delete delete (delete the whole line)
x - delete character cursor is on
c. other basic commands:
r - replace one character
ZZ - save and exit (hold down shift and press "z" twice)
y - yank (copy into temporary buffer)
then add cursor movement symbol to show what should be
copied, for example: y) - copy to the end of sentence
Y - yank line cursor is on
p - paste below cursor line (deleted or copied text)
P - paste above cursor line
u - undo last editing command
/sometext - search for "sometext"

d. any command can take numeric argument before the name of "object", i.e.:
5dd - delete 5 lines beginning with cursor line (or) d5d - same
2dw - delete two words (or) d2w - delete two words
c3w - change 3 words
3Ctrl-B - move up three pages
1G - go to the first line
e. external commands can be performed on the selected text (in lines)
if command is started with "!", i.e.:
!}fmt - reformat paragraph to 72 columns
f. command line (sometimes called "ex mode"):
:
g. from the command line a "set" command can be executed to
customize editing environment, i.e.:
:set all - will show the state of all options
:set number - will show on the screen numbers of all lines
:set autoindent // obvious
h. from the command line operations can be performed on the range of lines,
i.e.:
:18,24 del - delete from line 18 to line 24
:23,48 copy 17 - block from line 23 to 48 copy to line 17
:2,17 move 92 - block from line 2 to 17 move to line 92
i. from the command line any external UNIX command can be performed on
the range of lines if line range is superseded by "!":
:11,16! sed -e "s/^//*/" -e "s/$/*//"

(the command above wraps the block of text with
"C" style comments - /* text */. It can be done
easier, but this is an example)
:14,19! sort -r +3
(sort the table in reverse order by fourth column)
j. file manipulation from the command line:
:r somefile - read in "somefile"
:x - save and exit (if file is "Read Only", this command will
exit without saving)
:wq - write and quit (same as above)
:w - write (save) if the file permissions allow it
:w! - save file even if it is read-only as long as we own it
:w somefile - save this file as "somefile"
:q - quit without saving
:q! - quit without saving if changes were made
k. text input commands (all require "Esc" to terminate):
i - insert text before the character cursor is on
I - insert text at the beginning of the line
a - append (insert text after the character cursor is on)
A - append text to the end of the line
c - change (replace previous text with new one)
takes arguments just like the delete command - it is
a fast and powerful way of changing original text -
much more so than typical "overwrite"

R - start overwriting text
o - start entering text at the beginning of the new line
below the cursor
O - start entering text at the beginning of the new line
above the cursor
l. if in doubt, press "Esc"


/* The article above and any accompanying files are freely
* distributable, but please leave this notice and the text intact.
* Home for this document: http://www.infobound.com/vi.html
* Copyright (C) 1994, 1999 Tony Thomas
* Contact author through email:
tony@infobound.com
* Last revision Feb 23, 1999
* UNIX is a trademark of X/Open
*/

rate this article:
current rating: average rating: 1.2 (26 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2026-02-02
git-sources - 6.19_rc8
Ebuild name:

sys-kernel/git-sources-6.19_rc8

Description

The very latest -git version of the Linux kernel

Added to portage

2026-02-02

shadow - 4.19.3
Ebuild name:

sys-apps/shadow-4.19.3

Description

Utilities to deal with user accounts

Added to portage

2026-02-02

2026-02-01
caffe2 - 2.10.0-r2
Ebuild name:

sci-ml/caffe2-2.10.0-r2

Description

A deep learning framework

Added to portage

2026-02-01

clang - 23.0.0_pre20260131
Ebuild name:

dev-python/clang-23.0.0_pre20260131

Description

Python bindings for llvm-core/clang

Added to portage

2026-02-01

clang - 23.0.0_pre20260131
Ebuild name:

llvm-core/clang-23.0.0_pre20260131

Description

C language family frontend for LLVM

Added to portage

2026-02-01

clang-common - 23.0.0_pre20260131
Ebuild name:

llvm-core/clang-common-23.0.0_pre20260131

Description

Common files shared between multiple slots of clang

Added to portage

2026-02-01

commons-codec - 1.21.0
Ebuild name:

dev-java/commons-codec-1.21.0

Description

Implementations of common encoders and decoders in Java

Added to portage

2026-02-01

compiler-rt - 23.0.0_pre20260131
Ebuild name:

llvm-runtimes/compiler-rt-23.0.0_pre20260131

Description

Compiler runtime library for clang (built-in part)

Added to portage

2026-02-01

compiler-rt-sanitizers - 23.0.0_pre20260131
Ebuild name:

llvm-runtimes/compiler-rt-sanitizers-23.0.0_pre20260131

Description

Compiler runtime libraries for clang (sanit

Added to portage

2026-02-01

discord - 0.0.122
Ebuild name:

net-im/discord-0.0.122

Description

All-in-one voice and text chat for gamers

Added to portage

2026-02-01

ensurepip-pip - 26.0
Ebuild name:

dev-python/ensurepip-pip-26.0

Description

Shared pip wheel for ensurepip Python module

Added to portage

2026-02-01

evolution - 3.58.3
Ebuild name:

mail-client/evolution-3.58.3

Description

Integrated mail, addressbook and calendaring functionality

Added to portage

2026-02-01

evolution-data-server - 3.58.3
Ebuild name:

gnome-extra/evolution-data-server-3.58.3

Description

Evolution groupware backend

Added to portage

2026-02-01

evolution-ews - 3.58.3
Ebuild name:

gnome-extra/evolution-ews-3.58.3

Description

Evolution module for connecting to Microsoft Exchange Web Services

Added to portage

2026-02-01

flang - 23.0.0_pre20260131
Ebuild name:

llvm-core/flang-23.0.0_pre20260131

Description

LLVM's Fortran frontend

Added to portage

2026-02-01

flang-rt - 23.0.0_pre20260131
Ebuild name:

llvm-runtimes/flang-rt-23.0.0_pre20260131

Description

LLVM's Fortran runtime

Added to portage

2026-02-01

libclc - 23.0.0_pre20260131
Ebuild name:

llvm-core/libclc-23.0.0_pre20260131

Description

OpenCL C library

Added to portage

2026-02-01

libcxx - 23.0.0_pre20260131
Ebuild name:

llvm-runtimes/libcxx-23.0.0_pre20260131

Description

New implementation of the C++ standard library, targeting C

Added to portage

2026-02-01

libcxxabi - 23.0.0_pre20260131
Ebuild name:

llvm-runtimes/libcxxabi-23.0.0_pre20260131

Description

Low level support for a standard C++ library

Added to portage

2026-02-01

libgcc - 23.0.0_pre20260131
Ebuild name:

llvm-runtimes/libgcc-23.0.0_pre20260131

Description

Compiler runtime library for clang, compatible with libgcc_

Added to portage

2026-02-01

libunwind - 23.0.0_pre20260131
Ebuild name:

llvm-runtimes/libunwind-23.0.0_pre20260131

Description

C++ runtime stack unwinder from LLVM

Added to portage

2026-02-01

liferea - 1.16.7
Ebuild name:

net-news/liferea-1.16.7

Description

News Aggregator for RDF/RSS/CDF/Atom/Echo feeds

Added to portage

2026-02-01

lit - 23.0.0_pre20260131
Ebuild name:

dev-python/lit-23.0.0_pre20260131

Description

A stand-alone install of the LLVM suite testing tool

Added to portage

2026-02-01

lld - 23.0.0_pre20260131
Ebuild name:

llvm-core/lld-23.0.0_pre20260131

Description

The LLVM linker (link editor)

Added to portage

2026-02-01

lldb - 23.0.0_pre20260131
Ebuild name:

llvm-core/lldb-23.0.0_pre20260131

Description

The LLVM debugger

Added to portage

2026-02-01

llvm - 23.0.0_pre20260131
Ebuild name:

dev-ml/llvm-23.0.0_pre20260131

Description

OCaml bindings for LLVM

Added to portage

2026-02-01

llvm - 23.0.0_pre20260131
Ebuild name:

llvm-core/llvm-23.0.0_pre20260131

Description

Low Level Virtual Machine

Added to portage

2026-02-01

llvm-common - 23.0.0_pre20260131
Ebuild name:

llvm-core/llvm-common-23.0.0_pre20260131

Description

Common files shared between multiple slots of LLVM

Added to portage

2026-02-01

mitmproxy-linux - 0.12.9
Ebuild name:

net-proxy/mitmproxy-linux-0.12.9

Description

mitmproxy's Rust bits

Added to portage

2026-02-01

mitmproxy-rs - 0.12.9
Ebuild name:

net-proxy/mitmproxy-rs-0.12.9

Description

mitmproxy's Rust bits

Added to portage

2026-02-01

mlir - 23.0.0_pre20260131
Ebuild name:

llvm-core/mlir-23.0.0_pre20260131

Description

Multi-Level Intermediate Representation (library only)

Added to portage

2026-02-01

numpy - 2.4.2
Ebuild name:

dev-python/numpy-2.4.2

Description

Fast array and numerical python library

Added to portage

2026-02-01

offload - 23.0.0_pre20260131
Ebuild name:

llvm-runtimes/offload-23.0.0_pre20260131

Description

OpenMP offloading support

Added to portage

2026-02-01

openmp - 23.0.0_pre20260131
Ebuild name:

llvm-runtimes/openmp-23.0.0_pre20260131

Description

OpenMP runtime library for LLVM/clang compiler

Added to portage

2026-02-01

pip - 26.0
Ebuild name:

dev-python/pip-26.0

Description

The PyPA recommended tool for installing Python packages

Added to portage

2026-02-01

polly - 23.0.0_pre20260131
Ebuild name:

llvm-core/polly-23.0.0_pre20260131

Description

Polyhedral optimizations for LLVM

Added to portage

2026-02-01

pyproject-fmt - 2.12.1
Ebuild name:

dev-python/pyproject-fmt-2.12.1

Description

Format your pyproject.toml file

Added to portage

2026-02-01

rich-click - 1.9.7
Ebuild name:

dev-python/rich-click-1.9.7

Description

Format click help output nicely with rich

Added to portage

2026-02-01

scitokens-cpp - 1.3.0
Ebuild name:

dev-cpp/scitokens-cpp-1.3.0

Description

C++ implementation of the SciTokens library with a C library interface

Added to portage

2026-02-01

stone-soup - 0.34_beta1
Ebuild name:

games-roguelike/stone-soup-0.34_beta1

Description

Role-playing roguelike game of exploration and treasure-hunti

Added to portage

2026-02-01

upmpdcli - 1.9.12
Ebuild name:

media-sound/upmpdcli-1.9.12

Description

UPnP Media Renderer front-end for MPD, the Music Player Daemon

Added to portage

2026-02-01

vivaldi-snapshot - 7.9.3936.3
Ebuild name:

www-client/vivaldi-snapshot-7.9.3936.3

Description

A browser for our friends

Added to portage

2026-02-01

wcwidth - 0.5.3
Ebuild name:

dev-python/wcwidth-0.5.3

Description

Measures number of Terminal column cells of wide-character codes

Added to portage

2026-02-01

wrapt - 2.1.0
Ebuild name:

dev-python/wrapt-2.1.0

Description

Module for decorators, wrappers and monkey patching

Added to portage

2026-02-01

yt-dlp - 2026.01.31
Ebuild name:

net-misc/yt-dlp-2026.01.31

Description

youtube-dl fork with additional features and fixes

Added to portage

2026-02-01

zenlib - 3.2.0
Ebuild name:

dev-python/zenlib-3.2.0

Description

Useful python decorators and utilities

Added to portage

2026-02-01

rdf newsfeed | rss newsfeed | Atom newsfeed
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
- Copyright and legal notices -
Time to create this page: 52.5 ms