Unix/Linux Go Back    


UNIX for Beginners Questions & Answers If you're not sure where to post a Unix or Linux question, post it here. All unix and Linux beginners welcome in this forum!

Vim tips and tricks

UNIX for Beginners Questions & Answers


Reply    
 
Thread Tools Search this Thread Display Modes
    #15  
Old Unix and Linux 05-30-2011   -   Original Discussion by ungalnanban
ifthanwhile's Unix or Linux Image
ifthanwhile ifthanwhile is offline
Registered User
 
Join Date: May 2011
Last Activity: 29 December 2012, 2:46 PM EST
Posts: 22
Thanks: 3
Thanked 1 Time in 1 Post
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.
Sponsored Links
    #16  
Old Unix and Linux 09-22-2011   -   Original Discussion by ungalnanban
phamnu's Unix or Linux Image
phamnu phamnu is offline
Registered User
 
Join Date: Sep 2011
Last Activity: 3 February 2016, 7:04 AM EST
Posts: 11
Thanks: 7
Thanked 0 Times in 0 Posts
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!
Sponsored Links
    #17  
Old Unix and Linux 09-22-2011   -   Original Discussion by ungalnanban
ctsgnb's Unix or Linux Image
ctsgnb ctsgnb is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 3 January 2018, 12:47 PM EST
Location: France
Posts: 2,962
Thanks: 85
Thanked 637 Times in 608 Posts
@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.
The Following User Says Thank You to ctsgnb For This Useful Post:
phamnu (09-22-2011)
    #18  
Old Unix and Linux 11-20-2011   -   Original Discussion by ungalnanban
illgetit's Unix or Linux Image
illgetit illgetit is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 12 December 2012, 12:07 AM EST
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
Silly question; are vi and vim one in the same?
Sponsored Links
    #19  
Old Unix and Linux 01-14-2012   -   Original Discussion by ungalnanban
dgux's Unix or Linux Image
dgux dgux is offline
Registered User
 
Join Date: Aug 2010
Last Activity: 6 February 2013, 7:20 AM EST
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Quote:
Originally Posted by illgetit View Post
Silly question; are vi and vim one in the same?

Nope. vi = vi - Wikipedia, the free encyclopedia
vim = http://en.wikipedia.org/wiki/Vim_(text_editor)

vim is of course based on vi but has more features and improvements - like syntax color highlighting. Stands for 'VI iMproved"
Sponsored Links
    #20  
Old Unix and Linux 10-04-2012   -   Original Discussion by ungalnanban
mukulverma2408's Unix or Linux Image
mukulverma2408 mukulverma2408 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 27 November 2017, 8:47 PM EST
Posts: 78
Thanks: 29
Thanked 2 Times in 2 Posts
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.
Sponsored Links
    #21  
Old Unix and Linux 05-09-2013   -   Original Discussion by ungalnanban
Ribosome's Unix or Linux Image
Ribosome Ribosome is offline
Registered User
 
Join Date: Mar 2013
Last Activity: 23 February 2016, 11:21 PM EST
Posts: 14
Thanks: 15
Thanked 0 Times in 0 Posts
Thanks for this post! I've bookmarked this page.
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Very Importan - Vim Settings - Error while opening a File using vim girija Solaris 0 08-13-2010 09:37 AM
Sed Tricks siba.s.nayak UNIX for Dummies Questions & Answers 3 10-20-2009 04:01 AM
Solaris tips and tricks solaris_user Post Here to Contact Site Administrators and Moderators 1 09-24-2009 02:02 PM



All times are GMT -4. The time now is 04:11 PM.