LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 03-30-2008, 06:48 AM   #1
Tischbein
Member
 
Registered: Oct 2006
Distribution: debian
Posts: 124

Rep: Reputation: 15
Vim cursor position


Hello,

Do you know how I can find out the current cursor position in Vi? Likewide how do I jump to a specified position?

Vi functions ar described here:
http://vimdoc.sourceforge.net/htmldo...html#functions

but I can't get them to work. For example:

:call setpos( "cursor", 1)

doesn't move the cursor, no matter where I start.

Regards, Entenflügel
 
Old 03-30-2008, 08:45 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
Well, does
:call cusor (2,2)
work for you? What about
:echo line('.')
:echo col('.')
?

getpos() and setpos() are more complicated, chances are you do not really need them..
 
Old 03-30-2008, 08:29 PM   #3
Tischbein
Member
 
Registered: Oct 2006
Distribution: debian
Posts: 124

Original Poster
Rep: Reputation: 15
Yes, that works, thanks!

Can you recommend some documentation for vim? Or is there a database of examples? Often it's just a few examples such as the ones that you have kindly provided that are all the documentation I need. Vim has :help, does it have :examples?

(I fixed my problem - getting a quick way of typing ascii trees - but only by going over to the dark side - emacs - black body illumination provided in the form of a 900 page manual written to excellent academic standards. Job's done now but it would be nice to be able to stay with Vi next time!)

Regards, Fischbein
 
Old 03-30-2008, 09:47 PM   #4
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
I actually only use :help .. There are some examples in User Manual (as opposed to function reference; I mean the one accessible through :help). I use quick "/" through :help functions to locate needed function.
 
Old 03-31-2008, 01:32 AM   #5
chakka.lokesh
Member
 
Registered: Mar 2008
Distribution: Ubuntu
Posts: 211

Rep: Reputation: 32
Smile vim commands...

hello people,

the following link may be useful.

http://www.fprintf.net/vimCheatSheet.html

cheers.....
 
  


Reply

Tags
vim


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
Cursor Global Position boogy Programming 10 04-27-2009 04:59 AM
Remember last cursor position in VIM rangalo Debian 4 05-12-2007 09:52 AM
vim: startup at last cursor position chrism01 Solaris / OpenSolaris 3 02-20-2007 11:25 AM
DocumentFilter. How to control cursor position? jansh Programming 0 01-26-2004 07:18 AM


All times are GMT -5. The time now is 03:01 PM.

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