Flux rss

Linux - The Vi editor

Introduction to Vi

Despite its very limited ergonomics, Vi i is one of the most popular text editors texte under Unix type systems (with Emacs and pico). Under Linux, there is a free version of Vi called Vim (Vi Improved). Vi (pronounced vee-eye) is an editor that is fully in text mode, which means that all actions are carried out with the help of text commands. This editor, although it may appear of little practical use at first, is very powerful and can be very helpful in case the graphical interface malfunctions.

The syntax to launch Vi is as follows:

vi name_of_the_file

Once the file is open, you can move around by using cursors or the keys h, j, k and l (in case the keyboard does not have any arrow cursors).

Vi modes

Vi has three operating modes:

  • Regular mode: This is the mode you enter whenever you open a file. This mode allows typing commands
  • Insertion mode: This mode makes it possible to insert characters you capture inside of the document. To switch to insertion mode, just press the key Insert on your keyboard or, by default, the key i
  • Replacement mode: This mode allows you to replace existing text by the text you capture. Just hit r again to go to replacement mode and hit the key Esc to return to regular mode

Basic commands

Command Description
:q Quit the editor (without saving)
:q! Forces the editor to quit without saving (even if changes were made to the document)
:wq Saves the document and quits the editor
:filename Saves the document under the specified name

Editing commands

Command Description
x Deletes the character that is currently under cursor
dd Deletes the line that is currently under cursor
dxd Deletes x lines starting with the one currently under the cursor
nx Deletes n characters starting with the one currently under the cursor
x>> Indents x lines to the right starting with the one currently under the cursor
x<< Indents x lines to the left starting with the one currently under the cursor

Searching and replacing

To search for a word in a document, in regular mode, just type / followed by the chain of characters to be searched for and confirm by hitting the Enter key. Use the n key to go from occurrence to occurrence.

To replace a chain of characters by another on a line, you will find a very powerful command in Vi by using the regular expressions. Its syntax is as follows:

:s/chain_to_be_replaced/replacement_chain/
IThe replacement can be made throughout the entire document with the following syntax:
:%s/chain_to_be_replaced/replacement_chain/

Copy-paste and cut-paste

In Vi, it is possible to copy-paste a selection of lines. To do so, just type in the following command to copy n lines:

nyy
For example, the following command will copy 16 lines onto the clipboard:
16yy
To past the selection, just type the letter p.

Cutting-pasting n lines is similar by using the command:

ndd
Then p to paste!

Last update on Thursday October 16, 2008 02:43:15 PM.
This document entitled « Linux - The Vi editor » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the licence, as this note appears clearly.
Video Editor needed helo everybody, well i have a simple problem and i need it from MAC experts. Which Software may i use as Video editor plz ?? I would really like to know how to edit videos !? Thanx all en.kioskea.net/forum/affich-3214-video-editor-needed
Download Winmorph WinMorph is the reference tool for creation of morphing with photographs. It was even used on films as Dreamcatcher and one " reality show " roadshows. WinMorph can be used as complete program or as plug in for other video editors. The freedom of... en.kioskea.net/telecharger/telecharger-371-winmorph
Editor of Windows XP and Vista in Qwerty?Editor of Windows XP and Vista in Qwerty? __TOC_ The windows Editor for DOS is accessed by cmd in the run (Menu Start> Run). However the windows editor is set as default as QWERTY for its key function. Below is a tips of how to convert... en.kioskea.net/faq/sujet-1052-editor-of-windows-xp-and-vista-in-qwerty
Convert your video file to and from .flvConvert your video file to and from .flv Introduction Under Windows Riva FLV Encoder: Super: Under Linux Operating Systems Introduction This tips has been drawn to explain how to convert your video files from any files type to .flv... en.kioskea.net/faq/sujet-822-convert-your-video-file-to-and-from-flv
Changing password via a scriptChanging password via a script Method 1: passwd Method 2: chpasswd Method 1: passwd Conventionally the command use to change password on Linux based system is passwd , the option related to this command is –stdin ,an this is all done... en.kioskea.net/faq/sujet-790-changing-password-via-a-script
GTA 4Hello, Be ready guys just one more week before playing to GTA4 and there is some sort of video editor in there...but sure to share your video here :P en.kioskea.net/forum/affich-40635-gta-4
Linux / Vista Dual Boot issuesHi, guys! I’m trying to learn more about using Linux. I'm using a dual boot from a HP Laptop preloaded with Vista. I use Linux more and more now but still switch to Vista, mainly for my photos and relative software and MP3. Is there a way that... en.kioskea.net/forum/affich-448-linux-vista-dual-boot-issues
Dual Boot Ubuntu/Vista GRUB Error 21Hello, Ok, I have Vista and Ubuntu dual booted, on separate hdds. I had just finished beating Crysis: Warhead, an awesome game by the way, for some reason my computer bsods. I reboot and when it restarts I get a GRUB21 error. So, since I'm sorta... en.kioskea.net/forum/affich-25667-dual-boot-ubuntu-vista-grub-error-21
Download AVI TrimmerWhen to undertake you in assemblages videos from files AVI, you would like that there will be no loss in the quality. SolveigMM AVI Trimmer is a video editor for a quick result and without loss in quality. It is an application of small size and... en.kioskea.net/telecharger/telecharger-670-avi-trimmer
Download AvidemuxAvidemux is a free video editor. It is mainly intended for editing, encoding and filtering. It supports several formats such as AVI, MPEG files, DVD compatible, MP4 and ASF by using a multitude of codecs. The tasks can be automated using the... en.kioskea.net/telecharger/telecharger-1328-avidemux
Download Free Virtual Serial Ports EmulatorFor the users of the same network or even on the single computer, sometimes an apparatus can be solicited by several applications more than once. Free Virtual Serial Ports Emulator or VPSE is a program intends for the computer engineers and in... en.kioskea.net/telecharger/telecharger-731-free-virtual-serial-ports-emulator
Linux - Commands Command Description DOS equivalent ls lists the content of a directory dir cd change of directory cd cd .. parent directory cd.. mkdir creates a new directory md rmdir eliminates a directory deltree cp copy of a file copy, xcopy mv moves a file move... en.kioskea.net/linux/lincomm.php3
Linux - Mini HOW-TO Documents The mini HowTo documents are a set of documentations written by different people on very specific topics concerning Linux. Below you will find a (non exhaustive) list of HowTo documents written or translated into French: HOW-To Description 3Dfx-HOWTO... en.kioskea.net/linux/howto.php3
Video and digital imaging - The MKV format The MKV format (Matroska Video) is an entirely free video format. More precisely, it is a container (hence the name Matroska, in reference to the Russian dolls contained within another) making it possible to contain video (DivX, Xvid, RV9, etc),... en.kioskea.net/video/mkv-matroska.php3