mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-14 01:40:09 +00:00
Do not overwrite EDITOR environment variable if already defined.
This commit is contained in:
parent
3a408f326f
commit
a01b1fefe6
1 changed files with 9 additions and 5 deletions
|
@ -11,12 +11,16 @@
|
||||||
|
|
||||||
|
|
||||||
if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
||||||
export EDITOR="$ZSH/plugins/emacs/emacsclient.sh"
|
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
|
||||||
alias emacs="$EDITOR --no-wait"
|
|
||||||
|
# set EDITOR if not already defined.
|
||||||
|
export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}"
|
||||||
|
|
||||||
|
alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait"
|
||||||
alias e=emacs
|
alias e=emacs
|
||||||
|
|
||||||
# same than M-x eval but from outside Emacs.
|
# same than M-x eval but from outside Emacs.
|
||||||
alias eeval="$EDITOR --eval"
|
alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
|
||||||
# create a new X frame
|
# create a new X frame
|
||||||
alias eframe='emacsclient --alternate-editor "" --create-frame'
|
alias eframe='emacsclient --alternate-editor "" --create-frame'
|
||||||
|
|
||||||
|
@ -28,7 +32,7 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
||||||
# opened in the current buffer.
|
# opened in the current buffer.
|
||||||
function efile {
|
function efile {
|
||||||
local cmd="(buffer-file-name (window-buffer))"
|
local cmd="(buffer-file-name (window-buffer))"
|
||||||
$EDITOR --eval "$cmd" | tr -d \"
|
"$EMACS_PLUGIN_LAUNCHER" --eval "$cmd" | tr -d \"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Write to standard output the directory of the file
|
# Write to standard output the directory of the file
|
||||||
|
@ -37,7 +41,7 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
||||||
local cmd="(let ((buf-name (buffer-file-name (window-buffer))))
|
local cmd="(let ((buf-name (buffer-file-name (window-buffer))))
|
||||||
(if buf-name (file-name-directory buf-name)))"
|
(if buf-name (file-name-directory buf-name)))"
|
||||||
|
|
||||||
local dir="$($EDITOR --eval $cmd | tr -d \")"
|
local dir="$($EMACS_PLUGIN_LAUNCHER --eval $cmd | tr -d \")"
|
||||||
if [ -n "$dir" ] ;then
|
if [ -n "$dir" ] ;then
|
||||||
echo "$dir"
|
echo "$dir"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue