Page 1 of 1

HOWTO: vi Mini-Tutorial (text editor)

PostPosted: 29 Oct 2008, 11:24
by billb
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

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

PostPosted: 28 Feb 2009, 04:24
by CronoCloud
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)

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

PostPosted: 05 Jun 2009, 08:25
by aguilarojo
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)

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

PostPosted: 11 Jun 2009, 18:14
by aguilarojo
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