mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Open read only files with sudo
This commit is contained in:
parent
a99302b680
commit
69d0cb2f22
1 changed files with 6 additions and 1 deletions
|
|
@ -1,7 +1,12 @@
|
||||||
go() {
|
go() {
|
||||||
if [ -f "$1" ]; then
|
if [ -f "$1" ]; then
|
||||||
if [ -n "`file $1 | grep '\(text\|empty\|no magic\)'`" ]; then
|
if [ -n "`file $1 | grep '\(text\|empty\|no magic\)'`" ]; then
|
||||||
|
if [ -w "$1" ]; then
|
||||||
$EDITOR "$1"
|
$EDITOR "$1"
|
||||||
|
else
|
||||||
|
sudo $EDITOR "$1"
|
||||||
|
#echo $EDITOR /sudo::"$1" # For emacsclient+tramp
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
if [ -e "`which xdg-open`" ]; then
|
if [ -e "`which xdg-open`" ]; then
|
||||||
if [ -n "$DISPLAY" ]; then
|
if [ -n "$DISPLAY" ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue