Chinaunix首页 | 论坛 | 博客
  • 博客访问: 567042
  • 博文数量: 213
  • 博客积分: 6789
  • 博客等级: 准将
  • 技术积分: 1947
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-01 17:11
文章分类

全部博文(213)

文章存档

2012年(9)

2011年(62)

2010年(99)

2009年(43)

分类: LINUX

2010-09-13 10:23:01

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 的方法了。可以用别的名字
阅读(577) | 评论(1) | 转发(0) |
0

上一篇:emacs set character

下一篇:emacs shortcut

给主人留下些什么吧!~~

chinaunix网友2010-09-13 14:40:50

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com