在Atom中选择多行

pyC*_*hon 37 sublimetext atom-editor

在Atom中是否有任何方法可以复制Sublime Text中的功能,您可以在其中按住alt键并向上或向下移动鼠标以选择并在多行末尾创建光标,以便您可以同时编辑多行?

Lee*_*Lee 36

如果我正确理解您的问题,您需要选择多行并在每行的末尾创建一个光标.有几种方法可以实现这一目标:

  1. 使用拆分成行
    1. 根据需要突出显示多行.
    2. 使用Selection|Split Into Lines命令(Cmd+Shift+L在OS X上或按下Cmd/Ctrl+Shift+P并键入Split Into Lines)将多行选择拆分为每行的选择.
    3. 单击右箭头可在选择的末尾显示光标.
  2. 使用下面的添加选择
    1. 将光标定位在要选择的第一行上方的行上
    2. 用于Selection|Add Selection Below根据需要添加带游标的行数
    3. 使用普通光标定位命令将光标放在所需的位置


Nee*_*ngh 15

我是Sublime Text 3的忠实粉丝,Atom非常好但是无法击败 Sublime :)

好吧,你可以尝试在ATOM中制作" 你最喜欢的Sublime Key'CTRL + SHIFT + L' " 来获得多光标的多线选择:

文件> Keymap ...

粘贴下面的代码和微笑:)

'atom-text-editor':
    'ctrl-shift-l': 'editor:split-selections-into-lines'
Run Code Online (Sandbox Code Playgroud)

保存并关闭选项卡.打开任何文件,然后按" CTRL+SHIFT+L".现在魔法:D,按箭头键,你会在选定的行上看到多个Cusor.


Sup*_*cer 11

对于Ubuntu,您可以使用 shift-alt-up/down

  • 你让我免于安装软件包:D (2认同)

kng*_*yen 6

这个包可以让你通过按住“alt”键来选择多行 https://atom.io/packages/sublime-style-column-selection


Pan*_*hah 6

对于 Windows 用户,
默认键绑定Ctrl+Shift+Up/Down似乎有效。

对于 Mac 用户,
将以下自定义键绑定代码添加到
/user/<yourName>/.atom/keymap.cson文件中

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# change the keybinding for ADD SELECTION ABOVE / BELOW
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  'shift-alt-up': 'editor:add-selection-above'
#  'shift-alt-down': 'editor:add-selection`-below'
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud)

Then place the cursor where you want to start and press and hold Shift+Alt and press Up or Down repeatedly to extend the cursor to as many lines as needed.

+1 to @Lee's solution above. This is same as option 2 above but using keybindings