Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use sudo write #617

Closed
Tracked by #627
fecet opened this issue Apr 5, 2023 · 5 comments · Fixed by #641
Closed
Tracked by #627

Cannot use sudo write #617

fecet opened this issue Apr 5, 2023 · 5 comments · Fixed by #641
Labels
bug Something isn't working has:workaround This issue is not fixed but can be circumvented until then keymap Keymap related issues

Comments

@fecet
Copy link
Contributor

fecet commented Apr 5, 2023

["n|<C-S-s>"] = map_cmd("execute 'silent! write !sudo tee % >/dev/null' <bar> edit!")
:with_silent()
:with_noremap()
:with_desc("editn: Save file using sudo"),

This keymap does not work for me, what magic is used here to bypass neovim/neovim#1716

@fecet
Copy link
Contributor Author

fecet commented Apr 6, 2023

I have been using suda.nvim in the past (and currently), so this issue has not caused me much trouble, but I am curious if I am the only one facing this problem.

@CharlesChiuGit
Copy link
Collaborator

I never try to force write a file with sudo before, will try if I got time.

@ayamir
Copy link
Owner

ayamir commented Apr 7, 2023

It should be:

["c|w!!"] = map_cmd("execute 'silent! write !sudo tee % >/dev/null' <bar> edit!"):with_desc("editn: Save file using sudo"),

before. It works.
I can revert it if ok.

@Jint-lzxy Jint-lzxy added bug Something isn't working needs:response Waiting for reply from the author keymap Keymap related issues labels Apr 7, 2023
@fecet
Copy link
Contributor Author

fecet commented Apr 7, 2023

It should be:

["c|w!!"] = map_cmd("execute 'silent! write !sudo tee % >/dev/null' <bar> edit!"):with_desc("editn: Save file using sudo"),

before. It works. I can revert it if ok.

That doesn't ask for password for me

@ayamir
Copy link
Owner

ayamir commented Apr 8, 2023

Yes, I set NOPASSWD for me lol.
We can remove this line and use suda.vim if so.

@Jint-lzxy Jint-lzxy added has:workaround This issue is not fixed but can be circumvented until then and removed needs:response Waiting for reply from the author labels Apr 10, 2023
@ayamir ayamir linked a pull request Apr 10, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has:workaround This issue is not fixed but can be circumvented until then keymap Keymap related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants