打开emacs

651阅读 1评论2010-09-13 checl1987_EE
分类:LINUX

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 的方法了。可以用别的名字
上一篇:emacs set character
下一篇:emacs shortcut

文章评论