LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-16-2013, 12:52 AM   #1
anish2good
LQ Newbie
 
Registered: Jul 2011
Posts: 15

Rep: Reputation: Disabled
vim 5 minute tutorial, learn vi/vim is to know what the letters stand for


Learn vim 5 minute tutorial, learn vi/vim is to know what the letters stand for

vim 5 minute tutorial, learn vi/vim is to know what the letters stand for
y(ank) - copy
d(elete) - cut
c(hange) - replace
p(aste) - put from buffer after cursor
o(pen) - start a new line
i(nsert) - insert before current character
a(ppend) - insert after current character
w(ord) - moves to beginning of next word
b(ack) - moves to beginning of current word or prior word
e(nd) - moves to end of current word or next word
f(ind) - moves to a character on the current line
movement keys you just need to learn: h,j,k,l
^ - beginning of text on a line
$ - end of text on a line
0 - first position on line

most commands can be prefaced with numeric modifiers.
2w - means move 2 words
5h - means move 5 characters to the left
3k - means move 3 lines up
3fs - means move to the 3rd letter s folling the cursor
 
Old 07-16-2013, 01:06 AM   #2
Sydney
Member
 
Registered: Mar 2012
Distribution: Scientific Linux
Posts: 147

Rep: Reputation: 36
dd - delete line
 
Old 07-16-2013, 01:20 AM   #3
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
A (<shift>+a) - append to end of line
I (<shift>+i) - insert at begining of line
. - repeat last action

4I<space><esc>

inserts 4 spaces at beginning of current line
. inserts another 4 spaces

ZZ save and exit
 
Old 07-16-2013, 01:22 AM   #4
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
dw - delete word
5dw - delete 5 words
dl - delete letter (character)
5dl - yeah, delete 5 characters
D - delete to end of line
J - join next line with current line
u - undo
<ctrl>+r - redo
<ctrl>+p - keyword completion ( never typo your own variables again )



loads more

Last edited by Firerat; 07-16-2013 at 01:27 AM.
 
1 members found this post helpful.
Old 07-16-2013, 08:37 PM   #5
pswen
LQ Newbie
 
Registered: Dec 2008
Posts: 26

Rep: Reputation: 0
gg -- goto top
Shift+g --goto bottom

Last edited by pswen; 07-16-2013 at 10:38 PM.
 
Old 07-16-2013, 08:38 PM   #6
pswen
LQ Newbie
 
Registered: Dec 2008
Posts: 26

Rep: Reputation: 0
vim v7.2
c(hange) - replace ---- is 's'
 
Old 07-19-2013, 06:07 AM   #7
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Oooh, ctrl+p is very nice! Thanks!

I also use "r" (replace character) often. It means not having to enter insert mode when making simple typo corrections.

"G" will send you to the last line without needing the shift key.

Also try ctrl+a/ctrl+x to increment and decrement the number under the cursor. They can also take prefix numbers to increment by larger amounts.

One very useful online tutorial is A Byte Of Vim. And the Vim Tips Wiki is a treasure trove of suggestions.

Finally, don't forget the vimtutor command!

Last edited by David the H.; 07-19-2013 at 06:16 AM. Reason: additions
 
Old 07-19-2013, 08:17 AM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,582
Blog Entries: 2

Rep: Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037
Quote:
Originally Posted by David the H. View Post
"G" will send you to the last line without needing the shift key.
That's confusing, how do you type G without the shift key?
 
Old 07-19-2013, 09:03 AM   #9
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
! I sure got some egg on my face there! I got thrown by the "Shift+g --goto bottom" posted above and got it confused with the other modifiers like control.

I mean, how often do you see someone write "shift+a" instead of just "A".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to make VIM display french letters? WojtekO Linux - Newbie 8 04-13-2012 12:50 AM
'l' letters are constantly highlighted in VIM?! MheAd Linux - Newbie 11 04-04-2012 11:41 AM
LXer: VIM video tutorial LXer Syndicated Linux News 0 08-06-2009 12:20 AM
Switching from vim to vim -g from inside vim iDragoon Linux - Software 4 05-15-2009 11:46 AM
Editor comparison: vim VS vim-lite, Cleaning vim Ruler2112 *BSD 4 04-13-2009 04:26 PM


All times are GMT -5. The time now is 07:30 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration