美文网首页
powershell设置readline

powershell设置readline

作者: 华山论剑 | 来源:发表于2021-01-24 00:08 被阅读0次

在linux的terminal下可以用快捷键例如ctrl+u,ctrl+k, ctrl+a, ctrl+e, alt+f, alt+b等等提高工作效率。

ctrl+u 从光标处删除至开头
ctrl+k 从光标处删除至结尾
ctrl+a 将光标移至开头
ctrl+e 将光标移至结尾
ctrl+p 同方向键上
ctrl+n 同方向键下
ctrl+d 删除光标处字符
alt+f 将光标移至下个单词
alt+b 将光标移至上个单词

在windows的powershell下面也可以用这些快捷键,只需要配置powershell的profile文件即可

  1. 创建$profile文件
ni -type file -force $profile
  1. 打开$profile文件
notepad $profile
  1. 在$profile文件加入以下行
if ($host.Name -eq 'ConsoleHost')
{
    Import-Module PSReadLine
    Set-PSReadLineOption -EditMode Emacs
}
  1. 重启powershell

相关文章

网友评论

      本文标题:powershell设置readline

      本文链接:https://www.haomeiwen.com/subject/tuppzktx.html