问题
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++.
回答1:
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
回答2:
The Zeus editor can do keyboard driven column cut/copy and paste.
Also the default Zeus mouse marking is in column mode.
回答3:
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.
回答4:
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.
回答5:
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.
回答6:
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
回答7:
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.
回答8:
This can be done using JGSoft's Editpad which has a freeware lite version that is not crippled.
来源:https://stackoverflow.com/questions/1355025/editor-to-select-text-that-is-inside-a-rectangle