简体   繁体   English

emacs cider 清除 REPL 缓冲区

[英]emacs cider clear REPL buffer

I simply want to clear the repl buffer so that a single prompt eg ( user> ) is left on the first line.我只是想清除 repl 缓冲区,以便在第一行留下一个提示,例如( user> )。

I have a keybinding:我有一个键绑定:

(put 'erase-buffer 'disabled nil)
(global-set-key (kbd "C-x C-<backspace>") 'erase-buffer)

But this gives the message :但这给出了信息:

text is read only文本是只读的

There is the option Cc Co but this only clears the last return value.有选项Cc Co但这只会清除最后一个返回值。

When using python, and run-python the following command Cx Mo which i believe is comint-clear-buffer使用 python 并run-python时,我认为以下命令Cx Mocomint-clear-buffer

cider-repl.el provides a function cider-repl-clear-buffer which by default is bound to: cider-repl.el提供了一个功能cider-repl-clear-buffer ,默认情况下绑定到:

Mx cr--bu RET

as Cc Mb is not used by cider-repl as far as I am aware: 据我所知,cider-repl不使用Cc Mb

(add-hook 'cider-repl-mode-hook
      '(lambda () (define-key cider-repl-mode-map (kbd "C-c M-b")
            'cider-repl-clear-buffer)))

cider-repl.el also provides cider-repl-handle-shortcut which is bound to , . cider-repl.el还提供cider-repl-handle-shortcut绑定到,

Which will prompt you to many commands, such as clear (which you want), ns (to change namespace), refresh , reload and many others这将提示您执行许多命令,例如clear (您想要的)、 ns (更改命名空间)、 refreshreload和许多其他命令

I find pressing , followd by enter (to choose clear , faster/more convenient than the other answer.)我发现按,然后按 enter (选择clear ,比其他答案更快/更方便。)

Note: you need to type , into the repl while the line is empty, it works for both evil and normal emacs keybinds注意:当该行为空时,您需要在 repl 中键入,它适用于邪恶和正常的 emacs 键绑定

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM