views:

464

answers:

7

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++.

+2  A: 

If you use Vim, ctrl-v will let you select a rectangular block of text.

You might have to disable Windows compatibility, otherwise ctrl-v will just paste.

Actually, the documentation says ctrl-q will let you do rectangular select in mswin compatibility.

Mark Rushakoff
+1  A: 

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

Will remove the first three characters from every line and print the result to STDOUT.

ire_and_curses
+2  A: 

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

Dan Blanchard
Alt-drag is the semi-standard shortcut across many editors that support block selection. IIRC that includes EmEditor, Notepad++ and TextPad.
bobince
+1  A: 

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.

dmckee
+1  A: 

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.

Peter Mortensen
+1  A: 

JEdit supports vertical selections (keyboard shortcut is Alt + \). It can also do multiple, non-continuous selections (keyboard shortcut is Ctrl + \). And when you type if 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.

http://www.jedit.org

Fish
A: 

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

Also the default Zeus mouse marking is in column mode.

jussij