Senior & Expert RoR Developers Discussion Forum by Nyros Technologies

HIRE Ruby on Rails Expert Developers Programmers Coders From India
Ruby on Rails PHP .Net Developers Community, Nyros Technologies, Kakinada
 
Log in  or IF not a member please REGISTER
Username:
Password:   


Keyword
Log in | Profile 

Vi Editor

 
Post new topic   Reply to topic    Senior & Expert RoR Developers Discussion Forum by Nyros Technologies Index -> Open sources in ruby on rails
View previous topic :: View next topic  
Author Message
ktulasi



Joined: 21 Oct 2009
Posts: 55

PostPosted: Thu Oct 29, 2009 5:41 am    Post subject: Vi Editor Reply with quote

The default editor that comes with the UNIX operating system is called vi (visual editor).

The UNIX vi editor is a full screen editor and has two modes of operation:

1. Command mode commands which cause action to be taken on the file, and
2. Insert mode in which entered text is inserted into the file.

In the command mode, every character typed is a command that does something to the text file being edited; a character typed in the command mode may even cause the vi editor to enter the insert mode. In the insert mode, every character typed is added to the text in the file; pressing the <Esc> (Escape) key turns off the Insert mode.

The most basic and useful commands are
To Start vi :

Open a file
vi file1


Save a file <Esc>+<:>+w+!


Save with new name
<Esc>+<:>+w+_+file1


Quit editing, no save
<Esc>+<:>+q+!


Insert text
<Esc>+i+<input text>+<Esc>


Append text
<Esc>+a+<input text>+<Esc>


Delete text
<Esc>+x


Delete line
<Esc>+dd


Search for pattern
<Esc>+/+<input pattern>


Delete word
<Esc> + dw


Undo
<Esc> + u


Join two lines
<Esc> + J


Line number
<Esc> + <:> + nu

j or <Return>
[or down-arrow] move cursor down one line

k [or up-arrow] move cursor up one line

h or <Backspace>
[or left-arrow] move cursor left one character

l or <Space>
[or right-arrow] move cursor right one character

0 (zero) move cursor to start of current line (the one with the cursor)

$ move cursor to end of current line

w move cursor to beginning of next word

b move cursor back to beginning of preceding word

^f move forward one screen
^b move backward one screen
^d move down (forward) one half screen
^u move up (back) one half screen
^l redraws the screen
^r redraws the screen, removing deleted lines

yy copy (yank, cut) the current line into the buffer

Nyy or yNy copy (yank, cut) the next N lines, including the current line, into the buffer

i insert text before cursor, until <Esc> hit

I insert text at beginning of current line, until <Esc> hit

r replace single character under cursor (no <Esc> needed)

R replace characters, starting with current cursor position, until <Esc> hit
cw change the current word with new text,
starting with the character under cursor, until <Esc> hit

cNw change N words beginning with character under cursor, until <Esc> hit;
e.g., c5w changes 5 words

C change (replace) the characters in the current line, until <Esc> hit

cc change (replace) the entire current line, stopping when <Esc> is hit

x delete single character under cursor

Nx delete N characters, starting with character under cursor

dw delete the single word beginning with character under cursor

dNw delete N words beginning with character under cursor;
e.g., d5w deletes 5 words

D delete the remainder of the line, starting with current cursor position

dd delete entire current line
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Senior & Expert RoR Developers Discussion Forum by Nyros Technologies Index -> Open sources in ruby on rails
Page 1 of 1

 latest topics 
 Topics   Replies   Author   Views   Last Post 
No new posts validates_multiparameter_assignments plugin usage:
0 vijayalakshmi 27 Wed Jul 28, 2010 4:24 am
vijayalakshmi View latest post
No new posts paperclip plugin usage in rails:
0 vijayalakshmi 23 Wed Jul 28, 2010 4:07 am
vijayalakshmi View latest post
No new posts Polymorphism
1 phani.galla 46 Tue Jul 27, 2010 3:27 pm
umamahesh_nyros View latest post
No new posts Deploying Ruby on Rails Application with Passenger
2 sivakrishna.m 630 Tue Jul 27, 2010 2:16 pm
criether View latest post
No new posts Steps to implement star-rating using acts_as_rateable plugin
0 vijayalakshmi 46 Mon Jul 26, 2010 5:47 am
vijayalakshmi View latest post
No new posts Twitter Retweet Integartion
0 Anu 41 Thu Jul 22, 2010 12:27 pm
Anu View latest post
No new posts Usage of build method in rails
0 ktulasi 30 Thu Jul 22, 2010 12:19 pm
ktulasi View latest post
No new posts Facebook Like Integration in Rails
0 Anu 53 Thu Jul 22, 2010 12:16 pm
Anu View latest post
No new posts Fshare in your Rails Application.
0 Anu 39 Thu Jul 22, 2010 12:10 pm
Anu View latest post
No new posts Installation of Postgresql in windows.
1 swaminadhan 198 Thu Jul 15, 2010 10:17 am
proximity3 View latest post




Hire an expert Ruby on Rails developer / coder / programmer or development team from India now!!

Other Forums : PHP   ::   .Net   |   Free unlimited HTML CSS templates download

Nyros Technologies   |   Kakinada City Portal   |   Developers Blog   |   About Ruby on Rails Experts   |   More