Thursday, June 21, 2012

Re: Can vim be made to start with selected files already open?

On Jun 21, 2012 at 01:11 PM -0400, Eric Weir wrote:
>A quick scan of results on these topics gives me a vague idea of what they are. I'll have to study more carefully to get clear how I would construct an alias to access the files I want to load. I.e., whether the path needs to be explicit. Also to call it for MacVim.

An alias is just shorthand for a command that you would type. Exactly
like you would type it on the command line. So if you need to type:

mvim Documents/mynotes.txt

instead of

vim mynotes.txt

to get the right from the command line, then your alias should reflect
that.

alias vimf='mvim Documents/mynotes.txt'

Of course, the above alias would only work if you were in the directory
that contains the Documents directory. If you aren't, you won't be able
to find the file. So absolute paths might work best:

alias vimf='mvim ~/Documents/mynotes.txt'

Also note that there's nothing special about 'vimf'. It could be
whatever you want, even the same thing as an already existing command.
For example, DON'T make it

alias vim='vim mynotes.txt'

Because then every time you call 'vim' you'll be passing the argument
'mynotes.txt'. Which you probably don't want to do. Though sometimes
you do want to replace a system command with something else, but just be
sure you know what you are doing.

Here's a (random) page about aliases. Should answer most of your
questions:

<http://www.thegeekstuff.com/2010/04/unix-bash-alias-examples/>

>Just start OS X Terminal. Would it be correct to say it's a bash console?

Bash is one of several shells you can run inside the terminal. On OS X,
it is the default (though it wasn't always the default), and is default
on many systems now. But yes, when you open up Terminal in OS X, you
are at the bash prompt.

You might want to pick up a book or read some tutorials on Unix and
Bash.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: