システム全体でneovim構成を使用する方法

システム全体でneovim構成を使用する方法

neovim私の設定がすべてのユーザーに機能していることを確認したいと思います。デフォルトでは、コマンドを使用して私のneovim設定を~/.config/nvim使用したいと思います。だからにコピーしました。nvimsudo~/.config/nvim/etc/xdg/nvim

問題は私が使用していて、代わりにファイルをastronvim使用していることです。init.luainit.vimこれファイルが必要ですsysinit.vim。だから私はファイルを作成しましたが、sysinit.vimどうやってこれを達成できるのかわかりませんsysinit.vim

ベストアンサー1

sudoを介してのみnvimコマンドを使用したい場合は、そのままにしてください。~/.config/nvim追加の構成ファイルを作成する必要はありません。

ランニング:

sudo -E nvim /path/to/file

または:

EDITOR=nvim sudoedit /path/to/file
EDITOR=nvim sudo -e /path/to/file

からman sudo

     -E, --preserve-env
                 Indicates to the security policy that the user wishes to preserve their existing environment variables.
                 The security policy may return an error if the user does not have permission to preserve the environment.


     -e, --edit  Edit one or more files instead of running a command.  In lieu of a path name, the string "sudoedit" is
                 used when consulting the security policy.  If the user is authorized by the policy, the following steps
                 are taken:

                 1.   Temporary copies are made of the files to be edited with the owner set to the invoking user.

                 2.   The editor specified by the policy is run to edit the temporary files.  The sudoers policy uses the
                      SUDO_EDITOR, VISUAL and EDITOR environment variables (in that order).  If none of SUDO_EDITOR, VISUAL
                      or EDITOR are set, the first program listed in the editor sudoers(5) option is used.

                 3.   If they have been modified, the temporary files are copied back to their original location and the
                      temporary versions are removed.

シェル設定ファイルに Neovim が設定さsudoedit /path/to/fileれている場合は実行できます。EDITOR例:

# .bashrc
EDITOR=nvim

おすすめ記事