Editor to select text that is inside a rectangle
Asked Answered
H

9

12

Often I find myself with some text where I want to exclude a certain part of the text, say the first three characters of 40 lines. The fastest way I could think of to do this would be to draw a rectangle and copy the text. I am mostly using Windows, but I am sure grep or something similar could do this with a tiny bit of code. My best way of doing this is to open Command Prompt. Then run "Edit" (yes the good old one). Then paste the text in there (this actually takes a significant amount of time). Then I am able to select the rectangle I am after.

Is there any other editors that support this feature? I am familiar with Notepad++.

Homestead answered 30/8, 2009 at 22:0 Comment(2)
What do you mean by "draw a rectangle"?Camarena
I wrote a blog post about this, covering Geany, Visual Studio, UltraEdit, Notepad++, Visual Studio Code, and Vim.Camarena
L
8

You can select a rectangular area to cut/copy in Visual Studio be pressing the Alt key prior to making your selection with the mouse or (Shift +) cursor keys. See How to: Select and Change Text.

Lifework answered 30/8, 2009 at 22:18 Comment(2)
Alt-drag is the semi-standard shortcut across many editors that support block selection. IIRC that includes EmEditor, Notepad++ and TextPad.Athletics
I just utilized Alt-drag and saved a LOT of time! Thanks!Homestead
B
4

The Zeus editor can do keyboard driven column cut/copy and paste.

Also the default Zeus mouse marking is in column mode.

Bernete answered 31/8, 2009 at 2:21 Comment(0)
S
3

If you use Vim, Ctrl + V will let you select a rectangular block of text.

The documentation says Ctrl + Q will let you do a rectangular select in mswin compatibility.

Spiller answered 30/8, 2009 at 22:3 Comment(2)
What is "mswin compatibility"? Name of a mode in Vim? Or do you mean "Microsoft Windows compatibility"? Or something else?Camarena
The link is effectively broken. It redirects to https://www.vim.org/htmldoc.php/gui_w32.html#gui-clipboard, which doesn't contain any useful information.Camarena
F
1

You can do this with NEdit (which is available for Windows). Hold down Ctrl and drag the mouse (left-click) to select rectangles.

In Linux, you could also just use cut:

cut -b4- file

It will remove the first three characters from every line and print the result to standard output.

Fraser answered 30/8, 2009 at 22:4 Comment(3)
Geany too, relatively cross-platform.Stott
Are you sure NEdit is available for Windows? I can only find statements like "for most popular Unix systems".Camarena
@PeterMortensen - it definitely used to be possible. Looks like it's not officially supported in Win 10. Some discussion here: sourceforge.net/p/nedit/discussion/34507/thread/fe9d6dbec9Fraser
A
1

Emacs supports kill-rectangle (bound to C-x r k by default) and yank-rectagle (C-x r y) to achieve this. Also of possible interest is delete-extract-rectangle (no default binding, and intended for programming use).

You use it by navigating to one corner of the interesting area, hitting C-<space> to set the mark, navigating to the opposite corner, and invoking the desired function.

Affectionate answered 30/8, 2009 at 22:40 Comment(0)
C
1

UltraEdit has a column mode (menu Column/Column Mode, keyboard shortcut Alt + C). This makes it possible to make block selections, delete, insert column-wise, etc. using only the keyboard (the mouse works too).

For your example: make a zero width selection at column position 1 for the 40 lines and press Delete three times. Or simply make the 3 x 40 block select and press Delete.

Camarena answered 30/8, 2009 at 22:50 Comment(0)
M
1

jEdit supports vertical selections (keyboard shortcut is Alt + \). It can also do multiple, non-continuous selections (keyboard shortcut is Ctrl + \). And when you type it affects all selections, so you can edit multiple lines at the same time, or the same line in more than place simultaneously. Or both.

Vertical pasting is also supported. This is a feature I use all the time. It makes editing columns a breeze.

If you have too many lines to select easily, then jEdit's Find And Replace is as good as it gets.

jEdit is a Java application, and so uses more system resources than most editors. But on the other hand it works on most systems, and it has loads of plug-ins to make editing text more efficient.

Marissamarist answered 30/8, 2009 at 23:14 Comment(0)
C
1

This can be done using JGSoft's Editpad which has a freeware lite version that is not crippled.

Cur answered 30/9, 2013 at 11:20 Comment(0)
D
0

In IntelliJ, go to Edit and then click on Column Selection Mode. Or use the ALT+SHIFT+INSERT shortcut.

Diminution answered 17/11, 2021 at 17:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.