HOWTO: vi Mini-Tutorial (text editor)

If you are new to YDL and have some more or less basic questions.

HOWTO: vi Mini-Tutorial (text editor)

Postby billb » 29 Oct 2008, 11:24

vi is a text-only text editor that's available on most systems including YDL. For a more detailed tutorial, see here:
http://www.eng.hawaii.edu/Tutor/vi.html

Mini vi tutorial:

Start with: vi /path/to/your/file
for example: vi /etc/yaboot.conf

Use the arrow keys to move around

Use the x key to delete text at the current position

-------------
Press the i key for Insert mode

Type your changes

Press the Esc key to exit Insert mode
------------

Press :wq to save your changes and exit

or

Type :q! to exit without saving changes
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA

Re: HOWTO: vi Mini-Tutorial (text editor)

Postby CronoCloud » 28 Feb 2009, 04:24

Just wanted to add that vi (in /bin/vi) on YDL6.1 is a binary created by the vim 7.0 install to act like vi, and is not actual classic vi. I was told that there are differences between vim in vi compatibility mode and classic honest to goodness vi vi. Which reminds me that YDL6.1 vim is 7.0, and that I need to install 7.2. I use vim as my day to day editor or I wouldn't bother updating it, 7.1 especially had some useful enhancements like the built in spell check.

Also although vi/vim is often used in a terminal it does have the graphical modes gvim and the notepad-like evim. If you want vim to be even more Notepad-like and use traditional CUA style commands a la Ctrl+S to save, you can install the vim enhancement called cream:

http://cream.sourceforge.net/

vi/vim (or practically any other Linux editor) will spoil you if you ever have to use actual Windows Notepad. The syntax highlighting alone is a big thing.

I have found that having one of those vi pocket guides like the O'Reilly one is helpful and well worth paying the money for.

Ron Rogers Jr. (CronoCloud)
CECHE01 PS3 (MGS4 80GB Bundle) without OtherOS and with an upgraded 320GB HD
Running Fedora 23 on a Compaq Presario CQ5320F upgraded with a Phenom X4 and GT640
Vizio E221A1 22" 1080P TV with HDMI, using 1080P over HDMI
PSN ID: CronoCloudAuron
User avatar
CronoCloud
Moderator
Moderator
 
Posts: 523
Joined: 21 Oct 2006, 05:48
Location: Central Illinois, USA

Re: HOWTO: vi Mini-Tutorial (text editor)

Postby aguilarojo » 05 Jun 2009, 08:25

I'm pleased to see this thread exists.

Regarding learning more regarding using vim here are some tips which haven't been covered:



  • Remember to use man or info in searching information regarding vim. Do:

    $ info vim

    or

    $ man vim

  • Let vim teach you directly!

    $vimtutor


There are many ways of expanding vim's functionality. One can install the most current version or one can extend the functionality of vim by writing a program of their own which vim will then execute within itself! I've written my own and have posted it within the YDL Board here:

http://www.yellowdog-board.com/viewtopic.php?f=13&t=5211

For those who are interested there are many references regarding vi/vim. One of the more involved references is here:

http://thomer.com/vi/vi.html

All the best...Derick Centeno (aguilarojo)

Everything on the Earth has a purpose.
Every disease an herb to cure it.
And every person has a mission.
This is the Indian Theory of Existence.
-- Morning Dove, Salish (1888-1936)
User avatar
aguilarojo
ydl guru
ydl guru
 
Posts: 227
Joined: 06 May 2009, 14:50
Location: New York City

Re: HOWTO: vi Mini-Tutorial (text editor)

Postby aguilarojo » 11 Jun 2009, 18:14

In addition to the above I wanted to share a Firefox extension which makes Firefox within YDL work exactly like vim! Although I've only used Vimperator a few days it is very evident how much control this provides to the user when one knows vim well. According to the project, scripts which work within vim should work within Vimperator. I shared above a script which functions within vim, and is convenient for use within a traditional IT programming (individual or team) project environment.

Although it would be interesting to discover if the above could be reworked to function within Vimperator, perhaps another would find value extending this Firefox extension developing other scripts, more applicable for web based work.

The creators of Vimperator are located here:

http://www.vimperator.org/vimperator

Everything on the Earth has a purpose.
Every disease an herb to cure it.
And every person has a mission.
This is the Indian Theory of Existence.
-- Morning Dove, Salish (1888-1936)
User avatar
aguilarojo
ydl guru
ydl guru
 
Posts: 227
Joined: 06 May 2009, 14:50
Location: New York City


Return to Beginner

Who is online

Users browsing this forum: No registered users and 4 guests