简体   繁体   English

在 Atom 中创建多光标

[英]create multicursor in Atom

I use Atom on Ubuntu 17.10 with wayland window manager.我在带有 Wayland 窗口管理器的 Ubuntu 17.10 上使用 Atom。

I can create multiple cursors with CTRL +Mousclick or with CTRL + d to select the next same string.我可以使用CTRL + Mousclick 或CTRL + d创建多个光标以选择下一个相同的字符串。

But how can I for example mark some lines and create a cursor at the start of each line?但是,例如,我如何标记一些行并在每行的开头创建一个光标?

Also would be great to use search and find-all to select lots of results in a text to create a cursor at all these results.使用搜索和查找全部在文本中选择大量结果以在所有这些结果上创建光标也很棒。

I used this workaround at the moment by selecting the line-break and use CTRL + d to select the next linebreaks too with extra cursors, then go one left and Pos1 to have the cursors at the start of each line.我目前通过选择换行符并使用CTRL + d使用额外的光标选择下一个换行符,然后向左走,Pos1 将光标置于每行的开头,从而使用了这种解决方法。

I wanted to select a string that repeats about 200 times in a dataset of 3000 text-blocks in a bunch of output and then I wanted to expand the selection to each of those blocks.我想在一组输出的 3000 个文本块的数据集中选择一个重复约 200 次的字符串,然后我想将选择扩展到每个块。 That would have been really easy with multiple cursors.使用多个游标会很容易。 I solved this another way now, but for the next time I would like to see a complete instruction manual about how to create multiple cursors in the standard atom setting.我现在用另一种方式解决了这个问题,但下次我想看一本关于如何在标准原子设置中创建多个游标的完整说明手册。 I couldn't find this.我找不到这个。 Search-engines give me lots of plugins and solutions in different multicursor plugins.搜索引擎在不同的多光标插件中为我提供了很多插件和解决方案。

I found the manual that explains it like in sublime ( ctrl alt up and down ):我找到了像 sublime 一样解释它的手册( ctrl alt up and down ):

  • Alt+Shift+Up and Down Alt+Shift+上下

see: https://flight-manual.atom.io/using-atom/sections/editing-and-deleting-text/#multiple-cursors-and-selections见: https : //flight-manual.atom.io/using-atom/sections/editing-and-deleting-text/#multiple-cursors-and-selections

What is missing in the manual is also a useful option:手册中缺少的也是一个有用的选项:

  1. use "find all" with the search tool in Atom (CTRL+F)使用 Atom 中的搜索工具“查找全部”(CTRL+F)

  2. press Alt + Enter to create cursors at all the found locations.按 Alt + Enter 在所有找到的位置创建光标。

see: https://discuss.atom.io/t/how-do-i-create-multiple-cursors-from-search-result/53231/5见: https : //discuss.atom.io/t/how-do-i-create-multiple-cursors-from-search-result/53231/5

I wanted to make it easy so I could just use alt + ⬇️ or alt + ⬆️ to have multiple cursors.我想让它变得简单,所以我可以使用alt + ⬇️alt + ⬆️来拥有多个游标。 This was my solution and I think its the easiest:这是我的解决方案,我认为它是最简单的:

# From Atom -> Keymap add the following lines:
'.editor':
  'alt-up': 'editor:add-selection-above'
  'alt-down': 'editor:add-selection-below'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM