Does something similar to "rvim" exist on Ubuntu?

I read here about how to safely edit a file using sudo, I do use sudoedit most of the time, however I would be interested to know if there is something similar on Ubuntu to rvim which is mentioned there.

I am running Ubuntu GNOME 16.04 with GNOME 3.20 and as I can't find anything in the repositories with the same or a similar name I was wondering if rvim or a similar restrictive text editor exists in Ubuntu?

5

1 Answer

There appears to be no independent rvim binary, however installing the vim package creates a symbolic link using the update-alternatives mechanism:

Setting up vim (2:7.4.1689-3ubuntu1.1) ...
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rvim (rvim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rview (rview) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode

Following the link, we find that the link eventually resolves to vim.basic

$ readlink -f $(which rvim)
/usr/bin/vim.basic

Presumably there's some argv[0] magic inside vim.basic that causes it to run it in restricted mode when invoked as rvim.

According to the vim manpage you can also use the -Z option:

rvim rview rgvim rgview Like the above, but with restrictions. It will not be possi‐ ble to start shell commands, or suspend Vim. Can also be done with the "-Z" argument.

Which provides the same functionality in vim as rvim, but is not literally calling rvim.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like