0

I have customized my Vim environment under my "login" ID ${HOME}.
Everything is under ~login_ID/.vim (no customizations under ~login_ID/.gvim).

I have created a symbolic link /root/.vim pointing to ~login_ID/.vim :

(~) # ln -s ~login_ID/.vim .vim

Why doesn't root ID inherit all ~login_ID/.vim content in usable fashion ???

IMAGE when viewed by root in vim (called from MATE terminal on UbuntuMATE 20.04) before the symlink is created: This1

IMAGE when viewed by root in vim ... after the symlink is created: This2

IMAGE when viewed by login_ID in vim (again called from MATE terminal), which is behaviour expected for root with symbolic link in place: This3

3
  • Oh, and welcome to Vi and Vim!
    – filbranden
    Aug 23, 2021 at 23:21
  • 1
    It's always seems to be the small stuff which will trip you up without realizing it! I completely forgot about the ~root/.vimrc being non-existent. With that in place, all is working as expected. Also, thank you for pointing out the ~/.vim/vimrc approach. Thats PERFECT! Thank you very much, filbranden. Aug 23, 2021 at 23:52
  • I would recommend not doing this and just using sudoedit.
    – D. Ben Knoble
    Aug 24, 2021 at 11:49

1 Answer 1

0

The issue is that, beyond the ~/.vim directory, there's the file ~/.vimrc which is used for configuration.

So either you're missing the ~/.vimrc from your login user, or you have a different /root/.vimrc in your root user that is being picked as the main vimrc file.

Note that (at least with recent versions of Vim 8.x, IIRC Vim 7.x didn't support this path) you can store your main user vimrc file at path ~/.vim/vimrc, so that all of your configuration is contained inside the ~/.vim path.

But, even in that case, make sure you don't have a /root/.vimrc in the home directory of the root user, in which case Vim might end up picking up that one instead of the one inside the ~/.vim symlink.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.