Vim tips and tricks

Login or Register to Reply

Thread Tools Search this Thread
# 15  
Old 05-30-2011
This thread is a little old, I hope I dont have to make a new one for this.

On most systems the arrow keys will give you control of the cursor, however when I was first learning my arrow keys just stopped working in vim. I found the solution somewhere and it was just a simple command to run before using vim every day so i added it to my .profile and forgot about it. Now I am miles away from my work computer so have no way to look it up, so if someone knows what I am talking about and can clarify or at least post the command I think that would make a great addition to this thread. I will try to find it and post it here. If no one beats me to it.

As a new user that almost made me want to give up, I couldn't scroll and so for me there was nothing better than cat.
# 16  
Old 09-22-2011
I am a beginner with unix, so may be my question will be very stupid.

I have problem with saving a FORTRAN's code after changing it.
I used the "vim" command to read the code, then use the "SHIFT-I" to insert some new part in the code.
After that I don't know how to save the code.
I tried the command: ":w" but it just write to the code, it can not save the code.
Thanks in advance for helping me.

---------- Post updated at 02:28 AM ---------- Previous update was at 02:02 AM ----------

Could I have another question here?
If I want to copy 19 lines in the fortran code (for example from line 1 to line 19) after using the command "vim" to read the code, what should I do?
Thank so much!
# 17  
Old 09-22-2011
@Phamnu :
What you have to understand is :
when in vi or vim you have 2 main mode :
- insertion mode (when you type your code)
- command mode (when you want to tell vi/vim to do some specific actions, line jump, cursor move ...)
With normal bindings, to switch to command mode, press <ESC>
To switch to insert mode, you can use different command (i : insert where your cursor is, I insert at beginning of the line you are on, o, open a line under which you are, O open line above which you are.

a) <ESC> go to command mode
b) 1G go to first line
c) 19yy yank 19 lines including the line your cursor is on
d) nG go on the nth line under which you want to insert the lines
e) p paste the lines previously yanked.
This User Gave Thanks to ctsgnb For This Post:
phamnu (09-22-2011)
# 19  
Old 01-14-2012
Originally Posted by illgetit
Silly question; are vi and vim one in the same?

Nope. vi = vi - Wikipedia, the free encyclopedia
vim =

vim is of course based on vi but has more features and improvements - like syntax color highlighting. Stands for 'VI iMproved"
# 20  
Old 10-04-2012
I don't have vim editor on my system can anyone suggest where can i find it and how to install it.

I have tried downloading few rpm's packages but it isn't working for me.
Login or Register to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Any tricks on excluding a set of strings from a file? newbie_01 UNIX for Dummies Questions & Answers 3 05-22-2013 02:22 AM
Basic VI tricks cokedude UNIX for Advanced & Expert Users 3 08-05-2011 04:11 PM
tips xerox UNIX for Dummies Questions & Answers 1 02-24-2011 08:01 AM
Very Importan - Vim Settings - Error while opening a File using vim girija Solaris 0 08-13-2010 08:37 AM
Sed Tricks siba.s.nayak UNIX for Dummies Questions & Answers 3 10-20-2009 03:01 AM
Solaris tips and tricks solaris_user Post Here to Contact Site Administrators and Moderators 1 09-24-2009 01:02 PM
need couple of ksh tricks please JamesByars Shell Programming and Scripting 4 02-23-2008 02:07 PM
Set prompt, problems and tricks HybridLogic UNIX for Dummies Questions & Answers 6 09-26-2007 08:05 PM
tar tricks neked UNIX for Advanced & Expert Users 2 08-14-2006 03:14 PM