六键绑定像Bash中R指令行 [英] Vi keybindings for R command line like in Bash

查看:175
本文介绍了六键绑定像Bash中R指令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢的编辑和操作使用vi风格的键绑定具有以下设置bash命令行:

I like editing and manipulating the bash command line using vi-style key bindings with the following setting:

set -o vi

然而,当我在命令行启动R,这些键绑定消失。
我知道的Vim-R插件允许Vim的键绑定当您运行通过Conque壳牌ř ,但我无法与经验完全满意,而不分,有时我只是想在标准的命令行运行R上。

However, when I start R on the command-line, these keybindings disappear. I know that the Vim-R plugin allows for Vim keybindings when you run R through the Conque Shell, but I'm not entirely happy with that experience, and, regardless, sometimes I just want to run R on the standard command-line.


  • 有越来越六风格键绑定R中的命令行上的方法吗?

推荐答案

感谢您对约书亚乌尔里希和progo的答案,这帮助让我开始。

Thank you to Joshua Ulrich and progo's answers, which helped to get me started.

下面我记录我的经验:

我试过设置键盘映射VI 设置编辑模式VI 。当我在Gnome终端开始R,一些捷​​径工作和其他人没有。
特别是 CC DD (即删除线)并没有在所有的工作,而 CW DW 进行删除词的行动,但没有更新,直到我pressed一个附加键的显示,这是不是一个功能体验。

I tried set keymap vi and set editing-mode vi. When I started R in my Gnome Terminal, some shortcuts worked and others did not. In particular cc, and dd (i.e., delete lines) did not work at all, and cw and dw performed the action of deleting words but did not update the display until I pressed an additional key, which is not a functional experience.

  • I found this inputrc file that gave me a few ideas.
  • The help page was helpful, naturally.

我添加以下内容〜/ .inputrc文件,其中固定资产上面提到的明显的问题:

I added the following to ~/.inputrc, which fixed the obvious problems mentioned above:

set completion-ignore-case on

set editing-mode vi

$if mode=vi
    set keymap vi-insert
    "\C-l": clear-screen
    "\C-p": history-search-backward
    "\C-n": history-search-forward
    # alt dot cycles through last argument
    "\e.":yank-last-arg

    set keymap vi-command
    "D":kill-line
    "dw": kill-word
    "dd": kill-whole-line
    "db": backward-kill-word
    "cc": "ddi"
    "cw": "dwi"
    "cb": "dbi"
    "diw": "lbdw"
    "yiw": "lbyw"
    "ciw": "lbcw"
    "diW": "lBdW"
    "yiW": "lByW"
    "ciW": "lBcW"
    "gg": beginning-of-history
    "G": end-of-history
$endif

这篇关于六键绑定像Bash中R指令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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