开发者

How to open file in Emacs via eshell?

When in eshell is there a comm开发者_开发问答and for opening a file in another buffer?


You can call elisp functions directly. So to open a file, call find-file on the filename. Example:

~ $ ls
myfile
~ $ (find-file "myfile")

Parentheses and quotes are optional, so this works too:

~ $ find-file myfile


In eshell, you don't have to use the entire path when using the find file command. Hitting C-x C-f is the same as typing find-file, and eshell sets the directory to the one you are currently browsing. This is the advantage to me over using ansi-term. Try it out.


find-file basically does it, as ataylor and ryan kung indicated earlier.

$ find-file myfile

but, using eshell itself, you can also can set an even shorter alias:

$ alias ff 'for i in ${eshell-flatten-list $*} {find-file $i}'

(and eshell remembers it permanently). so from now you can just type:

$ ff myfile

thanks to this tutorial


The elisp funct can be directly used in eshell, so you can try:

find-file <filename>


Why use eshell? 'C-x f' and type the location of your file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜