Editing Files in deepOfix

Using mcedit

mcedit is a useful text editor which gets its name from Midnight Commander, a popular GNU/Linux file manager. mcedit is easy to use and comes with support for function keys.

As the panel on the bottom of the page shows, you can save the file by pressing <F2> and exit mcedit by pressing <F10>.

root@hostname:directory# mcedit file1

This opens file1 with mcedit if file1 is present in the current folder.

mcedit has a menu, which can be accessed using <F9> function key. It uses the arrow keys to navigate and editing of files is easy.

Using vim

vim is one of the favorite editors for both GNU/Linux administrators and programmers.

You can edit files in deepOfix using vim by issuing:

root@hostname:directory# vim file1

This opens file1 with vi for editing if file1 exists in the current folder.

Basic usage

The vim editor provides three modes:

  • Normal mode
  • Insert mode
  • Visual mode

Initially, you will be in normal mode. Here, you can navigate by using the keys:

Operation Key
Left h
Down j
Up k
Right l
Beginning of next word w
Beginning of current word b
End of current word e

You can key in a number to repeat an operation. For example, to go to the 7th word, use 7w. To go up 22 lines, use 22k.

File opening, saving, and a host of other commands can be run using the ex mode of vim. When in normal mode, you can use : to enter ex mode:

CommandOperationShortcut
:w Save current
:q Quit vim
:wq Save and quit vim :x
:q! Quit vim without saving
:w <filename> Save as <filename>
:e <filename> Open <filename> for editing
:sh Run a shell

Please supply the filename of the file to be opened in place of <filename> while running the above commands.

Insert mode

To key in text into the document being edited, enter insert mode. The following keys can be used:

CommandOperation
i Insert text left of cursor
a Append text right of cursor
o Open line below
I Insert text at start of line
A Append text at end of line
O Open line above
 
help/command-line/editing-files.txt · Last modified: 2009/07/24 01:25 by gaurav     Back to top