GitXplorerGitXplorer
l

vim-suda

public
746 stars
29 forks
9 issues

Commits

List of commits on branch master.
Verified
e044d5e5b496fa46ac1f0ba9238f660c4438ae8e

fix: don't error on files containing special chars (#75)

aaarondill committed 9 months ago
Verified
2f5fc67daa557b21522de3ae2556e1bd123b6bcd

refactor!: change suda#system to a list-based api (#74)

aaarondill committed 9 months ago
Verified
66727b416837836712975e748bc8a19fb6cf4ec3

only use arguments on suda#executable if it's equal to "sudo" (#60)

aaarondill committed 10 months ago
Verified
b6363e83be076e00687fcb45def69c169e00ec2c

Fix duplicated help tag `suda` (#70)

nnotomo committed 10 months ago
Verified
257767d7977414210b6db9df0be39b9789d83978

Do not ask for password if not needed. (#69)

ssstark committed 10 months ago
Verified
8b0fc3711760195aba104e2d190cff9af8267052

call checktime after write to warn about changed files (#59)

aaarondill committed 2 years 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.