20

In windows, I used to use a text editor called crimson editor which featured the best column-mode editing support I have yet to use.

When enabled via a simple Alt-C shortcut, selections could be made with the mouse or cursor keys and they would be visual blocks rather than wrapped-lines.

These selections could be deleted, moved, copied, pasted, and all of the operations just made sense. You could also just start typing, and you'd get a column of the characters as you're typing.

There are multiple ways of getting parts of the these features working separately discussed on this forum thread, but no one has yet to provide a solution that provides this all-encompassing and easy-to-use method.

If someone could point me to a gedit plugin where this work is actively being pursued, perhaps I could help with the coding myself. If someone is aware of a text editor that already provides this full functionality, I'd appreciate the info. Running crimson editor through wine and the close-but-not-quite multi-edit plugin for gedit are the temporary solutions I'm 'getting by with' for the time being.

UPDATE (2012-11): I'm now a very happy user of sublime text. It supports excellent column-mode editing and works on all three major OS platforms without any issue. Highly recommended!

1
  • If you are familiar with emacs, emacs provides column editing support via many modes but requires getting used to (aka learning curve). I can detail if it will answer your question.
    – koushik
    Oct 12, 2010 at 15:03

10 Answers 10

22

geany Install geany

is an integrated development environment that provides good column editing support which is worth checking out (an example here)

Simply put, press down Alt+Shift instead of just Shift while making selections to invoke column mode. One important limitation is that the edits in column mode are (as yet) not undo-able.

To achieve the same with the mouse, hold down Ctrl while selecting. This actually works with most Scintilla-based editors (including SciTE and Geany).

5
  • I'm trying Geany and working with the column selection is quite nice.. it's almost there. Do you know if I make a block selection with the mouse?
    – tamale
    Oct 12, 2010 at 15:14
  • 1
    Hold down Ctrl while selecting with the mouse. This actually works with most Scintilla-based editors (including SciTE and Geany).
    – JanC
    Oct 12, 2010 at 15:31
  • @JanC - Thanks for the input. I have updated my answer with this.
    – koushik
    Oct 12, 2010 at 16:24
  • SciTE is also available on both Windows and Ubuntu, which you may find useful if you work on both platforms. Oct 13, 2010 at 14:40
  • Works great on Fedora, too. I love geany!
    – hakre
    Apr 27, 2012 at 8:04
11

To edit columns, I use vi / gvim. It takes a bit of learning to get used to vi, but in the end many people find this to be their preferred editor.

Specifically within vi you can use CTRL V to highlight columns in visual mode, then you can edit it as you would expect. I use this all the time for adding and removing comments, or indenting functions i.e. CTRL V (highlight a column) SHIFT I # ESC will comment out that entire column.

6

You do use the Eclipse editor. Alt+Shift+A should do what you need.

5

nedit Install nedit Install via the software center

I use NEdit all the time.

To install it using the terminal, use the following command:

sudo apt-get install nedit

Old school (Motif) but has tabs and is lightweight and simple. Has context highlighting included for a number of coding languages, and more can be added. Pressing Ctrl while dragging with the mouse enables a block of text to be selected. Then you can copy/paste as usual. Couldn't do without this feature now.

2
  • Can you select a block using just the keyboard? Nov 18, 2013 at 15:46
  • Sure, with keyboard use Shift+Alt+arrows. I don't see column typing though (only column paste and indentation).
    – kubanczyk
    Apr 7, 2019 at 19:19
1

Use a gEdit with gmate and plugins. You'll get the TextMate of Linux.

sudo apt-get install gedit gedit-plugins
cd ~/Downloads
git clone http://github.com/gmate/gmate.git
cd gmate
sh ./install.sh

With this "slight" modification gEdit really rocks.

4
  • But... gmate provides block editing?
    – tutuca
    Oct 13, 2010 at 12:01
  • Ctrl+PgDn/PgUp let you select the rows at once for block editiing. Also you can Ctrl+Left click to select variables to edit them at once.
    – AndyB
    Oct 13, 2010 at 12:31
  • 1
    @AndyB, what is exactly the name of the plugin that must be activatited? These shortcut keys don't work after installing gmate. (I am using gedit 3.4.2)
    – alfC
    Oct 3, 2012 at 18:09
  • got gmate, but how to do column selection?
    – weima
    Sep 1, 2018 at 20:06
1

This is possible in emacs, and it's easy if you use the cua-mode. C-return marks the upper left of the rectangle. Then move the cursor to highlight the rectangular region.

The emacs column mode features are really cool. They go far beyond just copy/paste of rectangular text. Check out the video for a demo of how to simultaneously edit all the lines in the column! Very handy!

If you don't want to watch the video (or can't) here are the bare basics:

CUA-mode's superior rectangle support is based on using a true visual representation of the selected rectangle. To start a rectangle, use [S-return] and extend it using the normal movement keys (up, down, left, right, home, end, C-home, C-end). Once the rectangle has the desired size, you can cut or copy it using C-x and C-c, and you can subsequently insert it - as a rectangle - using C-v. So the only new command you need to know to work with CUA-mode rectangles is S-return!

On Kubuntu 12.04 and emacs v24, [S-return] is CONTROL-RETURN (CTRL-ENTER) for me.

As already mentioned, Scite has this built-in (no plug-ins needed). It's very easy to use. And Scite is in the Ubuntu repos.

Rectangular blocks of text can be selected in SciTE by holding down the Alt key on Windows or the Ctrl key on GTK+ while dragging the mouse over the text.

1

Also Notepadqq can do this: they briefly present the feature in their page. Hold down Alt, then hold Ctrl or Shift, and select the "columns" you want by dragging (or also clicking, if you are holding Ctrl) with the mouse. Release the buttons when you are done selecting columns, and start editing by typing, using arrow keys, copy-paste (a mouse click will cancel the multi-selection).

The points you select don't need to form a real column, it's an arbitrary number of cursors active at same time. When you copy-paste, the text is pasted cursor-by-cursor if the number of copied and pasted ones matches, otherwise every target cursor gets a full copy of the input.

Little nuisances: you can't de-select single cursors while keeping the others, and you can't use the keyboard to select them (or at least, I don't know how to).

1

Yes, you can achieve it with the Gedit plugin multi edit. This blog post explains it.

  1. Run sudo apt install gedit-plugin-multi-edit
  2. Press Ctrl + Shift + C to enter Multi-Edit Mode. It will reflect in upper right corner.
  3. Make the desired selection, and hit Enter. Boom!, it's gone now, then you can edit multiple rows but in column mode.

Bonus: Use Ctrl + E, when in Multi-Edit Mode and click at various points (which you want to edit at same time). this way you can edit multiple lines based on words.

0

Paste this commands in terminal

sudo sed -i.backup -r '/^#\s?deb\s?(http|ftp|-src).*(partner|multiverse|universe)/s/^#\s?//g' /etc/apt/sources.list

sudo apt-get update

sudo apt-get -y vim-gnome vim-doc

vim yourfile

In vim use:

ctrl-v ....... to select in mode column
j ............ to down 

see:

 :help
0

KWrite, Kate and KDevelop also support this. It's a bit different in them in that column edit mode works not via modifier keys, but as a mode that you turn on and off. These three programs have different feature level but are based on the same editor component.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .