LinuxQuestions.org
Visit Jeremy's Blog.
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 01-08-2009, 12:28 PM   #1
visitnag
Member
 
Registered: Mar 2008
Posts: 147

Rep: Reputation: 15
vi editing problem in Ubuntu8.1...


Hi,

I worked earlier on RHEL4 and i didnot face any problem with vi there. Recently i am testing on Ubuntu8.1. Here i downloaded full version of vim and it is working good. I am facing one problem with vi in ubuntu. When i open a file in vi and do some editing then closing. If i open the file again the cursor is going to line 1, not where i left the file after editing it. for example, I edited line 10 of a file and closed it. When i reopen the same file in vi the cursor going to line 1 instead of line 10(it is not happening in RHEL4). Kindly help me.
 
Old 01-08-2009, 09:01 PM   #2
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
VI or Vim, in /usr/share/doc/vim-common/doc are tons of documents explaining how-to with Vim. Open vim with command: vim and then type: :help to get a hint as to what is contained in each document.
 
Old 01-08-2009, 09:09 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Its possible in Ubuntu that if you say 'vi', you really get vi, instead of it being symlinked to vim as in RH systems...
Never used Ubuntu, so that's just an FYI possibility.

In my .vimrc, the relevant code seems to be
Code:
" Only do this part when compiled with support for autocommands.
if has("autocmd")
  " When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  autocmd BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \   exe "normal g`\"" |
    \ endif
endif " has("autocmd")
 
Old 01-09-2009, 12:02 PM   #4
visitnag
Member
 
Registered: Mar 2008
Posts: 147

Original Poster
Rep: Reputation: 15
Junior hacker..There is no such path in ubuntu vim.
chrism... i copied the code in ~/.vimrc.... but it didnot work.
 
Old 01-09-2009, 12:10 PM   #5
SkinnerC
Member
 
Registered: Dec 2007
Location: New England, USA
Distribution: Ubuntu 8.04 LTS, Slackware 12.2
Posts: 138
Blog Entries: 1

Rep: Reputation: 20
Quote:
Originally Posted by visitnag View Post
Junior hacker..There is no such path in ubuntu vim.
chrism... i copied the code in ~/.vimrc.... but it didnot work.
VIM help is not installed by default in Ubuntu.
 
Old 01-09-2009, 12:27 PM   #6
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Ubuntu MATE, Mint MATE & antiX MX-15
Posts: 1,664
Blog Entries: 5

Rep: Reputation: 562Reputation: 562Reputation: 562Reputation: 562Reputation: 562Reputation: 562
Smile

If I remember correctly, Ubuntu 8.10 does not have the full version of vim installed as standard.
To remedy this go to Terminal and type:

$ sudo apt-get install vim

Press Enter, give the password and press Enter.

Alternatively, install vim using Synaptic.

An excellent vim tutorial is here:

http://www.stat.tamu.edu/~dahl/teach...tml/index.html

At the expense of upsetting dyed-in-the-wool vi fanatics (apologies in advance), I recommend you use vim exclusively and drop vi.
vim is so much simpler and easier to use than vi. However, if you like a challenge then use vi.
 
Old 01-18-2009, 11:23 AM   #7
visitnag
Member
 
Registered: Mar 2008
Posts: 147

Original Poster
Rep: Reputation: 15
Hi all..

My problem is solved. I unquoted some lines("autocmd"....) in vimrc (/usr/share/vim/vimfiles/vimrc) and now it is working properly. Thanks to all...
 
  


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
Ubuntu8.1 partition problem.. visitnag Linux - Software 12 01-04-2009 12:55 PM
vi editor in ubuntu8.1 visitnag Linux - Software 9 12-24-2008 01:43 AM
hard drive mounting problem in Ubuntu8.04 pr5439 Linux - Software 2 11-11-2008 06:26 PM
LAMP problem on ubuntu8.04 2beahacker Linux - Server 13 10-09-2008 12:34 AM
Sound problem Ubuntu8.04 kernel 2.6.24-19-386 cctv Linux - Desktop 0 09-09-2008 09:44 PM


All times are GMT -5. The time now is 11:51 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration