2

In my laptop, if I type below

$ which vi
alias vi='vim'
    /usr/bin/vim

Now I want to change the vi alias to another bin, e.g. vim_wrapper a script created in /usr/bin/, I type this line:

alias vi="vim_wrapper"

in ~/.bashrc or /etc/bashrc, but take no effects. So How to change the default vi alias vi='vim' to vi='vim_wrapper'? Thanks for help!

Nitrodist
  • 1,638
Jason
  • 337

2 Answers2

3

Aliases added to bashrc don't take effect immediately. You have to restart your terminal session or logout and log back in.

To make the alias take effect immediately, run the alias line you added on a terminal as if it were a command or source your bashrc as Nitrodist explains in the first comment.

Patches
  • 16,572
1

You can try to modify the original vi alias set. Here's my grep result:

/etc/profile.d/vim.sh: alias vi >/dev/null 2>&1 || alias vi=vim
slhck
  • 235,242
Riller
  • 11
  • 1