How to write to files that require super user rights? #4251
-
When editing a file that does not belong to me, I do |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 12 replies
-
|
Beta Was this translation helpful? Give feedback.
-
To make helix your default sudo editor edit your
Then use |
Beta Was this translation helpful? Give feedback.
-
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: |
Beta Was this translation helpful? Give feedback.
-
micro editor asks for root password when the user is not permitted to write the file. This is really convenient. |
Beta Was this translation helpful? Give feedback.
-
If changing sudo update-alternatives --install /usr/bin/editor editor /home/username/.cargo/bin/hx 50 then select helix: sudo update-alternatives --config editor |
Beta Was this translation helpful? Give feedback.
-
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:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Good care has to be taken on all this little details, as it breaks the user experience real bad. Our keybindings goes away and we get stuck on the pink fantasy theme. It's unusable, we close it. |
Beta Was this translation helpful? Give feedback.
-
in vim, we could use |
Beta Was this translation helpful? Give feedback.
sudoedit(8)
is a good tool for this: instead of runningsudo helix
which runs helix with root permissions, it creates a temp file, runshelix
as you, and then moves the temp file to the location of the real file when done editing.