views:

3736

answers:

7

How to select column in editors(Notepad++, Kate, vim, Netbeans, Eclipse, ...) ? for delete or insert or replace some characters.

+11  A: 

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

Yacoby
Thanks for the edit :D
Yacoby
The Windows version uses Ctrl + Q since Ctrl + V is the standard paste clipboard command.
Andrew Cowenhoven
@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
+11  A: 
  • Notepad++, Visual Studio, and some others: Alt + drag.
  • vim: Ctrl + v or (bizarrely enough) Quad-click-drag.
Alex
+6  A: 

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
+4  A: 

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

Simon Scarfe
+11  A: 

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

alt text

Since eclipse3.5, you just need to type Alt+Shift+A: see its News and Noteworthy section.

alt text

VonC
+4  A: 

In Kate toggle Ctrl + shift + B .

SjB
+3  A: 

This feature is not available in Netbeans latests versions and the plugin is not supported anymore.

DrDro