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

前端 未结 2 1119
不思量自难忘°
不思量自难忘° 2021-02-02 01:01

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 th

2条回答
  •  被撕碎了的回忆
    2021-02-02 01:51

    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 ;)

提交回复
热议问题