Emacs eshell的好处
2016-05-16 15:01
721 查看
一直在Linux下用shell,现在来谈谈eshell.
eshell是完全用elisp编写的shell,所以和shell不一样。shell会创建子进程比如bash. 因此eshell的语法和bash/sh并不完全一样。当然大多数都差不多。
eshell有几个优点
1. 在windows操作系统下,有了eshell,可以方便的运行Linux风格的命令,不需要再安装别的东西. 当然各个平台行为一致也是优点。
2. 支持重定向到其他buffer,用 >#<buffer ...> 格式
~ $ echo hello >#<buffer results>
~ $ ls >#<buffer *scratch*>
这样,会将hello输出到result buffer中,会将ls的结果输出到*scratch*buffer中。
3. grep的结果会包含链接,点击直接打开文件并跳转到结果表示的那一行。这个实在是太赞了。
4. eshell里面直接运行elisp, 相当方便
~ $ (+ 2 1)
3
5. 运行man命令
shell中
$ man grep
WARNING: terminal is not fully functional
- (press RETURN)
GREP(1) General Commands Manual GREP(1)
NAME
grep, egrep, fgrep - print lines matching a pattern
SYNOPSIS
grep [OPTIONS] PATTERN [FILE...]
grep [OPTIONS] [-e PATTERN | -f FILE] [FILE...]
DESCRIPTION
grep searches the named input FILEs for lines containing a match to the given PATTERN. If no files are specified, or if the file “-” is given, grep searches standard input. By default, grep
prints the matching lines.
In addition, the variant programs egrep and fgrep are the same as grep -E and grep -F, respectively. These variants are deprecated, but are provided for backward compatibility.
OPTIONS
Generic Program Information
--help Output a usage message and exit.
-V, --version
Output the version number of grep and exit.
Matcher Selection
不能显示全,
而在eshell中,直接打开一个buffer显示,效果和M-x man一样,但是更加快捷。
注意
eshell仍然是一个编辑器,eshell里的所有内容都可以作为文本复制,但是必须用C-n 和 C-p来上下移动光标,上下键无效。
实际上在eshell中,控制光标应该这样,以我的Dell XPS 13为例
Fn/Home 移动到行首
C-a 移动到$后的第一个字符
Fn/End 或者 C-e移动到行尾
C-b 后移一个字符
C-f 前移一个字符
C-n 下移一行
C-p 上移一行
M-< buffer开头
M-> buffer结尾
M-g g 跳转到某一行,输入数字指定行号
M-g Tab 跳转到当前行某一列,输入数字制定列号
eshell的文档 http://www.gnu.org/software/emacs/manual/html_mono/eshell.html
推荐使用eshell,放弃shell吧。因为这更emacs.
eshell是完全用elisp编写的shell,所以和shell不一样。shell会创建子进程比如bash. 因此eshell的语法和bash/sh并不完全一样。当然大多数都差不多。
eshell有几个优点
1. 在windows操作系统下,有了eshell,可以方便的运行Linux风格的命令,不需要再安装别的东西. 当然各个平台行为一致也是优点。
2. 支持重定向到其他buffer,用 >#<buffer ...> 格式
~ $ echo hello >#<buffer results>
~ $ ls >#<buffer *scratch*>
这样,会将hello输出到result buffer中,会将ls的结果输出到*scratch*buffer中。
3. grep的结果会包含链接,点击直接打开文件并跳转到结果表示的那一行。这个实在是太赞了。
4. eshell里面直接运行elisp, 相当方便
~ $ (+ 2 1)
3
5. 运行man命令
shell中
$ man grep
WARNING: terminal is not fully functional
- (press RETURN)
GREP(1) General Commands Manual GREP(1)
NAME
grep, egrep, fgrep - print lines matching a pattern
SYNOPSIS
grep [OPTIONS] PATTERN [FILE...]
grep [OPTIONS] [-e PATTERN | -f FILE] [FILE...]
DESCRIPTION
grep searches the named input FILEs for lines containing a match to the given PATTERN. If no files are specified, or if the file “-” is given, grep searches standard input. By default, grep
prints the matching lines.
In addition, the variant programs egrep and fgrep are the same as grep -E and grep -F, respectively. These variants are deprecated, but are provided for backward compatibility.
OPTIONS
Generic Program Information
--help Output a usage message and exit.
-V, --version
Output the version number of grep and exit.
Matcher Selection
不能显示全,
而在eshell中,直接打开一个buffer显示,效果和M-x man一样,但是更加快捷。
注意
eshell仍然是一个编辑器,eshell里的所有内容都可以作为文本复制,但是必须用C-n 和 C-p来上下移动光标,上下键无效。
实际上在eshell中,控制光标应该这样,以我的Dell XPS 13为例
Fn/Home 移动到行首
C-a 移动到$后的第一个字符
Fn/End 或者 C-e移动到行尾
C-b 后移一个字符
C-f 前移一个字符
C-n 下移一行
C-p 上移一行
M-< buffer开头
M-> buffer结尾
M-g g 跳转到某一行,输入数字指定行号
M-g Tab 跳转到当前行某一列,输入数字制定列号
eshell的文档 http://www.gnu.org/software/emacs/manual/html_mono/eshell.html
推荐使用eshell,放弃shell吧。因为这更emacs.
相关文章推荐
- Emacs 系列(二):org 模式介绍
- 如何利用Emacs来调试C++程序
- Windows上配置Emacs来开发Python及用Python扩展Emacs
- 将Emacs打造成强大的Python代码编辑工具
- Windows下Lisp环境配置
- emacs中执行shell命令的两种方式在参数上的差异 3ff8
- Emacs使用(一)
- vim与emacs脚本编程对比
- emacs 安装 cedet 遇到的问题
- 用tabbar mode为Emacs建立ta
- Emacs笔记——继续打造舒适的编辑环境,tabbar和speedbar
- Emacs安装和设置tabbar
- Emacs23.3在ubuntu10.10下的手动编译与安装
- 使用emacs的org-mode进行时间管理(七)——org-remember模式
- emacs学习笔记---主流插件
- emacs使修改的配置文件立即生效方法
- 使用MSYS2/MinGW-w64环境编译GNU Emacs
- Emacs+i3wm
- 在Ubuntu12.04上的Common Lisp开发环境配置
- Linux编程基础-emacs简单配置