emacs里建立多个eshell的简单方法

刚发现一个创建多个eshell的简单方法: M- -M-x eshell RET 每次执行一下上述命令,就新建一个eshell,简单快捷方便。 C-u m M-x eshell RET 这个操作似乎也成功了,但只有最后那个eshell能用,别的有问题。

好巧,我今天也刚好在找同时运行多个eshell的方法,搜到emacswiki里有一个方法:(eshell 'N) , link: EmacsWiki: Eshell Multiple Eshell Buffers

你建立一个eshell buffer再rename一下就好了,

写个交互函数挺简单的.

rename麻烦啊

aweshell就可以了

emacs-libvterm也改成了如果不存在才新建的语义,有点无语。

其实也不麻烦,我开始也一个个rename,后面rename也没用,直接(shell "buffer名字")

比如frp是个常用程序,运行frp要独占一个shell(方便管理),就写了一个函数在m-x里调用(论坛有人把m-x形容为召唤神龙感觉很有意思)

(defun win10-frp() 
  (interactive)
  (progn 
     (shell "shell-frp")
     (insert "d:")(comint-send-input)
     (insert "cd d:/client/frp/")(comint-send-input)
     (insert "frpc -c ./frpc.ini")(comint-send-input)
))

(eshell '7)执行后,我只看到第7个eshell,其他没有。

查了下describe, 发现可能是我当时没仔细看,sorry,用这种方法应该只能建立新的eshell(+变相的重命名?),但是有个比较方便的点是如果要创建的eshell已经存在,那么可以直接跳转到已存在的eshell.

但如果你要的是同时创建多个(比如一条命令就创建7个eshell)的话,那这个命令显然是不行的。

下面是摘的文档:

(eshell &optional ARG)

… Create an interactive Eshell buffer.

Start a new Eshell session, or switch to an already active session. Return the buffer selected (or created).

With a nonnumeric prefix arg, create a new session.

With a numeric prefix arg(as in ‘C-u 42 M-x eshell RET’), switch to the session with that number, or create it if it doesn’t already exist.

The buffer name used for Eshell sessions is determined by the value of ‘shell-buffer-name’, which see. …

基本上 projectile-run-eshell 就够用了