Monday 29 August 2011

VI Essentials

Sometimes you visit a client and you have got only access to the vi editor. While this editor can be frustrating to learn especially for Windows and Mac users I believe that learning or referring to the below commands might become handy to any IT professional.

Starting/Saving
vi [+n] <file_name>
Open filename positioning the cursor at line number n
:wq
Save the file to disk and quit
:q!
Quit without saving any changes


Moving Cursor
h (or Left arrow key)
Left
l  (or Right arrow key)
Right
k (or Up arrow key)
Up
j  (or Down arrow key)
Down
G
End of file
^
Beginning of current line
$
End of current line


Searching Text
/string
Search down for string
?string
Search up for string
n
Repeat last search
:%s/old-string/new-string/g
Search and replace old-string with new-string


Copying and Pasting Text
[n]yy
Copying n lines into buffer
p
Paste the buffer after the current line


Inserting and Deleting Text
i
Insert starting left of cursor
x
Delete single character
[n]dd
Delete n lines
u
Undo last change


Directives
:set nu / :set nonu
Turn on line numbering / Turn off line numbering
:set ic / :set noic
Ignore case when searching / Ignore case off

12 comments:

  1. Greetings. I know this is somewhat off-topic, but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform like yours, and I’m having difficulty finding one? Thanks a lot.
    AWS Training in Bangalore | Amazon Web Services Training in Bangalore

    Amazon Web Services Training in Pune | Best AWS Training in Pune

    ReplyDelete
  2. Fantastic work! This is the type of information that should follow collective approximately the web. Embarrassment captivating position Google for not positioning this transmit higher! Enlarge taking place greater than and visit my web situate
    online Python certification course | python training in OMR | python training course in chennai

    ReplyDelete
  3. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    Java interview questions and answers | Core Java interview questions and answers

    ReplyDelete
  4. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    Data Science training in Chennai | Data science training in bangalore

    Data science training in pune | Data science online training

    Data Science Interview questions and answers

    ReplyDelete
  5. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information. 

    devops online training

    aws online training

    data science with python online training

    data science online training

    rpa online training

    ReplyDelete
  6. I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well..
    big data course malaysia

    ReplyDelete
  7. but I put things off too much and never seem to get started. Thanks though.
    dWebsite directory

    ReplyDelete
  8. https://www.canva.com/design/DAExheT-19Q/share/preview?token=vFBx4Z0xoiwAyp2xv6E39A&role=EDITOR&utm_content=DAExheT-19Q&utm_campaign=designshare&utm_medium=link&utm_source=sharebutton

    ReplyDelete
  9. Not sure which online broker is best? Trading Directory company are here to help. Our goal is to provide you with unbiased and detailed information that will help you make the right decision. Whether it's your first time or you're an experienced trader, finding the right Online Service Provider (OSP) for your trading needs is an important decision.

    ReplyDelete