225

How to select columns in Editors and IDEs to columnar delete, insert or replace some characters ?

Editors:

  • Atom
  • Notepad++
  • Kate
  • VIM
  • Sublime
  • Emacs
  • Textpad
  • Emerald Editor
  • UltraEdit
  • MCEdit
  • jEdit
  • Nedit

IDEs:

  • NetBeans
  • Eclipse
  • Visual Studio
  • IntelliJ IDEA
  • Flash Builder
  • Aptana Studio
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Sajad Bahmani
  • 17,325
  • 27
  • 86
  • 108
  • 1
    Anyone who wants to add to the information here should create a new question for that specific editor (if one doesn't already exist) and answer _that_ question. Giant lists like this have gotten unmanageable in the decade since this question was posted: turns out there are a lot of editors. Who knew? – Ryan M May 06 '22 at 10:50

22 Answers22

221
  • Notepad++, Visual Studio, and some others: Alt + drag.
  • vim: Ctrl + v or (bizarrely enough) Quad-click-drag. In windows: Ctrl + Q (since Ctrl + V is the standard for paste)
Gustav Bertram
  • 14,591
  • 3
  • 40
  • 65
Alex Budovski
  • 17,947
  • 6
  • 53
  • 58
86

In Kate toggle Ctrl + shift + B .

Sajad Bahmani
  • 17,325
  • 27
  • 86
  • 108
  • 6
    FTR, this also applies to kdevelop. – kikeenrique Oct 14 '13 at 13:36
  • 1
    Note this toggles, so to go back to the default selection mode you have to press `Ctrl + shift + B` again. – fedorqui Sep 04 '14 at 09:36
  • 1
    And it is called "Block Selection Mode" in Kate, if you, like me, were searching for it in the Edit menu. – ReneSac Apr 19 '15 at 20:52
  • 3
    Kate does not seem to support vertical insertion or am I doing something wrong ? I switched to "Block Selection Mode" then selected the first column of a series of lines (left of the first character) then typed something. It unexpectedly appeared only as a prefix to the last line ! – Chucky May 27 '15 at 14:11
  • Kate column insertion is available 4.12. check https://kate-editor.org/2013/09/09/multi-line-text-editing-in-kate/ – mms May 10 '18 at 15:14
62

In Netbeans 7.1 can select columns (Rectangular Selection) with Ctrl + shift + R . There is also a button Toggle Rectangular Selection Button in the code editor available.

This is how rectangular selections look like: Screenshot Rectangular Selection

Alberto
  • 5,021
  • 4
  • 46
  • 69
Sajad Bahmani
  • 17,325
  • 27
  • 86
  • 108
38

Eclipse used to need a column mode plugin to be able to select a rectangular selection.

column mode

Since Eclipse 3.5, you just need to type Alt+Shift+A: see its News and Noteworthy section. (On OS X it's Option-Command-A.)

block (aka column or rectangular) selection mode

Or activate the 'Editor Presentation' action set ( Window > Customize Perspective menu) to get a tool bar button for toggling the block selection mode.

AmbroseChapel adds in the comments:

This is a toggle.

Columnar selection is a mode you enter and leave: in other words, Eclipse switches into a mode where all mouse selections have to be columnar and you stay in that mode until you switch back (by using the same command again).
It's not like other editors where columnar selections are enabled only while certain keys are down.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Quick note: With Eclipse, this is a toggle. Columnar selection is a mode you enter and leave—in other words, Eclipse switches into a mode where all mouse selections have to be columnar and you stay in that mode until you switch back (by using the same command again). It's not like other editors where columnar selections are enabled only while certain keys are down. – AmbroseChapel Nov 12 '18 at 00:43
22

SublimeText 2, 3, and 4

Using the Mouse

Different mouse buttons are used on each platform:

OS X

Left Mouse Button + Option
OR: Middle Mouse Button
Add to selection: Command
Subtract from selection: Command+Shift

Windows

Right Mouse Button + Shift
OR: Middle Mouse Button
Add to selection: Ctrl
Subtract from selection: Alt

Linux

Right Mouse Button + Shift
Add to selection: Ctrl
Subtract from selection: Alt

Using the Keyboard

OS X

ctrl + shift +

ctrl + shift +

Windows

ctrl + alt +

ctrl + alt +

Linux

ctrl + alt +

ctrl + alt +

Source: SublimeText2 Documentation

Mart Van de Ven
  • 378
  • 2
  • 8
22

In vim column visual mode is Ctrl + v. If that is what you meant?

Sajad Bahmani
  • 17,325
  • 27
  • 86
  • 108
Yacoby
  • 54,544
  • 15
  • 116
  • 120
  • 5
    The Windows version uses Ctrl + Q since Ctrl + V is the standard paste clipboard command. – Andrew Cowenhoven Dec 04 '09 at 14:19
  • 4
    @Andrew: It's worth noting that by "Windows version" you mean the default .vimrc that ships with gVim. The default vim behavior can be reverted to Ctrl+V by commenting out the appropriate line in $VIMRUNTIME/mswin.vim. – technomalogical Aug 26 '10 at 16:33
16

You didn't explicitly state emacs, but since you've highlighted lots of editors...

In emacs, you can use rectangles for this, where a column is a rectangle of width 1.

To create a rectangle, mark the top-left and bottom-right of the rectangle (where the bottom-right mark is one to the right of the further right point included in the rectangle. You can then manipulate via:

C-x r k
Kill the text of the region-rectangle, saving its contents as the "last killed rectangle" (kill-rectangle).

C-x r d
Delete the text of the region-rectangle (delete-rectangle).

C-x r y
Yank the last killed rectangle with its upper left corner at point (yank-rectangle).

C-x r o
Insert blank space to fill the space of the region-rectangle (open-rectangle). This pushes the previous contents of the region-rectangle rightward.

M-x clear-rectangle
Clear the region-rectangle by replacing its contents with spaces.

M-x delete-whitespace-rectangle
Delete whitespace in each of the lines on the specified rectangle, starting from the left edge column of the rectangle.

C-x r t string RET
Replace rectangle contents with string on each line. (string-rectangle).

M-x string-insert-rectangle RET string RET
Insert string on each line of the rectangle.

Dominic Rodger
  • 97,747
  • 36
  • 197
  • 212
  • Thanks, this is great! Note that with cua-mode enabled, the C-x would cut the region, so one must substitute C-x C-x, or S-C-f. – TextGeek Nov 03 '16 at 15:56
11

In IntelliJ IDEA, you can switch the selection mode with Alt + Shift + Insert combination. You can also column select by keeping the middle mouse button (i.e. the scroll wheel button) pressed and dragging.

MarcelK
  • 283
  • 2
  • 4
  • 11
10

on Kate

Ctrl + Shift + B also allows you to add more columns by simply clicking anywhere and paste it.

I used this when saving text files I copied from Google Translate as a side-by-side view.

fedorqui
  • 275,237
  • 103
  • 548
  • 598
Robin Kee
  • 357
  • 3
  • 10
7

This feature is not available in older versions of Netbeans (up to 7.1) and the plugin is not supported anymore.

A plugin is now available for NetBeans 6.9.

Alberto
  • 5,021
  • 4
  • 46
  • 69
Jla
  • 11,304
  • 14
  • 61
  • 84
6

in Notepad++ , you can select a particular column holding ctrl + alt + shift and then left click mouse button and drag to select.

Eon
  • 146
  • 1
  • 4
6

In TextMate with the mouse: start a selection and keep alt pressed while you move the cursor.

Without the mouse: first select normally using and arrows then hit alt and move the cursor.

romainl
  • 186,200
  • 21
  • 280
  • 313
5

In TextPad:

With the mouse, Left-Click + Alt + Drag. Note that if you first use Alt, and then Click-and-drag, it does not work (at least for me). Ctrl+Alt instead of Alt also Works.

For pure keyboard, no mouse, enable Block Select Mode with Ctrl+Q, B. Or use the sequence Alt, C, B, to do it via the Configure menu.

Warning 1: if Word Wrap is enabled, then Block Select Mode will not be available (which is somewhat logical). First disable Word Wrap. This was causing me some trouble, and this gave me the answer.

Warning 2: if you mean to insert text in every selected row by typing, you have to use Edit, Fill Block. Other editors let you type in directly.

4

In textpad.

Go to left top of the page. hold "shift key Now use right arrow key to select column. Now click "down arrow" key. And the entire column will be selected.

nilesh
  • 41
  • 1
  • 2
    To enable "block select mode", use CTRL+Q then B. Same again to turn off. – Michael Hinds Feb 25 '14 at 10:07
  • 1
    In my version of textpad pressing down didn't select the whole column but in block select mode I could quickly select the column with shift-page down. Much quicker than alt-select on the mouse – dibs487 Jun 22 '16 at 09:23
4

In Ultra Edit and Crimson (or Emerald) Editor you can enable/disable the column mode with Alt + C

Tomas Narros
  • 13,390
  • 2
  • 40
  • 56
3

jEdit:

With the keyboard: press Alt-\ (Opt-\ in Mac OS X) to toggle between rectangular and normal selection mode; then use Shift plus arrow keys to extend selection. You can switch back to regular selection mode with another Alt-\ (Opt-\ in Mac OS X), if desired.

With the mouse: Either use Alt-\ (Opt-\ in Mac OS X) as above to toggle rectangular selection mode, then drag as usual; or Ctrl-drag (Cmd-drag in Mac OS X). You can switch back to regular selection mode with another Alt-\ (Opt-\ in Mac OS X), if desired.

Actually, you can even make a non-rectangular selection the normal way and then hit Alt-\ (Opt-\ in Mac OS X) to convert it into a rectangular one.

echristopherson
  • 6,974
  • 2
  • 21
  • 31
3

In MCEdit toggle Shift+F3 (ie F13) or F9->Edit ->Mark columns.

P.S. In this case, MCEdit is an editor written for the Midnight Commander.

Apostle
  • 482
  • 2
  • 7
  • 23
3

In Sublime3 (Windows):

Some users may get an inverted screen using the Ctrl+Alt+ in windows. To Solve this go to

Preferences->Key Bindings-User

And add these two lines at the end of the file just before closing brackets:

{ "keys": ["ctrl+alt+pageup"], "command": "select_lines", "args": {"forward": false} },

{ "keys": ["ctrl+alt+pagedown"], "command": "select_lines", "args": {"forward": true} } 

Or use your own keys.

Deepak Mahakale
  • 22,834
  • 10
  • 68
  • 88
Shashank
  • 31
  • 1
3

If you're using Nedit under Cygwin-X (or any platform for that matter), hold down the Ctrl key while selecting text with the left mouse.

Additionally, you can then drag the selected "box" around in an insert mode using the depressed left-mouse button or in overwrite mode by using Ctrl+left-mouse button.

morteza kavakebi
  • 1,640
  • 3
  • 18
  • 39
Dotdotlar
  • 31
  • 1
2

In Flash Builder (v 4.5 and up), and Aptana Studio (at least v 2.0.5) there is a toolbar button to toggle block select. It is between the 'mark occurrences' and 'show whitespace characters' buttons. There is also a Alt + Shift + A shortcut. Not surprisingly, this is basically the same as for Eclipse, but I'm including here for completeness.

morteza kavakebi
  • 1,640
  • 3
  • 18
  • 39
TornadoAli
  • 2,065
  • 2
  • 19
  • 13
2

With Nedit you can do several operations with selected column:

CTRL+LEFT-MOUSE -> Mark Rectangular Text-Area

MIDDLE-MOUSE pressed in area -> moving text area with pushing aside other text

CTRL+MIDDLE-MOUSE pressed in marked area -> moving text area with overriding aside text and deleting text from original position

CTRL+SHIFT+MIDDLE-MOUSE pressed in marked area -> copying text area with overriding aside text and keeping text from original position

0

For any editor, you can use the below shortcuts. These shortcuts work for every text area also.

Shift + UpArrow/DownArrow - this will select text line by line

Ctrl + Shift + LeftArrow/RightArrow - this will select text word by word

Ctrl + BackSpace - this will delete text word by word

Supun Sandaruwan
  • 1,814
  • 19
  • 19