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:

71284

userrating:

average rating: 1.2 (8 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 (2 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
2024-12-30
bitwarden-desktop-bin - 2024.12.0
Ebuild name:

app-admin/bitwarden-desktop-bin-2024.12.0

Description

Bitwarden password manager desktop client

Added to portage

2024-12-30

clazy - 1.13
Ebuild name:

dev-util/clazy-1.13

Description

Compiler plugin which allows clang to understand Qt semantics

Added to portage

2024-12-30

ethflop - 20240916
Ebuild name:

net-misc/ethflop-20240916

Description

A network-backed floppy emulator for DOS

Added to portage

2024-12-30

gcc - 15.0.0_pre20241229
Ebuild name:

sys-devel/gcc-15.0.0_pre20241229

Description

The GNU Compiler Collection

Added to portage

2024-12-30

git-sources - 6.13_rc5
Ebuild name:

sys-kernel/git-sources-6.13_rc5

Description

The very latest -git version of the Linux kernel

Added to portage

2024-12-30

graphviz - 12.2.1
Ebuild name:

media-gfx/graphviz-12.2.1

Description

Open Source Graph Visualization Software

Added to portage

2024-12-30

nushell - 0.101.0
Ebuild name:

app-shells/nushell-0.101.0

Description

A new type of shell, written in Rust

Added to portage

2024-12-30

racket-mode - 1_p20241207
Ebuild name:

app-emacs/racket-mode-1_p20241207

Description

Emacs modes for Racket edit, REPL, check-syntax, debug, profile,

Added to portage

2024-12-30

vlc - 3.0.21-r2
Ebuild name:

media-video/vlc-3.0.21-r2

Description

Media player and framework with support for most multimedia files and str

Added to portage

2024-12-30

xfce4-xkb-plugin - 0.8.5
Ebuild name:

xfce-extra/xfce4-xkb-plugin-0.8.5

Description

XKB layout switching panel plug-in for the Xfce desktop environme

Added to portage

2024-12-30

2024-12-29
VSS - 25.0.0
Ebuild name:

dev-ada/VSS-25.0.0

Description

A high level string and text processing library

Added to portage

2024-12-29

atheme-services - 7.2.12-r5
Ebuild name:

net-irc/atheme-services-7.2.12-r5

Description

A portable and secure set of open-source and modular IRC services

Added to portage

2024-12-29

atuin - 18.4.0
Ebuild name:

app-shells/atuin-18.4.0

Description

Shell history manager supporting encrypted synchronisation

Added to portage

2024-12-29

borgmatic - 1.9.5
Ebuild name:

app-backup/borgmatic-1.9.5

Description

Automatically create, prune and verify backups with borgbackup

Added to portage

2024-12-29

digest - 3.2.0
Ebuild name:

dev-ruby/digest-3.2.0

Description

Provides a framework for message digest libraries

Added to portage

2024-12-29

drumstick - 2.10.0
Ebuild name:

media-sound/drumstick-2.10.0

Description

Qt/C++ wrapper for ALSA sequencer

Added to portage

2024-12-29

eduke32 - 20241226.10608
Ebuild name:

games-fps/eduke32-20241226.10608

Description

An open source engine port of the classic PC first person shooter

Added to portage

2024-12-29

foliate - 3.2.1
Ebuild name:

app-text/foliate-3.2.1

Description

gtk ebook reader built with gjs

Added to portage

2024-12-29

gallium-nine-standalone - 0.10
Ebuild name:

app-emulation/gallium-nine-standalone-0.10

Description

A standalone version of the WINE parts of Gallium Nine

Added to portage

2024-12-29

gcc - 14.2.1_p20241228
Ebuild name:

sys-devel/gcc-14.2.1_p20241228

Description

The GNU Compiler Collection

Added to portage

2024-12-29

guile-lib - 0.2.8.1
Ebuild name:

dev-scheme/guile-lib-0.2.8.1

Description

An accumulation place for pure-scheme Guile modules

Added to portage

2024-12-29

homebank - 5.8.6
Ebuild name:

app-office/homebank-5.8.6

Description

Free, easy, personal accounting for everyone

Added to portage

2024-12-29

hyprcursor - 0.1.10-r2
Ebuild name:

gui-libs/hyprcursor-0.1.10-r2

Description

The hyprland cursor format, library and utilities

Added to portage

2024-12-29

hyprland - 0.46.2-r1
Ebuild name:

gui-wm/hyprland-0.46.2-r1

Description

A dynamic tiling Wayland compositor that doesn't sacrifice on its looks

Added to portage

2024-12-29

hyprutils - 0.3.0-r1
Ebuild name:

gui-libs/hyprutils-0.3.0-r1

Description

Hyprland utilities library used across the ecosystem

Added to portage

2024-12-29

inflect - 7.5.0
Ebuild name:

dev-python/inflect-7.5.0

Description

Correctly inflect words and numbers

Added to portage

2024-12-29

installkernel - 49
Ebuild name:

sys-kernel/installkernel-49

Description

Gentoo fork of installkernel script from debianutils

Added to portage

2024-12-29

lgogdownloader - 3.16
Ebuild name:

games-util/lgogdownloader-3.16

Description

Unofficial GOG.com downloader for Linux

Added to portage

2024-12-29

libgit2 - 1.9.0
Ebuild name:

dev-libs/libgit2-1.9.0

Description

A linkable library for Git

Added to portage

2024-12-29

libgit2-glib - 1.2.0-r2
Ebuild name:

dev-libs/libgit2-glib-1.2.0-r2

Description

Git library for GLib

Added to portage

2024-12-29

netpbm - 11.9.2
Ebuild name:

media-libs/netpbm-11.9.2

Description

A set of utilities for converting to/from the netpbm (and related) formats

Added to portage

2024-12-29

nuitka - 2.5.9
Ebuild name:

dev-python/nuitka-2.5.9

Description

Python to native compiler

Added to portage

2024-12-29

path - 17.1.0
Ebuild name:

dev-python/path-17.1.0

Description

A module wrapper for os.path

Added to portage

2024-12-29

pillow - 11.0.0-r2
Ebuild name:

dev-python/pillow-11.0.0-r2

Description

Python Imaging Library (fork)

Added to portage

2024-12-29

racket-mode - 9999
Ebuild name:

app-emacs/racket-mode-9999

Description

Emacs modes for Racket edit, REPL, check-syntax, debug, profile, and mor

Added to portage

2024-12-29

resolv - 0.6.0
Ebuild name:

dev-ruby/resolv-0.6.0

Description

Thread-aware DNS resolver library in Ruby

Added to portage

2024-12-29

resolv-replace - 0.1.1
Ebuild name:

dev-ruby/resolv-replace-0.1.1

Description

Replace Socket DNS with Resolv

Added to portage

2024-12-29

rinda - 0.2.0
Ebuild name:

dev-ruby/rinda-0.2.0

Description

The Linda distributed computing paradigm in Ruby

Added to portage

2024-12-29

rqlite - 8.36.3
Ebuild name:

dev-db/rqlite-8.36.3

Description

Replicated SQLite using the Raft consensus protocol

Added to portage

2024-12-29

ruby - 3.4.1
Ebuild name:

dev-lang/ruby-3.4.1

Description

An object-oriented scripting language

Added to portage

2024-12-29

ruby-ssl - 15
Ebuild name:

virtual/ruby-ssl-15

Description

Virtual ebuild for the Ruby OpenSSL bindings

Added to portage

2024-12-29

rubygems - 21-r1
Ebuild name:

virtual/rubygems-21-r1

Description

Virtual ebuild for rubygems

Added to portage

2024-12-29

sbcl - 2.5.0
Ebuild name:

dev-lisp/sbcl-2.5.0

Description

Steel Bank Common Lisp (SBCL) is an implementation of ANSI Common Lisp

Added to portage

2024-12-29

slixmpp - 1.8.6
Ebuild name:

dev-python/slixmpp-1.8.6

Description

Python 3 library for XMPP

Added to portage

2024-12-29

snapraid - 12.3-r1
Ebuild name:

sys-fs/snapraid-12.3-r1

Description

Backup program with disk array for cold data on existing filesystems

Added to portage

2024-12-29

starlette - 0.44.0
Ebuild name:

dev-python/starlette-0.44.0

Description

The little ASGI framework that shines

Added to portage

2024-12-29

vmpk - 0.9.1
Ebuild name:

media-sound/vmpk-0.9.1

Description

Virtual MIDI Piano Keyboard

Added to portage

2024-12-29

xfce4-notes-plugin - 1.11.1
Ebuild name:

xfce-extra/xfce4-notes-plugin-1.11.1

Description

Xfce4 panel sticky notes plugin

Added to portage

2024-12-29

xfce4-windowck-plugin - 0.5.2
Ebuild name:

xfce-extra/xfce4-windowck-plugin-0.5.2

Description

Panel plugin to put the maximized window title and window bu

Added to portage

2024-12-29

xfce4-xkb-plugin - 0.8.4
Ebuild name:

xfce-extra/xfce4-xkb-plugin-0.8.4

Description

XKB layout switching panel plug-in for the Xfce desktop environme

Added to portage

2024-12-29

xmlada - 25.0.0
Ebuild name:

dev-ada/xmlada-25.0.0

Description

Set of modules that provide a simple manipulation of XML streams

Added to portage

2024-12-29

xwaylandvideobridge - 0.4.0-r1
Ebuild name:

gui-apps/xwaylandvideobridge-0.4.0-r1

Description

Screenshare Wayland windows to XWayland apps

Added to portage

2024-12-29

rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2020 Sascha Nitsch Unternehmensberatung GmbH
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: 49.9 ms