Sudo vim “command not found” problem

  linux, question

System: debian8

shell:zsh

In order to add support for python, vim7.4 has been recompiled and installed in /usr/local/vim74, and Aliasvim =’/usr/local/vim74/bin/vim’ has been set in. zshrc. everything is normal.

However, when using sudo vim, it is suggested that sudo: vim: no command can be found. sudo /usr/local/vim74/bin/vim is required. what is the reason?

In addition, ask two related questions:
1. Do I use zsh to modify. zshrc? Never mind. bashrc?
2. Where are alias defined? I’ve seen both. zshrc and. bashrc, only part of them.

When you executesudo vim, is in the root user’s$PATHFind vim in
However, the global catalog/usr/bin:/usr/sbinThere is no vim
The right thing to do is

EDITOR=/usr/local/vim74/bin/vim
 export EDITOR

Then usesudoedit filenameEdit

PS: Strongly Opposes Compile Time./configure --prefix=/usr/local/vim74This practice