在 RStudio 中清除命令历史记录的命令或键盘快捷键 [英] Command or keyboard shortcut to clear command history in RStudio

查看:49
本文介绍了在 RStudio 中清除命令历史记录的命令或键盘快捷键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相当于在 RStudio 的 History 窗口中按小扫帚按钮清除当前会话中的整个历史缓冲区的命令或键盘快捷键是什么?

What is the command or keyboard shortcut equivalent to pressing the little broom button in the History window of RStudio which clears out the entire history buffer in the current session?

请注意,我的意思不是清除命令窗口的 Ctrl + L,我的意思是清除按向上箭头访问的历史记录.

Note that I don't mean Ctrl + L which clears the command window, I mean clearing history which is accessed by pressing the up-arrow.

推荐答案

基于 Carl Witthoft 清除历史记录的有用评论的函数(假设您可以写入工作目录):

Function based on Carl Witthoft's helpful comment which clears the history (assumes you can write to the working directory):

clearhistory <- function() {
  write("", file=".blank")
  loadhistory(".blank")
  unlink(".blank")
}

这篇关于在 RStudio 中清除命令历史记录的命令或键盘快捷键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆