I installed Neovim on a remote server. Everything runs fine, except that among the very few plugins I use, Telescope does not work properly since it does not find the rg (ripgrep) command.

Two questions on this:

  1. Locally on the remote server, I have a .profile file where I set up some custom stuff, among which alias rg='/server/local/path/to/rg'. However, the shell profile seems to not be loaded when invoking neovim, since if I run :!rg from within neovim, I get the shell returning error since it cannot find the command.
  2. I tried to search in the Telescope documentation on Github, but I could not find any way to set a unique (i.e. that applies to all Telescope commands) custom path to rg. I managed to do it only for the "find_files" command, which does in fact work. Does anyone know how to do this?


1 Answer 1


When running Neovim on a remote server, (sub)shells are run on that server. If that machine does not have a rg command on PATH, it will not be executable. Similarly, it will not read a local profile script (from the point of view of the remote server, that profile script is on a remote server!); instead, it reads its own local profile scripts.

Next, you need to know how your shell runs its profile scripts. For example, the default configuration of Vim does not start an interactive or a login shell, so that typically leads to some startup files not being read (but is faster).

The easiest thing to do is probably one of

  • Edit locally whenever possible. Editing files on a remote server is typically done for (manual) deployments or short-term emergency fixes.
  • Install ripgrep on the remote server in a path that is accessible to the current user (or in a path that the user’s shell and profile scripts add to PATH).
  • Tweak 'shell' so that it is interactive or login as needed (generally not the best idea, but typically with -i or -l flags) or put your alias in a script that is sourced even by non-interactive non-login shells.

Since your alias only serves to duplicate PATH functionality, I recommend the second option: make sure executable programs are findable from PATH!

  • Sorry, I misspelled point 1. With "local server" I actually meant "remote server". Idk why aliases are not "inherited" by the subshell created when invoking Neovim (NOTE: everything happens on the remote server). Adding "rg" location to PATH solved the issue. Thanks for the input.
    – mEm
    Commented Jul 8 at 9:26
  • I'll keep the local/remote points, but I've edited a bit to reflect your changes.
    – D. Ben Knoble
    Commented Jul 8 at 20:03
  • Thanks for your edits. I might not be expressing myself very clearly, or I might be misunderstanding part of your explanations. I don't modify remote files on a local Neovim installation via ssh. Instead, I log into the remote server (vias ssh), and this remote server has its own Neovim installation, same as it has its own Vim one. This same remote server has rg installed. I has an alias to the exec, which WORKS in the remote shell (after the remote user profile scripts are parsed). HOWEVER, that same alias, seemed not to be inherited when init a Neovim session (still on the remote server)
    – mEm
    Commented Jul 11 at 10:10
  • That's why my question. I was launching Neovim from a (remote) user environment where I could correctly reference to rg with the alias, but then within Neovim, that alias seemed to have disappeared (kind of it loaded only the system profile, leaving the user aside). I guess this is why then, having the user modifying the (remote) "global" $PATH variable, made Neovim have access to the rg executable location. This is what looked strange to me. Also because, the same behaviour (Neovim recognising aliases) does not happen on my local PC.
    – mEm
    Commented Jul 11 at 10:14

Your Answer

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

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