How to write to files that require super user rights? #4251
|
When editing a file that does not belong to me, I do |
Replies: 9 comments 15 replies
|
|
|
To make helix your default sudo editor edit your Then use |
|
When you run helix as sudo helix look for config in root/.config/helix/.. path. You can supply your own config path by doing hx --config /my/path/config.toml or symlink config to root profile folder. Another option is to do what installers do and make a bash script in for example /usr/bin/ named hx, with content like this: |
|
micro editor asks for root password when the user is not permitted to write the file. This is really convenient. |
|
If changing sudo update-alternatives --install /usr/bin/editor editor /home/username/.cargo/bin/hx 50then select helix: sudo update-alternatives --config editor |
|
Run which hx to see where is helix binary. And just replace output from
that command into first one.
…On Sat, Aug 5, 2023, 12:57 PM Hezhexi2002 ***@***.***> wrote:
Sorry to bother you here,but I meet an error when I try to execute the
command:
sudo update-alternatives --install /usr/bin/editor editor
/home/username/.cargo/bin/hx 50
it throw an error like below:
[image: image]
<https://user-images.githubusercontent.com/53631206/258580017-a4667bf2-0e2c-42f7-bfc7-b0bcc5b7bd8c.png>
and I also check the directory which used in the command and found that
there does not have hx ,so I wonder if it exits only when you build the
helix from source,hope you can give me more details
—
Reply to this email directly, view it on GitHub
<#4251 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOFFNVG5DYHBQCIZWU4WSK3XTYRJZANCNFSM6AAAAAAREJUWEU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
This comment was marked as disruptive content.
This comment was marked as disruptive content.
|
in vim, we could use |
|
....Not as good as micro |
sudoedit(8)is a good tool for this: instead of runningsudo helixwhich runs helix with root permissions, it creates a temp file, runshelixas you, and then moves the temp file to the location of the real file when done editing.