【发布时间】:2010-10-26 17:30:09
【问题描述】:
我可以在 emacs 的 shell 模式下使用 powershell 作为 shell 吗?
怎么样?
【问题讨论】:
标签: windows emacs powershell
我可以在 emacs 的 shell 模式下使用 powershell 作为 shell 吗?
怎么样?
【问题讨论】:
标签: windows emacs powershell
我没有设计一个完整的包装,而是设计了一个足以满足我需求的五线。您可能想快速适应它。
(defun powershell (&optional buffer)
"Launches a powershell in buffer *powershell* and switches to it."
(interactive)
(let ((buffer (or buffer "*powershell*"))
(powershell-prog "c:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"))
(make-comint-in-buffer "shell" "*powershell*" powershell-prog)
(switch-to-buffer buffer)))
【讨论】:
emacs-26.3-x86_64-no-deps。
基于博客文章 Run PowerShell as a shell within Emacs(2008 年 4 月)和 Emacs Wiki 文章中关于 PowerShell 的部分称为 PowerShell as an inferior shell(2010 年 5 月更新):
将powershell.el 保存在Emacs 安装目录下的.\share\emacs\site-lisp 中,或者您的load-path 中的任何其他目录下。 (powershell.el 太长,无法包含在此答案中。如博客文章中所述,当标准输入和输出被重定向时,无法强制 PowerShell 以交互模式运行,因此需要相当多的胶水代码将其用作劣质外壳。)
将以下内容添加到您的.emacs file:
(autoload 'powershell "powershell" "Run powershell as a shell within emacs." t)
完成后,使用M-x powershell 打开并以交互方式使用 PS shell 缓冲区。
【讨论】:
查看 Jeffrey Snover 的博文PowerShell running inside of Emacs
【讨论】:
找出最快的方法是运行 shell-mode,然后从命令行运行 powershell。
【讨论】: