28

I often need to select a block of text, like a leading character that occurs on many lines. LibreOffice has block selection. How can I do this in Geany?

For example, I want to remove the pipe and the space at the beginning of each line:

| Create another 'Login Role' for the 'auth' user:
| Role name: auth
| Password: auth
| Role privileges: Create database objects
caduceus
  • 1,542
  • 2
  • 16
  • 21
  • Alt + Shift + (Drag Mouse). – tod Nov 30 '14 at 14:03
  • @tod: It can be done [without the mouse](https://pmortensen.eu/world2/2020/12/31/block-column-mode-in-text-editors-geany-visual-studio-ultraedit-notepad-and-visual-studio-code-and-vim/): Shift + Alt + arrow keys – Peter Mortensen Nov 07 '22 at 13:07

6 Answers6

22

It's called "column mode editing". Look here:

Column mode editing (rectangular selections)

There is basic support for column mode editing. To use it, create a rectangular selection by holding down the Control and Shift keys (or Alt and Shift on Windows) while selecting some text. Once a rectangular selection exists you can start editing the text within this selection and the modifications will be done for every line in the selection.

It is also possible to create a zero-column selection - this is useful to insert text on multiple lines.


Peter Mortensen has documented how to configure this on Lubuntu (for LXQt):

https://pmortensen.eu/world2/2020/03/29/using-geany/#Column_mode_blues

On Lubuntu, the keyboard shortcuts for selecting a rectangular area of text (“column mode” in UltraEdit) do not work, because they conflict with four default keyboard shortcuts in the window manager (LXDE? Openbox?), Shift + Alt + arrow up, Shift + Alt + arrow down, Shift + Alt + arrow left, and Shift + Alt + arrow right.

Disable the window manager keyboard shortcuts by editing file ~/.config/openbox/lubuntu-rc.xml near “S-A-Up”, “S-A-Down”, “S-A-Left”, and “S-A-Right”. For example, change “S-A-Up” to “S-A-Up99”, “S-A-Down” to “S-A-Down99”, “S-A-Left” to “S-A-Left99”, and “S-A-Right” to “S-A-Right99”, respectively. And add an XML comment as to why and document the original values (so they can more easily be reverted). Edit and update (without a restart required):

vi ~/.config/openbox/lubuntu-rc.xml
openbox --reconfigure

It was tested with Lubuntu 18.04 (32 bit).

paulsm4
  • 114,292
  • 17
  • 138
  • 190
  • 1
    I have documented how to do [the configuration changes for Lubuntu](https://pmortensen.eu/world2/2020/03/29/using-geany/#Column_mode_blues) (for [LXQt](https://en.wikipedia.org/wiki/LXQt)). – Peter Mortensen Nov 07 '22 at 12:58
11

In Debian the following works for me: press only the Ctrl key and select by the mouse (not both Ctrl and Shift keys, as described in the manual).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
6

In Ubuntu MATE (Geany 1.25) I can use Shift + Alt and then mark the text using arrow keys.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Niels
  • 61
  • 1
  • 3
4

I think, Ctrl + Shift + mouse(!). It's working correct on Ubuntu with Geany 1.23.1. Please use the mouse, not the arrow keys.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ralf
  • 41
  • 1
3

Ctrl + Shift + Mouse on CentOS 7.3.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
badbishop
  • 1,281
  • 2
  • 18
  • 38
0

For me the key shortcuts are different. After installing the Extra Selection Geany plugin, I can use:

Alt + Shift + C (and then use the up, down, etc. arrow keys to move the cursor; edit the text; and then repeat Alt + Shift + C to go back to 'normal' edit mode).

More information is here.

(I use VirtualBox with Xubuntu 16.04.4 LTS (Windows 10 host).)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
JonyD
  • 1,237
  • 3
  • 21
  • 34