vim quick question

Discuss Applications
Post Reply
User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

vim quick question

Post by Calum »

Image

when you start vim by typing simply 'vim', how do you then get it to do something? ie what are the commands for opening a new file and so on? i tried to type all the things it says on the startup screen but nothing seems to happen...
Last edited by Calum on Wed Mar 05, 2003 5:21 am, edited 1 time in total.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Did you type the ":" in front of the command? For instance ":help" loads the help file. You can PGUP/PGDN or CTRL+F/CTRL+B through the file. I normally load files as parameters to vim but if you load vim and then want to load a file use the ":e" command:

:e /etc/passwd

A cheater way of finding that out is to load "gvim" and click the "file" menu and it shows the vim command next to the menu command (Open - :e).

You might want to find some online tutorials and it would be wise to print out a quick reference card until you have the basic commands memorized. Here's one:
http://tnerual.eriogerg.free.fr/vim.html

Here is the online help as a web page with hyperlinks:
http://vim.sourceforge.net/htmldoc/help.html

Linux Frank
administrator
administrator
Posts: 239
Joined: Fri Jan 10, 2003 2:06 pm

Post by Linux Frank »

And you could also try Vim book

Which is pretty good.

vi /home/user/file or vi /home/user/newfile will also answer your needs.

TheQuirk
programmer
programmer
Posts: 114
Joined: Wed Jan 22, 2003 4:11 pm

Post by TheQuirk »

Or if you don't know what you want to call it, but want to make a file anyway...

:enew

When you're done...

:sav /path/to/new/file.whatever (the extension is unimportant, of course).

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum »

thank you guys! that's great! as for gvim, i never would have thought of that. the xwindows implementations of emacs really CeNsOrEd me off, so i tend to steer clear of GUI implementations of text based things out of habit now. in particular i like how if you type 'vim' in an xterm it doesn't rudely start up the xwindows version (not mentioning any emacs - although in mandrake it is possible to install emacs with no xwindows support, ha! suck it emacs!)

specifically though at the moment i wanted to know how to open vim like that, i couldn't have used gvim anyway, reason being i was using windows (yeurgh!) which i have had to reinstall after many months of happiness due to a proprietary program i need to run for my university course (runs in wine, but toolbars don't work, before anybody asks), and in windows i have freemacs and vim6.1 installed but no gvim. i also have staroffice 5.1, gaim, opera, phoenix and netscape 3 installed but it still doesn't feel like home. my ex-windoid girlfriend has steered well clear of windows since i reinstalled it, i think she's a firm convert! :D

TheQuirk
programmer
programmer
Posts: 114
Joined: Wed Jan 22, 2003 4:11 pm

Post by TheQuirk »

GVim can run in Windows.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum »

well, you learn something wrong every day! ;)
luckily, i only need windows on the nights that i need to use the online chat or file uploading facilities in first class client (that's been two nights so far) so i haven't had much of a chance to give a oops about what programs run in windows, to be honest.

Post Reply