How to select column in editors(Notepad++, Kate, vim, Netbeans, Eclipse, ...) ? for delete or insert or replace some characters.
views:
3736answers:
7- Notepad++, Visual Studio, and some others: Alt + drag.
- vim: Ctrl + v or (bizarrely enough) Quad-click-drag.
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.
Netbeans doesn't do it natively, but there are plugins:
Netbeans rectangular edit tool
Eclipse 3.5 has it natively, prior to that there are plugins
Eclipse used to need a column mode plugin to be able to select a rectangular selection.
Since eclipse3.5, you just need to type Alt+Shift+A: see its News and Noteworthy section.
This feature is not available in Netbeans latests versions and the plugin is not supported anymore.