CSharpRepl emacs integration?

送分小仙女□ 提交于 2019-12-05 14:47:15

You could just create a lisp function to call the CSharpRepl and assign a key to call it when you're working on C# code. For example, you could put the following in your Emacs init file (assuming the CSharpRepl executable "csharp" is in your PATH):

(defun csharp-repl ()
  "Open a new side-by-side window and start CSharpRepl in it."
  (interactive)
  (split-window-side-by-side)
  (other-window 1)
  (comint-run "csharp"))

(global-set-key [f11] 'csharp-repl)

So, if you're editing a C# program (using whatever mode you prefer), you can now press F11 and the CSharpRepl will open up in a new window so that you can interactively evaluate C# code.

A slight addition to the accepted answer. Brings up an existing buffer if it exists.

(defun csharp-repl ()
  "Switch to the CSharpRepl buffer, creating it if necessary."
  (interactive)
  (let ((buf (get-buffer "*csharp*")))
    (if buf
        (pop-to-buffer buf)
        (progn
          (split-window)
          (other-window 1)
          (comint-run "csharp")))))

(define-key csharp-mode-map (kbd "C-c C-z") 'csharp-repl)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!