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:

37011

userrating:

average rating: 1.5 (4 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.0 (1 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back
Please read "Why adblockers are bad".



other Ads
Trace My Cash
Wenn Sie sich schon immer mal gefragt haben, wo eigentlich Ihr geliebtes Bargeld geblieben ist, finden Sie hier vielleicht die Antwort.
www.tracemycash.com
Other free services
toURL.org
Shorten long
URLs to short
links like
http://tourl.org/2
tourl.org
.
Reverse DNS lookup
Find out which hostname(s)
resolve to a
given IP or other hostnames for the server
www.reversednslookup.org

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2017-03-26
gnupg - 2.1.19-r2
Ebuild name:

app-crypt/gnupg-2.1.19-r2

Description

The GNU Privacy Guard, a GPL OpenPGP implementation

Added to portage

2017-03-26

hdbc-sqlite3 - 2.3.3.1-r1
Ebuild name:

dev-haskell/hdbc-sqlite3-2.3.3.1-r1

Description

Sqlite v3 driver for HDBC

Added to portage

2017-03-26

perl-cleaner - 2.25
Ebuild name:

app-admin/perl-cleaner-2.25

Description

User land tool for cleaning up old perl installs

Added to portage

2017-03-26

2017-03-25
Test-File - 1.442.0
Ebuild name:

dev-perl/Test-File-1.442.0

Description

Test file attributes

Added to portage

2017-03-25

Test-utf8 - 1.10.0
Ebuild name:

dev-perl/Test-utf8-1.10.0

Description

Handy utf8 tests

Added to portage

2017-03-25

ack - 2.18
Ebuild name:

sys-apps/ack-2.18

Description

ack is a tool like grep, optimized for programmers

Added to portage

2017-03-25

apt-cacher-ng - 3
Ebuild name:

net-misc/apt-cacher-ng-3

Description

Yet another caching HTTP proxy for Debian/Ubuntu software packages

Added to portage

2017-03-25

avogadro2 - 0.9.0
Ebuild name:

sci-chemistry/avogadro2-0.9.0

Description

Advanced molecule editor and visualizer 2

Added to portage

2017-03-25

avogadrolibs - 0.9.0
Ebuild name:

sci-libs/avogadrolibs-0.9.0

Description

Advanced molecule editor and visualizer 2 - libraries

Added to portage

2017-03-25

brainparty - 0.61-r1
Ebuild name:

games-puzzle/brainparty-0.61-r1

Description

A puzzle-solving, brain-stretching game for all ages

Added to portage

2017-03-25

btrfs-progs - 4.10
Ebuild name:

sys-fs/btrfs-progs-4.10

Description

Btrfs filesystem utilities

Added to portage

2017-03-25

btrfs-progs - 4.9.1
Ebuild name:

sys-fs/btrfs-progs-4.9.1

Description

Btrfs filesystem utilities

Added to portage

2017-03-25

capstone - 3.0.5_rc2
Ebuild name:

dev-libs/capstone-3.0.5_rc2

Description

disassembly/disassembler framework + bindings

Added to portage

2017-03-25

conky - 1.10.6-r2
Ebuild name:

app-admin/conky-1.10.6-r2

Description

An advanced, highly configurable system monitor for X

Added to portage

2017-03-25

dbus - 1.10.16-r1
Ebuild name:

sys-apps/dbus-1.10.16-r1

Description

A message bus system, a simple way for applications to talk to each other

Added to portage

2017-03-25

exiftool - 10.47
Ebuild name:

media-libs/exiftool-10.47

Description

Read and write meta information in image, audio and video files

Added to portage

2017-03-25

genymotion-bin - 2.8.1-r1
Ebuild name:

app-emulation/genymotion-bin-2.8.1-r1

Description

Complete set of tools that provide a virtual environment for

Added to portage

2017-03-25

gnome - 3.22.2
Ebuild name:

gnome-base/gnome-3.22.2

Description

Meta package for GNOME 3, merge this package to install

Added to portage

2017-03-25

gnome-extra-apps - 3.22.2
Ebuild name:

gnome-base/gnome-extra-apps-3.22.2

Description

Sub-meta package for the applications of GNOME 3

Added to portage

2017-03-25

gnome-light - 3.22.2
Ebuild name:

gnome-base/gnome-light-3.22.2

Description

Meta package for GNOME-Light, merge this package to install

Added to portage

2017-03-25

gnome-shell-extensions-topicons-plus - 20
Ebuild name:

gnome-extra/gnome-shell-extensions-topicons-plus-20

Description

Moves legacy tray icons to top panel

Added to portage

2017-03-25

h5py - 2.7.0
Ebuild name:

dev-python/h5py-2.7.0

Description

Simple Python interface to HDF5 files

Added to portage

2017-03-25

kbibtex - 0.6.2
Ebuild name:

app-text/kbibtex-0.6.2

Description

BibTeX editor by KDE to edit bibliographies used with LaTeX

Added to portage

2017-03-25

kde4-l10n - 16.12.3-r1
Ebuild name:

kde-apps/kde4-l10n-16.12.3-r1

Description

KDE legacy internationalization package

Added to portage

2017-03-25

krfb - 16.12.3-r1
Ebuild name:

kde-apps/krfb-16.12.3-r1

Description

VNC-compatible server to share KDE desktops

Added to portage

2017-03-25

laf-plugin - 0.2-r2
Ebuild name:

dev-java/laf-plugin-0.2-r2

Description

Look'n'feel Java library

Added to portage

2017-03-25

laf-plugin - 1.1-r1
Ebuild name:

dev-java/laf-plugin-1.1-r1

Description

Look'n'feel Java library

Added to portage

2017-03-25

lilypond - 2.19.57
Ebuild name:

media-sound/lilypond-2.19.57

Description

GNU Music Typesetter

Added to portage

2017-03-25

marble - 16.12.3-r1
Ebuild name:

kde-apps/marble-16.12.3-r1

Description

Virtual Globe and World Atlas to learn more about Earth

Added to portage

2017-03-25

nm-applet - 1.4.6-r1
Ebuild name:

gnome-extra/nm-applet-1.4.6-r1

Description

GNOME applet for NetworkManager

Added to portage

2017-03-25

nmap - 7.40-r1
Ebuild name:

net-analyzer/nmap-7.40-r1

Description

A utility for network discovery and security auditing

Added to portage

2017-03-25

notmuch - 0.24
Ebuild name:

net-mail/notmuch-0.24

Description

Thread-based e-mail indexer, supporting quick search and tagging

Added to portage

2017-03-25

perl-cleaner - 2.24
Ebuild name:

app-admin/perl-cleaner-2.24

Description

User land tool for cleaning up old perl installs

Added to portage

2017-03-25

pouetchess - 0.2.0-r2
Ebuild name:

games-board/pouetchess-0.2.0-r2

Description

3D and open source chess game

Added to portage

2017-03-25

pysnmp - 4.3.5
Ebuild name:

dev-python/pysnmp-4.3.5

Description

Python SNMP library

Added to portage

2017-03-25

ripgrep - 0.5.0
Ebuild name:

sys-apps/ripgrep-0.5.0

Description

a command line search tool that combines usability with raw speed

Added to portage

2017-03-25

sddm - 0.14.0-r3
Ebuild name:

x11-misc/sddm-0.14.0-r3

Description

Simple Desktop Display Manager

Added to portage

2017-03-25

trayer - 1.0-r3
Ebuild name:

x11-misc/trayer-1.0-r3

Description

Lightweight GTK+ based systray for UNIX desktop

Added to portage

2017-03-25

vivaldi - 1.8.770.44_p1
Ebuild name:

www-client/vivaldi-1.8.770.44_p1

Description

A new browser for our friends

Added to portage

2017-03-25

wop - 0.4.3-r2
Ebuild name:

games-arcade/wop-0.4.3-r2

Description

Worms of Prey - A multi-player, real-time clone of Worms

Added to portage

2017-03-25

youtube-dl - 2017.03.24
Ebuild name:

net-misc/youtube-dl-2017.03.24

Description

Download videos from YouTube.com (and more sites...)

Added to portage

2017-03-25

rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2017 Sascha Nitsch Unternehmensberatung UG(haftungsbeschänkt)
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 5.6 ms
system status display