如何使用 vim 键绑定在 Sublime Text 2 中插入垂直文本列? [英] How do you insert a vertical column of text in Sublime Text 2 using the vim key bindings?

查看:29
本文介绍了如何使用 vim 键绑定在 Sublime Text 2 中插入垂直文本列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 vim 键绑定在 Sublime Text 2 中插入垂直文本列并缩进?


(来源:yannesposito.com)

我看过 Sublime Text 2 Column Selection Docs,展示了您如何可以使用 Ctrl + Shift + Up,但是否可以使用 vim 快捷方式做同样的事情?

我正在使用 复古模式下的 Sublime.

解决方案

这有点繁琐,而且需要额外的击键,但这是可能的:在执行标准 VIM 之前,您只需要将所选内容拆分为多个光标 Shift+I

所以整个例程(在 Mac 上)是:

  1. 使用 V/v + 运动键选择块

  2. CommandShift + L

  3. V/v 退出可视化模式

  4. 多个光标,您可以移动、插入等等!

<小时>

或者,你可以做我所做的,并通过将 Sublime 的 Shift + Control + 箭头键绑定更改为 Shift + Control + 运动键.

<预><代码>[{ "keys": ["ctrl+shift+j"], "command": "select_lines", "args": {"forward": true} },{ "keys": ["ctrl+shift+k"], "command": "select_lines", "args": {"forward": false} }]

Shift + Control + K 与 OS X 的内置kill all lines"绑定冲突,但 ST 绑定会覆盖这些,并且无论如何你不应该使用那个......它来自Emacs ;)

How do you insert a vertical column of text and indent it in Sublime Text 2 using the vim key bindings?


(source: yannesposito.com)

I have seen the Sublime Text 2 Column Selection Docs, showing how you can use Ctrl + Shift + Up, but is it possible to do the same thing using the vim shortcut?

I am using Sublime in Vintage Mode.

解决方案

It's a bit fiddly and an extra keystroke, but it is possible: you just have to split the selection into multiple cursors before you do the standard VIM Shift+I

So the whole routine (on a Mac) is:

  1. Select block with V/v + motion keys

  2. CommandShift + L

  3. V/v to exit visual mode

  4. Multiple cursors that you can move, insert, whatever!


Alternatively, you can do what I did and adopt a hybrid approach by changing Sublime's Shift + Control + arrow keybindings to be Shift + Control + motion keys instead.

[
    { "keys": ["ctrl+shift+j"], "command": "select_lines", "args": {"forward": true} },
    { "keys": ["ctrl+shift+k"], "command": "select_lines", "args": {"forward": false} }
]

Shift + Control + K conflicts with OS X's built-in "kill all lines" binding, but ST bindings override those, and you shouldn't be using that one anyway... it's from Emacs ;)

这篇关于如何使用 vim 键绑定在 Sublime Text 2 中插入垂直文本列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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