Cursor Control-L (CTRL-L) Keyboard Shortcuts in Terminal

When I’m using cursor in Linux, I’m using CTRL-L to clear the terminal screen, but it conflicts with cursor’s default behavior, which is used for “Add to Chat”.

The solution is to add a self-defined keyboard shortcut to clear the terminal screen.

Open menu of cursor: File - Settings - Keyboard Shortcuts, and click the “Open Keyboard Shortcuts(JSON)” button, paste the following code:

// Place your key bindings in this file to override the defaults
[
    {
        "key": "ctrl+l",
        "command": "aichat.newchataction",
        "when": "!terminalFocus"
    },
    {
        "key": "ctrl+l",
        "command": "-aichat.newchataction"
    },
    {
        "key": "ctrl+l",
        "command": "workbench.action.terminal.selectCurrentLine",
        "when": "terminalFocus"
    }
]

After that, you can use “CTRL-L” to clear the terminal screen.


Reference: https://forum.cursor.com/t/change-ctrl-l-to-ctrl-i-control-l-is-for-clear-terminal/15310


更多文章
  • Thinking in Python
  • 我的代码进CPython标准库啦
  • Python零碎小知识
  • Python和单元测试
  • 工作一年的总结
  • Python 的继承
  • MongoDB 的一些坑
  • Python的yield关键字有什么作用?
  • 借助coroutine用同步的语法写异步
  • Python3函数参数中的星号
  • 使用Git Hooks
  • Token Bucket 算法
  • nginx配置笔记
  • 阅读Flask源码
  • 尤克里里