20

I'm looking for a gratis text editor for Linux that supports column manipulations/selection like the Notepad++ text editor for Windows allows.

Specifically, I want to be able to:

  1. Quickly and easily select a rectangle of text, even if that means going beyond EOL (End Of Line) for one or more lines.
  2. Delete the entire rectangular selection.
  3. Insert or delete characters at any column position.

The application must be a full GUI text editor, not a CLI line editor or text processor.

6
  • 10
    Visual Studio Code? Commented Feb 21, 2023 at 20:46
  • @ThomasWeller I don't know... but I do shudder at the thought of defiling the sanctity of Linux with Microsoft. And doesn't it require Google code too? Just the thought is making me feel dirty... and not in a good way. ;) Commented Feb 21, 2023 at 21:02
  • 3
    @RockPaperLz-MaskitorCasket VSCode is likely your best bet by far, if you don't want the closed source version, VSCodium is fully built from the FOSS base of VSCode and apart from the extension library (MS restricted it to MS branded products) this is the same editor (or you can build it yourself) Commented Feb 23, 2023 at 9:09
  • @NicolasFormichella (and Thomas, of course, as always) Thank you for the recommendation, and for pointing out VSCodium specifically. Although I do sincerely appreciate your words, comments aren't the best place for answers. Would you mind posting your recommendation as an answer? You wrote that "VSCode is likely your best bet by far"; those are strong words, and I'm hoping in your answer you can expand on them. Commented Feb 23, 2023 at 16:32
  • 6
    @RockPaperLz-MaskitorCasket The Microsoft of today is vastly different from the Microsoft of old. Visual studio code is a really nice editor. Commented Feb 23, 2023 at 22:13

12 Answers 12

16

Geany is based on Scintilla like Notepad++.

By holding down the Control and Shift keys.

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. Source : https://www.geany.org/manual/current/index.html#column-mode-editing-rectangular-selections

There are packages for many distributions (Debian, Ubuntu, Fedora, Arch, etc.). You can also install from source : https://www.geany.org/download/releases/

Geany is cross-platform and is available for Linux, macOS, and Windows. The Windows port is the only version that is missing some features.

4
  • Geany looks very good. Thank you. I'm researching it now. Cross-platform is always a nice plus, and it appears that the Windows port is missing some features. Do you happen to know if there is a list of what is different across platforms? If not, no problem... I'm still looking around for that info. Commented Feb 22, 2023 at 1:42
  • 2
    Geany is my main IDE on Linux. I didn't find a recent list for differences across platforms. Only for the old win32 version : wiki.geany.org/howtos/win32/running
    – Gounou
    Commented Feb 22, 2023 at 3:46
  • Thanks for the update and the fact that you are so confident in Geany that you use it as your main IDE on Linux. I noticed that you added Kate. This appears to be a completely different editor than Geany, no? If so, can you please make it a separate answer? Thanks again! Commented Feb 23, 2023 at 16:25
  • I also use Geany as my main IDE on Linux. If you're comfortable with Notepad++ (or, my preferred Scintilla-based editor on Windows: Programmer's Notepad), you'll be more than happy with Geany on Linux. There is not, in my opinion, any real advantage to using Geany on Windows just because you use it on Linux. Because they're all Scintilla-based editors, all that the applications provide is the window dressing, and I prefer that that be as platform-native as possible. The best way to accomplish that is to choose an app written with your current platform in mind.
    – Cody Gray
    Commented Feb 25, 2023 at 9:14
13

Vim does rectangular selection out of the box. GUI vim is available in repositories of many distros (e.g. gvim in Ubuntu and Arch).

In vim language, this operation is called 'visual block selection' and is started by pressing Ctrl-V, then the block can be selected by cursor motions. To go beyond EOL, one has to explicitly :set virtualedit=block.

When the selection is done, x or d deletes. It is possible to replace the selection with whitespace by r (r and then Space).

Text can be appended after visual selection by hitting A (or prepended before it by I).

1
  • 1
    Another useful actions to do with the block are yank (copy) y, put (paste) p, and put before cursor P. And don't forget that x and d don't only delete text, but also put it into the default yank register (it's more similar to the cut action in most other GUI editors than to delete).
    – Ruslan
    Commented Feb 23, 2023 at 20:38
13

Emacs, of course. The concept is called rectangles and works cursor-based, similar to normal marks (you never required mouse involvement!).

So the idea is that you mark a region as usual (C-SPC and then move the cursor). Through that, you define a rectangle between the current point and the mark. On that rectangle you can operate with several rectangle commands, all prefixed with C-x r:

  • "Delete": C-x r k kills the rectangle. You can yank it with C-x r y.
  • Operate on the text: C-x r t replaces the contents of the rectangle with a string.

Additionally to using normal marks to select a rectangle region, you can use M-x rectangle-mark-mode for direct selection, by default bound to C-x SPC. With this, you can also easily select rectangles where the mark would have to go behind the ends of lines.

In addition, there is the multiple-cursors package, which, in a way, generalizes the concept of rectangles -- you can edit at multiple places at once.

6
  • 2
    Thank you for the recommendation. I added what I consider to be the canonical link for Emacs. If you disagree, please do let me know and edit for all to benefit! Commented Feb 22, 2023 at 15:56
  • 2
    I must say that I love the "of course" interjection you included. It's the mildly smart-ass attitude of the Linux userbase that I do love and appreciate (probably a better term, but it's the best I can think of right now). People's love of Emacs reminds me of my love of edlin. Of course, Emacs is far superior, but I guess Uncle Bill didn't know about it or something, so we were stuck with edlin. Commented Feb 22, 2023 at 16:03
  • 2
    I actually hesitated to write that, but it seems the exactly right tone has been conveyed :P Commented Feb 23, 2023 at 7:28
  • 1
    @RockPaperLz-MaskitorCasket: I read that "of course" as not so much the attitude of the Linux user-base, more about what Emacs is like. If anything is possible anywhere, someone will probably have implemented it in Emacs. And in this case it's part of a default install with keybindings enabled out of the box for at least kill/yank and replace. Emacs is widely known as being jam-packed full of every useful and obscure functionality people have added over the years (feature creep). explainxkcd.com/wiki/index.php/378:_Real_Programmers captures this nicely. Commented Feb 23, 2023 at 20:57
  • 1
    Of course emacs was the first thing which came to also to my mind. Stopped reading at "editor that supports".....
    – Sascha
    Commented Feb 25, 2023 at 10:36
10

CudaText is a free and open source GUI text editor, in the same vein of SublimeText that runs on Linux, macOS, *BSD, Solaris, and Windows.

It has column selections you can access by pressing Alt key plus dragging over text. It can edit with multiple carets and do insertions or deletions at any point in multiple lines.

CudaText column-mode example screenshot

3
  • 1
    CudaText looks excellent, and the screenshot you provided is exactly the functionality I want (plus, now I'm hungry). Thank you. Commented Feb 22, 2023 at 1:35
  • 1
    Alt didn't work for me. CudaText wiki says it should be Shift+Alt+click, which does work.
    – Alex
    Commented Feb 23, 2023 at 20:16
  • I tested under Windows which is working with the Alt key. Under Linux they might be using a different key combination to avoid potential conflict with some window managers that use Alt drag to move OS windows, I think Commented Feb 23, 2023 at 22:13
4

You can use this Snap to install Notepad++.

There is also open source reimplementation of Notepad++ called Notepad Next

1
  • 2
    Welcome Cagurtay! Thank you for your post. You really have 2 different answers here, and they could both use a little love. Can you please separate them into 2 separate answers, and provide more details and hopefully personal experiences about each? Thanks so much, and again, welcome! Commented Feb 23, 2023 at 16:54
4

At the risk of stating the obvious, Notepad++ is an option. Though it doesn't seem to be an officially supported platform, Notepad++ is widely used on Wine, and issues that prevent it from working get fixed, as far as I can tell.

3

jEdit is cross-platform; that's why I started to use it. It's released under GPL 2.0.

"Rectangle select" mode can be found on the Edit menu, or with <alt>+\

As with other editors listed in other answers, making a rectangular selection, even of zero width, then typing, inserts the typed text on every line in the selection.

3
  • 1
    While I'd used rectangular selections in jEdit before, I didn't know about using them for insertions until writing this answer.
    – Chris H
    Commented Feb 22, 2023 at 13:55
  • Thanks for the recommendation. It's interesting that the author mentions it is compatible with Unix (amongst other OS) but doesn't specifically mention Linux compatibility by name. About 20+ years ago you would see that quite a bit, but I haven't seen that recently. Commented Feb 22, 2023 at 15:52
  • @RockPaperLz-MaskitorCasket I see the FAQ was started in 2001, and compatibility with OS/2 is also mentioned. It must have been around for a while!
    – Chris H
    Commented Feb 22, 2023 at 16:55
3

Sublime Text is a cross-platform good text editor with lots of functionalities as well, including column selection and edit.

I've used it in both Windows and Fedora quite fine. Although it has "non-obligatory" (winzip-like) paid license for continuous use, it's free for evaluating.

2

Kate

In Kate toggle Ctrl + Shift + B

To go back to the default selection mode you have to press Ctrl + Shift + B again.

Source : How to Select Columns in Editors (Atom,Notepad++, Kate, VIM, Sublime, Textpad,etc) and IDEs (NetBeans, IntelliJ IDEA, Eclipse, Visual Studio, etc) [closed]

Multi-cursor editing

1

I'll also say UltraEdit, but it's commercial.

1

NEdit (and nedit-nc) can do this. It has been my primary Unix/Linux editor since back in the SunOS/HPUX days. It has been around for a very long time (EDIT: since 1992 according to Wikipedia) , it is available in all package managers as far as I know. Hold ctrl while dragging the mouse cursor to select a block CTRL-C to copy the block CTRL-R to find/replace within the block CTRL-V to paste the block as text (not column) so it will be inserted at the cursor CTRL-SHIFT-V to paste as a block. You can paste any text as a block, also text that was selected in the normal way. Short lines are automatically padded with spaces to make the output a block.

You can type within the block although it is not as advanced as Kate.

1

There is one I used to use called Notepadqq, it is free/opensource. It is designed to look exactly like Notepad++. I don't know features wise, but it is pretty good.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.