打开emacs
时间:2010-09-13 来源:checl1987_EE
chechunli@chechunli-desktop:~ $ type edit
edit is aliased to `edit_1'
edit_1 is a function
edit_1 ()
{
local file=$1;
if test -e "$file"; then
emacsclient -n "$file";
else
[[ "$file" =~ :$ ]] && file=${file:0:${#file}-1};
local line=${file##*:};
file=${file%:*};
local x=0;
while test ! -f "$file" && ((x++ < 10)); do
file=../"$file";
done;
if test -e "$file"; then
emacsclient -n +"${line:-1}" "$file";
else
emacsclient -n $1;
fi;
fi
}
把这些内容加在.chechunli@chechunli-desktop:~ $ type edit edit is aliased to `edit_1' edit_1 is a function edit_1 () { local file=$1; if test -e "$file"; then emacsclient -n "$file"; else [[ "$file" =~ :$ ]] && file=${file:0:${#file}-1}; local line=${file##*:}; file=${file%:*}; local x=0; while test ! -f "$file" && ((x++ < 10)); do file=../"$file"; done; if test -e "$file"; then emacsclient -n +"${line:-1}" "$file"; else emacsclient -n $1; fi; fi }
把这些内容加在.bashrc中就可以了 chechunli@chechunli-desktop:~ $ vi .bashrc ... #edit_1 is a function edit_1 () { local file=$1; if test -e "$file"; then emacsclient -n "$file"; else [[ "$file" =~ :$ ]] && file=${file:0:${#file}-1}; local line=${file##*:}; file=${file%:*}; local x=0; while test ! -f "$file" && ((x++ < 10)); do file=../"$file"; done; if test -e "$file"; then emacsclient -n +"${line:-1}" "$file"; else emacsclient -n $1; fi; fi } ... alias edit='edit_1'bashrc中就可以了 chechunli@chechunli-desktop:~ $ vi .bashrc ... #edit_1 is a function edit_1 () { local file=$1; if test -e "$file"; then emacsclient -n "$file"; else [[ "$file" =~ :$ ]] && file=${file:0:${#file}-1}; local line=${file##*:}; file=${file%:*}; local x=0; while test ! -f "$file" && ((x++ < 10)); do file=../"$file"; done; if test -e "$file"; then emacsclient -n +"${line:-1}" "$file"; else emacsclient -n $1; fi;chechunli@chechunli-desktop:~ $ type edit edit is aliased to `edit_1' edit_1 is a function edit_1 () { local file=$1; if test -e "$file"; then emacsclient -n "$file"; else [[ "$file" =~ :$ ]] && file=${file:0:${#file}-1}; local line=${file##*:}; file=${file%:*}; local x=0; while test ! -f "$file" && ((x++ < 10)); do file=../"$file"; done; if test -e "$file"; then emacsclient -n +"${line:-1}" "$file"; else emacsclient -n $1; fi; fi }
把这些内容加在.bashrc中就可以了 chechunli@chechunli-desktop:~ $ vi .bashrc ... #edit_1 is a function edit_1 () { local file=$1; if test -e "$file"; then emacsclient -n "$file"; else [[ "$file" =~ :$ ]] && file=${file:0:${#file}-1}; local line=${file##*:}; file=${file%:*}; local x=0; while test ! -f "$file" && ((x++ < 10)); do file=../"$file"; done; if test -e "$file"; then emacsclient -n +"${line:-1}" "$file"; else emacsclient -n $1; fi; fi } ... alias edit='edit_1' fi } ... alias edit='edit_1' #我是把edit改成打开emacs 的方法了。可以用别的名字
把这些内容加在.chechunli@chechunli-desktop:~ $ type edit edit is aliased to `edit_1' edit_1 is a function edit_1 () { local file=$1; if test -e "$file"; then emacsclient -n "$file"; else [[ "$file" =~ :$ ]] && file=${file:0:${#file}-1}; local line=${file##*:}; file=${file%:*}; local x=0; while test ! -f "$file" && ((x++ < 10)); do file=../"$file"; done; if test -e "$file"; then emacsclient -n +"${line:-1}" "$file"; else emacsclient -n $1; fi; fi }
把这些内容加在.bashrc中就可以了 chechunli@chechunli-desktop:~ $ vi .bashrc ... #edit_1 is a function edit_1 () { local file=$1; if test -e "$file"; then emacsclient -n "$file"; else [[ "$file" =~ :$ ]] && file=${file:0:${#file}-1}; local line=${file##*:}; file=${file%:*}; local x=0; while test ! -f "$file" && ((x++ < 10)); do file=../"$file"; done; if test -e "$file"; then emacsclient -n +"${line:-1}" "$file"; else emacsclient -n $1; fi; fi } ... alias edit='edit_1'bashrc中就可以了 chechunli@chechunli-desktop:~ $ vi .bashrc ... #edit_1 is a function edit_1 () { local file=$1; if test -e "$file"; then emacsclient -n "$file"; else [[ "$file" =~ :$ ]] && file=${file:0:${#file}-1}; local line=${file##*:}; file=${file%:*}; local x=0; while test ! -f "$file" && ((x++ < 10)); do file=../"$file"; done; if test -e "$file"; then emacsclient -n +"${line:-1}" "$file"; else emacsclient -n $1; fi;chechunli@chechunli-desktop:~ $ type edit edit is aliased to `edit_1' edit_1 is a function edit_1 () { local file=$1; if test -e "$file"; then emacsclient -n "$file"; else [[ "$file" =~ :$ ]] && file=${file:0:${#file}-1}; local line=${file##*:}; file=${file%:*}; local x=0; while test ! -f "$file" && ((x++ < 10)); do file=../"$file"; done; if test -e "$file"; then emacsclient -n +"${line:-1}" "$file"; else emacsclient -n $1; fi; fi }
把这些内容加在.bashrc中就可以了 chechunli@chechunli-desktop:~ $ vi .bashrc ... #edit_1 is a function edit_1 () { local file=$1; if test -e "$file"; then emacsclient -n "$file"; else [[ "$file" =~ :$ ]] && file=${file:0:${#file}-1}; local line=${file##*:}; file=${file%:*}; local x=0; while test ! -f "$file" && ((x++ < 10)); do file=../"$file"; done; if test -e "$file"; then emacsclient -n +"${line:-1}" "$file"; else emacsclient -n $1; fi; fi } ... alias edit='edit_1' fi } ... alias edit='edit_1' #我是把edit改成打开emacs 的方法了。可以用别的名字
相关阅读 更多 +