How to make a symbolic link to /usr/bin/vim but with start-up parameters?

You can't without writing a bit of code.

Those symlink shortcuts work because vim is written that way. It looks at how (with what name) it was started and acts as if it had been called with the appropriate command line options.
This behavior is hardcoded in the executable, it is not a trick done by the symbolic link.

So if you want to do that yourself, the easiest is to write a small wrapper script that execs vim with the options you want:

#!/bin/sh
exec vim <options you want> "$@"

The "$@" at the end simply passes any command line options given to the script along to vim.


You can do this in a roundabout way via your shell configuration. Something like

alias big_vim='gvim -p -geom 126x512'

would work in bash/zsh. It allows you to customise things without messing with sudo/root.

NOTE. To make the alias persistent (i.e. working in new terminal), add it to your ~/.bashrc:

echo "alias big_vim='gvim -p -geom 126x512'" >> ~/.bashrc 

You can't do that.

VIM check it's running path on start , e.g by linking original binary to rvim , running path become /path/to/rvim , in that case , VIM will add the -Z parameter automatically even if you didn't specify that.

But if you're only running VIM in terminal , you should:

For bash , add an alias to ~/.bashrc

alias vim='vim -Z'

Change the parameter to suit your need.

For csh / tcsh , remove the = symbol ,

e.g alias vim vim -Z

Tags:

Vim

Symlink

Ln