GithubHelp home page GithubHelp logo

laniusone / suda.vim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lambdalisue/vim-suda

0.0 0.0 0.0 57 KB

🥪 An alternative sudo.vim for Vim and Neovim, limited support sudo in Windows

License: MIT License

Vim Script 100.00%

suda.vim's Introduction

🥪 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.

neovim/neovim#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#nopass = 1 is written in your vimrc, suda won't ask you for a password. Use at your own risk.

suda.vim's People

Contributors

lambdalisue avatar doronbehar avatar bdeshi avatar zeertzjq avatar tweekmonster avatar sitiom avatar thinca avatar lumbric avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.