Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can't seem to find this in the man page... how do you start vim with it's current directory in a directory other than the current directory. In other words, the relative path once it's started is my home directory. What do I need to do to make it start with that directory ~/otherdir, for example (so I'd type ":e foo" instead of ":e otherdir/foo")?
I'm completely confused as to what you're trying to do ! Vi/Vim is an editor does it do other things ???
As I understand it, just vi /whatever directory you want/whatever file you want - If you manage to start it i.e. you have user permissions to run it, you still may not have the user permissions to edit/alter the file, but if you have then surely it just starts - from a terminal ???
If theres some way of starting it so that it opens a terminal and then goes to the directory you want ????
Perhaps you could clarify exactly what it is that you're trying to do a little more.
Sorry about that, probably typed that post in too much of a rush. I'm taking a programming course and will be using gvim (just looks a little nicer than normal vim-in-a-terminal). If I run just "gvim", I'll get a vim session with vim's "current directory" as my home directory. I'd like to be able to use vim to directly work on (i.e. edit, switch between, compile, run) files that are a few directories deeper. At this point, I'd have to do things like ":e src/spring06/project2/Foo.java" and "java src/spring06/project2/Foo", where I'd like to avoid typing the repeated part of the path. It's just a very small optimization, one that I could get by starting gvim and then doing ":cd src/spring06/project2", but there has to be a way to do that on startup, via a command-line option or something in the .vimrc. Thinking about it a little more I suppose I could do a shell script with something like "cd src/spring06/project2; gvim", but I'd like to do it the way it's supposed to be done.
Thanks again.
--EDIT--
One more clarification... the reason I can't just do "gvim src/spring06/project2/Foo.java" is I'll be editing and moving around between multiple files in that directory, and starting gvim that way (as far as I know) will still leave vim's current directory as my home directory.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.