Skip to content

Auto open root owned files with sudo for editing using vim

Notifications You must be signed in to change notification settings

n3b0j5a/vim-auto-sudo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

vim-auto-sudo

Small wrapper script around vim editor. It will automatically ask for sudo password when editing some root owned configuration files.

Simply said, it saves both time and nerves.

Installation

Set up VIM_PATH variable in your .bashrc or .zshrc file:

echo export VIM_PATH=$(which vim) >> ~/.zshrc

Use curl or wget command to download and install vim script:

curl -o ~/.local/bin/vim https://raw.githubusercontent.com/ChevalierDeBalibari/vim-auto-sudo/master/vim

or

wget -O ~/.local/bin/vim https://raw.githubusercontent.com/ChevalierDeBalibari/vim-auto-sudo/master/vim

Next, make it executable:

chmod +x ~/.local/bin/vim

Installation for non-vim users

If by chance you don't know how to exit vim and really want to use nano or some other obscure editor, change name of the script to match your favorite crappy editor:

which nano 
mv ~/.local/bin/vim ~/.local/bin/nano

Change VIM_PATH variable to point to path obtained by nano command like:

export VIM_PATH=/usr/bin/nano

That is all!

About

Auto open root owned files with sudo for editing using vim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages