在 emacs 中创建多个 eshell 实例

发布于 2024-08-26 20:34:03 字数 97 浏览 14 评论 0原文

想一想:用 eshell 平铺我的 emacs 窗口,就像 xmonad 一样。这可能吗?我可以 Mx eshell 打开第一个 eshell 实例,但以后的调用仅关注第一个实例。

Think: tiling my emacs window with eshells, a la xmonad. Is this possible? I can M-x eshell to open the first eshell instance but future invocations just focus the first instance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

岁月打碎记忆 2024-09-02 20:34:03

您可以这样做:

`C-u M-x eshell`

这将创建 *eshell**eshell*<2> 等。

You can do this:

`C-u M-x eshell`

This will create *eshell*, *eshell*<2>, and so on.

_蜘蛛 2024-09-02 20:34:03

我的首选方法是创建命名 shell:

(defun make-shell (name)
  "Create a shell buffer named NAME."
  (interactive "sName: ")
  (setq name (concat "$" name))
  (eshell)
  (rename-buffer name))

这是要点。然后Mx make-shell name将创建所需的shell。

My preferred approach is to create named shells:

(defun make-shell (name)
  "Create a shell buffer named NAME."
  (interactive "sName: ")
  (setq name (concat "$" name))
  (eshell)
  (rename-buffer name))

is the gist. Then M-x make-shell name will create the desired shell.

南冥有猫 2024-09-02 20:34:03

eshell 的文档字符串指出“非数字前缀 arg 意味着创建一个新会话”。我一遍又一遍地输入 M-- Mx eshell,每次它都会打开一个新的 eshell 缓冲区。

The docstring for eshell states that "A nonnumeric prefix arg means to create a new session." I typed M-- M-x eshell over and over, and each time it opened a new eshell buffer.

甜味超标? 2024-09-02 20:34:03

Cu Mx eshell 效果很好,但我更喜欢命名 shell - make-shell 方法,在切换缓冲区时很有用

C-u M-x eshell works great, but I prefer named shells - make-shell approach, is useful when switching buffers

夏日落 2024-09-02 20:34:03

对于使用 ansiterm 的用户来说,调用 GNU Screen 是另一种选择

Invoking GNU Screen is another option for those using ansi-term

就此别过 2024-09-02 20:34:03

也许,下面的解决方案更好。因为eshell缓冲区是由eshell-buffer-name的值决定的。您无需重命名缓冲区。

(defun buffer-exists (bufname)   
  (not (eq nil (get-buffer bufname))))

(defun make-shell (name)
  "Create a shell buffer named NAME."
  (interactive "sName: ")
  (if (buffer-exists "*eshell*")
      (setq eshell-buffer-name name)
    (message "eshell doesnot exists, use the default name: *eshell*"))
  (eshell))

Mybe, the following solution is better. Because the eshell buffer is determined by the value of eshell-buffer-name. You need not to rename the buffer.

(defun buffer-exists (bufname)   
  (not (eq nil (get-buffer bufname))))

(defun make-shell (name)
  "Create a shell buffer named NAME."
  (interactive "sName: ")
  (if (buffer-exists "*eshell*")
      (setq eshell-buffer-name name)
    (message "eshell doesnot exists, use the default name: *eshell*"))
  (eshell))
吃不饱 2024-09-02 20:34:03

扩展make-eshell,这会创建附加下一个计数器的 eshell,因此类似于 eshell1eshell2 等:

(lexical-let ((count 1))
  (defun make-eshell-next-number ()
    (interactive)
    (eshell)
    (rename-buffer (concat "*eshell" (number-to-string count) "*"))
    (setq count (1+ count))))

Expanding on make-eshell, this creates an eshell appending the next counter, so it's like eshell1, eshell2, etc.:

(lexical-let ((count 1))
  (defun make-eshell-next-number ()
    (interactive)
    (eshell)
    (rename-buffer (concat "*eshell" (number-to-string count) "*"))
    (setq count (1+ count))))
你的笑 2024-09-02 20:34:03

这是我对新 eshell 缓冲区/实例的实现。

(defun eshell-new-buffer (args)
  "Create a new eshell buffer."
  (interactive "P")
  (eshell "new")
  )


(global-set-key (kbd "C-c e e") 'eshell)

(global-set-key (kbd "C-c e n") 'eshell-new-buffer)

Here is my implementation of new eshell buffer / instance.

(defun eshell-new-buffer (args)
  "Create a new eshell buffer."
  (interactive "P")
  (eshell "new")
  )


(global-set-key (kbd "C-c e e") 'eshell)

(global-set-key (kbd "C-c e n") 'eshell-new-buffer)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文