GitXplorerGitXplorer
l

vim-suda

public
746 stars
29 forks
9 issues

Commits

List of commits on branch master.
Verified
9adda7d195222d4e2854efb2a88005a120296c47

Prevent using 'swapfile' on 'suda#BufReadCmd' (#88)

llambdalisue committed a month ago
Verified
e333169211b84d6f4012ac9e40bcbbf370b74289

Remove `nobackup` option (#86)

llambdalisue committed a month ago
Verified
b97fab52f9cdeabe2bbb5eb98d82356899f30829

Do NOT escape executable (#80)

llambdalisue committed 9 months ago
Verified
04469d855e36fffcda6be036eb7ff005f64fa0d6

Merge pull request #78 from aarondill/master

aaarondill committed 9 months ago
Unverified
0be5821185b8775f98b9f38b834d5b62bae15c8c

fix: join the shell opts to a string in `suda#systemlist`

aaarondill committed 9 months ago
Verified
d0ccc1a5172f6a26182238767e60e08b931d11fa

fix: rename suda#nopass to suda#noninteractive (#76)

aaarondill committed 9 months ago

README

The README file for this repository.

🥪 suda.vim

MIT License Doc

suda is a plugin to read or write files with sudo command.

This plugin was built while :w !sudo tee % > /dev/null trick does not work on neovim.

https://github.com/neovim/neovim/issues/1716

This plugin is strongly inspired by sudo.vim but the interfaces was aggressively modified for modern Vim script.

Usage

Use SudaRead to open unreadable files like:

" Re-open a current file with sudo
:SudaRead

" Open /etc/sudoers with sudo
:SudaRead /etc/sudoers

Or SudaWrite to write unwritable files like:

" Forcedly save a current file with sudo
:SudaWrite

" Write contents to /etc/profile
:SudaWrite /etc/profile

You can change the prompt string with g:suda#prompt.

" 'Password' in french
let g:suda#prompt = 'Mot de passe: '

Smart edit

When let g:suda_smart_edit = 1 is written in your vimrc, suda automatically switch a buffer name when the target file is not readable or writable.

In short,

$ vim /etc/hosts

or

:e /etc/shadow

Will open suda:///etc/hosts or suda:///etc/shadow instead of /etc/hosts or /etc/shadow because that files are not writable or not readable.

Windows

Install mattn/sudo or gerardog/gsudo to enable this plugin in Windows. Make sure that the following shows 1.

: echo executable('sudo')

Use sudo without a password

When let g:suda#noninteractive = 1 is written in your vimrc, suda won't ask you for a password. Use at your own risk.