{"id":333,"date":"2020-03-29T15:34:25","date_gmt":"2020-03-29T14:34:25","guid":{"rendered":"https:\/\/pmortensen.eu\/world2\/?p=333"},"modified":"2025-12-06T18:31:10","modified_gmt":"2025-12-06T17:31:10","slug":"using-geany","status":"publish","type":"post","link":"https:\/\/pmortensen.eu\/world2\/2020\/03\/29\/using-geany\/","title":{"rendered":"Using Geany as a replacement for UltraEdit"},"content":{"rendered":"<p><!- Marker for editing in WordPress: aaaa \n    The end is marked with four 'p's...\n--><\/p>\n<p><!- Future: phase out (or make notes): \"Mini-Script\"\n--><\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/UltraEdit\">UltraEdit<\/a> for Linux is extremely buggy and corrupts the text documents. The corruption happens with using <em>column mode<\/em>, possibly worsened by using split windows (I mostly use vertically split). Column mode has always been buggy in UltraEdit, but in the Linux version it is extreme.<\/p>\n<p>Also, it doesn&#8217;t like emojis at all (coming from, say, copy-pasting from a Twitter profile) and will simply delete all text (or corrupt text, crash, or freeze) if an emoji character is deleted&#8230; (there is no way in UltraEdit for Linux to remove emoji characters without also losing content).<\/p>\n<p>UltraEdit for Linux also lacks behind the Windows version (as of early 2020 at version 18, 2018). Note that I am a veteran user of UltraEdit (since 1998), and it works fine on Windows (except for occasional problems with column mode).<\/p>\n<p>UltraEdit for Linux version 20 was released 2020-06-26. I haven&#8217;t had a chance yet to review it, in particular if the bugs have been fixed.<\/p>\n<p>An alternative is <a href=\"https:\/\/en.wikipedia.org\/wiki\/Geany\">Geany<\/a>, and it is similar to <a href=\"https:\/\/en.wikipedia.org\/wiki\/Notepad%2B%2B\">Notepad++<\/a> on Windows. But Geany is not nearly as clunky as Notepad++.<\/p>\n<p>This blog post is intended to be step-by-step instructions for quickly getting up and running with Geany on a new system, in particular such that it works similar to UltraEdit (especially the keyboard shortcuts). It also covers missing features in Geany. Though the focus is on Linux, the instructions also cover Windows.<\/p>\n<h2>Installation<\/h2>\n<h3><a href=\"https:\/\/en.wikipedia.org\/wiki\/Ubuntu_%28operating_system%29\">Ubuntu<\/a>\/<a href=\"https:\/\/en.wikipedia.org\/wiki\/Debian\">Debian<\/a>, from the terminal<\/h3>\n<p><code>sudo apt-get update<br \/>\nsudo apt install geany<\/code><\/p>\n<p>For Windows, <a href=\"https:\/\/geany.org\/download\/releases\/\">use the EXE installer<\/a>. Note that in order to use the English version of Geany on a non-English version of Windows, <a href=\"https:\/\/www.geany.org\/documentation\/faq\/#how-can-i-change-the-language-of-the-user-interface\">the environment variable &#8220;LANG&#8221; must be set to &#8220;en&#8221;<\/a> (at least in versions prior to 2.0). As this may affect other things, the easiest is to make a BAT file that sets the environment variable and launches Geany (so the change is only for Geany).<\/p>\n<h3><a href=\"https:\/\/en.wikipedia.org\/wiki\/Arch_Linux\">Arch Linux<\/a>, e.g. <a href=\"https:\/\/pmortensen.eu\/world2\/2023\/03\/13\/arcolinux-23-02-installation-blues\/\">ArcoLinux<\/a>, from the terminal<\/h3>\n<p><!-- \"-Syy\" is force (saying yes to everything) \nSee e.g. <https:\/\/wiki.archlinux.org\/title\/Pacman_Rosetta>\n\n\"-Syu\": See near \"just run pacman -Syu every single time\" in <https:\/\/www.reddit.com\/r\/archlinux\/comments\/5111je\/pacman_sy_vs_syu\/>.\n--><\/p>\n<p><code>sudo pacman -Syu<br \/>\npacman -S geany<\/code><\/p>\n<h3>Some basic plugins<\/h3>\n<p>To get <a href=\"https:\/\/plugins.geany.org\/addons.html#copy-file-path\">a menu item for copying the <strong><em>full path<\/em><\/strong> of the current document to the clipboard<\/a>, install the plugin with the overly generic (meaningless) name <a href=\"https:\/\/plugins.geany.org\/addons.html\">&#8220;Addons&#8221;<\/a>. The following is for Ubuntu\/Debian from the command line.<\/p>\n<p>First list the available plugins:<\/p>\n<p><code>lsb_release -a # List Ubuntu version<br \/>\napt-cache search geany<\/code><\/p>\n<p>Note that some plugins are not available in later versions of Ubuntu. For example, the Geany plugin <a href=\"https:\/\/plugins.geany.org\/debugger.html\">&#8220;Debugger&#8221;<\/a> is available in Ubuntu <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ubuntu_version_history#Ubuntu_16.04_LTS_.28Xenial_Xerus.29\">Ubuntu&nbsp;16.04<\/a> (Xenial Xerus), but not in <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ubuntu_version_history#Ubuntu_19.10_(Eoan_Ermine)\">Ubuntu&nbsp;19.10<\/a> (Eoan Ermine) (on Ubuntu&nbsp;16.04, the output includes &#8220;geany-plugin-debugger &#8211; debugger plugin for Geany&#8221;).<\/p>\n<p>It should include:<\/p>\n<p><code>geany-plugin-addons - miscellaneous plugins for Geany<\/code><\/p>\n<p>Install &#8220;Addons&#8221;, using the exact name from above:<\/p>\n<p><code>sudo apt install geany-plugin-addons<\/code><\/p>\n<p>For Fedora:<\/p>\n<p><code>dnf search geany<\/code><\/p>\n<p>For Windows and <a href=\"https:\/\/en.wikipedia.org\/wiki\/Arch_Linux\">Arch Linux<\/a> (e.g., <a href=\"https:\/\/pmortensen.eu\/world2\/2023\/03\/13\/arcolinux-23-02-installation-blues\/\">ArcoLinux<\/a>) all plugins are installed at once. A number of plugins are installed, including &#8220;Addons&#8221;.<\/p>\n<p>Arch Linux, from the terminal:<\/p>\n<p><!-- \"-Syy\" is force (saying yes to everything) \nSee e.g. <https:\/\/wiki.archlinux.org\/title\/Pacman_Rosetta>\n--><\/p>\n<p><code>pacman -S geany-plugins<\/code><\/p>\n<p>For Windows, <a href=\"https:\/\/plugins.geany.org\/downloads.html\">use the EXE plugin installer<\/a>. <\/p>\n<p>Enable the plugin &#8220;Addons&#8221; in the Plugin Manager, menu <em>Tools<\/em> &rarr; Plugin Manager. Note that at the very first invocation, it may take some time, as it needs to do some initialisation. After this, there is a new menu command, menu <em>Tools<\/em> &rarr; <em>Copy File Path<\/em>. Note that it is available immediately; there isn&#8217;t any need to restart Geany.<\/p>\n<h2 id=\"theme\">Change theme, e.g., to a dark mode one<\/h2>\n<p>Similar to UltraEdit, it is possible to use dark mode. It is, however, not enabled by default in most versions of Geany &#8211; extra files must be added to the installation (it <em>is<\/em> enabled with Geany 1.37.1 on Windows, but not in Geany 1.38 on Linux). <\/p>\n<p><a href=\"https:\/\/github.com\/geany\/geany-themes\/archive\/master.zip\">Download a set of themes<\/a> <a href=\"https:\/\/github.com\/geany\/geany-themes\/\">from GitHub<\/a>, uncompress the ZIP file, and copy the content of folder <em>&#8220;colorschemes&#8221;<\/em> to folder <em>~\/.config\/geany\/colorschemes<\/em> (about 35 files. In later versions, it is closer to 50 files). On Windows, copy to folder <em>%ProgramFiles(x86)%\/geany\/colorschemes<\/em> (e.g., <em>C:\\Program Files (x86)\\Geany\\data\\colorschemes<\/em>).<\/p>\n<p><strong><em>Note<\/em><\/strong>: Folder <em>~\/.config\/geany\/colorschemes<\/em> isn&#8217;t created until menu item <em>View<\/em> &rarr; <em>Change Color Scheme<\/em> is chosen&#8230; Thus, before copying, open that dialog and close it again.<\/p>\n<p>Change the theme: menu <em>View<\/em> &rarr; <em>Change Colour Scheme&#8230;<\/em> &rarr; choose <em>&#8220;Delt Dark&#8221;<\/em> &rarr; press <em>&#8220;Close&#8221;<\/em>.<\/p>\n<p>Alternative dark themes are: &#8220;Himbeere&#8221;, &#8220;InkPot&#8221;, &#8220;Kugel&#8221;, &#8220;Relesk&#8217;s MC&#8221; (darkblue background), &#8220;Monokai&#8221;, &#8220;Oblivion 2&#8221;, &#8220;Railcasts 2&#8221;, &#8220;Retro&#8221; (green text), &#8220;Sleepy Pastel&#8221;, <strong><em>&#8220;Solarized (dark)&#8221;<\/em><\/strong>, &#8220;Spyder Dark&#8221;, &#8220;Steampunk&#8221;, &#8220;Tango&#8221;, &#8220;Tinge&#8221;, &#8220;Vibrant&#8221;, and &#8220;Zenburn&#8221;. <\/p>\n<p>&#8220;Vibrant&#8221; is probably the closest to the UltraEdit one.<\/p>\n<h2>Open .txt files with Geany by default<\/h2>\n<p>In Ubuntu, .txt files open in the extremely irritating &#8220;Text Editor&#8221; (<em><a href=\"https:\/\/en.wikipedia.org\/wiki\/Gedit\">gedit<\/a><\/em> <a href=\"https:\/\/help.ubuntu.com\/community\/gedit\">in disguise<\/a>) Why did they have to change how <kbd>Ctrl<\/kbd> + <kbd>F<\/kbd> works??. <\/p>\n<p>Right click on some .txt file in a <em>&#8220;Files&#8221;<\/em> window (or <kbd>Ctrl<\/kbd> + <kbd>I<\/kbd>) and choose <em>&#8220;Properties&#8221;<\/em>. In tab <em>&#8220;Open With&#8221;<\/em> (the last one), find &#8220;Geany&#8221; in one of the three lists, select it and press <em>&#8220;Set as default&#8221;<\/em>. Close the dialog. Note: In <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ubuntu_version_history#Ubuntu_24.04_LTS_(Noble_Numbat)\">Ubuntu&nbsp;24.04<\/a> (Noble Numbat), <em>&#8220;Open With&#8221;<\/em> is directly in the context menu and it is <em>&#8220;Always use for this file type&#8221;<\/em> instead of <em>&#8220;Set as default&#8221;<\/em>.<\/p>\n<h2>Turn off various non-text panels<\/h2>\n<p>Menu <em>View<\/em> &rarr; <em>Show Message Window<\/em>, to not checked.<br \/>\nMenu <em>View<\/em> &rarr; <em>Show Toolbar<\/em>, to not checked.<br \/>\nMenu <em>View<\/em> &rarr; <em>Show Sidebar<\/em>, to not checked.<\/p>\n<h2>Set font size<\/h2>\n<p>Menu <em>View<\/em> &rarr; <\/em>Change Font&#8230;<\/em>, to 18. The font, &#8220;Monospace Regular&#8221;, is OK (&#8220;Monospace Normal&#8221; on Windows).<\/p>\n<p>Note that there is a separate zoom level. It works in the same way as in a web browser (e.g., <kbd>Ctrl<\/kbd> + <kbd>+<\/kbd> to zoom in).<\/p>\n<h2 id=\"TABs_are_evil\">Turn off everything with TABs<\/h2>\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=NPB34lDZj3E&#038;t=8m57s\">No more TABs<\/a>! They are evil.<\/p>\n<p>Menu <em>Edit<\/em> &rarr; <em>Preferences<\/em> &rarr; <em>Editor<\/em> &rarr; tab <em>Indentation<\/em> &rarr; <em>Type<\/em>. Set to &#8220;Spaces&#8221;.<\/p>\n<p>Menu <em>Edit<\/em> &rarr; <em>Preferences<\/em> &rarr; <em>Editor<\/em> &rarr; tab<em> Indentation<\/em> &rarr; <em>Tab key indents<\/em> (at the bottom). Check it.<\/p>\n<p>Note 1: In some versions of Geany, this setting is remembered per document. To retrospectively change it, do menu command <em>Project<\/em> &rarr; <em>Apply Default Indentation<\/em>. This will not replace existing TABs, but any further actions with the TAB key will work as expected.<\/p>\n<p>Note 2: TABs can still be inserted into a document using menu <em>Edit<\/em> &rarr; <em>Insert Alternative Whitespace<\/em>, just no longer with the TAB key.<\/p>\n<p>Note 3: It works only for documents opened after this change (not current ones), so the easiest way is probably to restart Geany.<\/p>\n<p>Note 4: It is not entirely clear what is up with setting &#8220;Tab key indents&#8221;. It seems to have no effect in some versions of Geany (perhaps its effective setting is automatically checked if &#8220;Type&#8221; = &#8220;Spaces&#8221;?). Its meaning may even have been inverted at some point&#8230; If it doesn&#8217;t work as intended, try both unchecking and checking this setting. It is safest to restart Geany after changing the setting.<\/p>\n<h2>Number of files in the list of recently opened files<\/h2>\n<p>Menu <em>Edit<\/em> &rarr; <em>Preferences<\/em> &rarr; tab <em>Files<\/em> &rarr; section <em>Miscellaneous<\/em> &rarr; <em>Recent files list length<\/em>. Change it from 10 to 50.<\/p>\n<h2>Changing keyboard shortcuts to the same as in UltraEdit<\/h2>\n<p>So they are the same as in UltraEdit. This is also important for using a macro keyboard (no need for duplication).<\/p>\n<p>The keyboard shortcuts are changed in menu <em>Edit<\/em> &rarr; <em>Preferences<\/em> (which itself has keyboard shortcut <kbd>Ctrl<\/kbd> + <kbd>Alt<\/kbd> + <kbd>P<\/kbd> &#8211; but it conflicts with the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cinnamon_(desktop_environment)\">Cinnamon<\/a> applet &#8220;Color Picker&#8221;&#8230;) &rarr; <em>Keybindings<\/em>  <\/p>\n<div id=\"Close_document\"><\/div>\n<h3>Close document (Ctrl + F4)<\/h3>\n<p>E.g., so a macro keyboard works the same. Note: Ctrl + F4 appears as &#8220;&lt;Primary>F4&#8221; in Geany.<\/p>\n<p>If the window manager is <a href=\"https:\/\/en.wikipedia.org\/wiki\/Xfce\">Xfce<\/a> (e.g., using <a href=\"https:\/\/en.wikipedia.org\/wiki\/MX_Linux\">MX Linux<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Xubuntu\">Xubuntu<\/a>, or <a href=\"https:\/\/arcolinux.info\/\">ArcoLinux<\/a>), Ctrl + F4 is already used and trying to use it in Geany will not work (using it will also <strong><em>make all open windows disappear<\/em><\/strong>&#8230; Use Ctrl + F1 to recover). To make it work, first clear it by activating the start menu (e.g., key &#8216;Win&#8217; or click on it in the lower left), type &#8220;wi&#8221; &rarr; <em>&#8220;Window Manager&#8221;<\/em> &rarr; tab <em>&#8220;Keyboard&#8221;<\/em> &rarr; select <em>&#8220;Workspace 4&#8221;<\/em> &rarr; press <em>&#8220;Clear&#8221;<\/em> &rarr; <em>&#8220;Close&#8221;<\/em> (this also makes Ctrl + F4 work in other applications, like Firefox). Also clear the shortcut for <em>&#8220;Workspace 2&#8221;<\/em>, <em>&#8220;Workspace 3&#8221;<\/em>, and <em>&#8220;Workspace 5&#8221;<\/em> &#8211; as we are also going to use Ctrl + F2, Ctrl + F3, and Ctrl + F5.<\/p>\n<p>Item <em>&#8220;Close&#8221;<\/em> in section <em>&#8220;File&#8221;<\/em>.<\/p>\n<p>(Original keyboard shortcut: <kbd>Ctrl<\/kbd> + <kbd>W<\/kbd>)<\/p>\n<h3>Find next (F3)<\/h3>\n<p>E.g., so a macro keyboard works the same.<\/p>\n<p>Item <em>&#8220;Find Next&#8221;<\/em> in section <em>&#8220;Search&#8221;<\/em> (about 40% way down).<\/p>\n<p>(Original keyboard shortcut: <kbd>Ctrl<\/kbd> + <kbd>G<\/kbd>)<\/p>\n<h3>Find previous (Ctrl + F3)<\/h3>\n<p>E.g., so a macro keyboard works the same.  Note: Ctrl + F3 appears as &#8220;&lt;Primary>F3&#8221; in Geany.<\/p>\n<p>Item <em>&#8220;Find Previous&#8221;<\/em> in section <em>&#8220;Search&#8221;<\/em> (about 40% way down).<\/p>\n<p>(Original keyboard shortcut: <kbd>Shift<\/kbd> + <kbd>Ctrl<\/kbd> + <kbd>G<\/kbd>)<\/p>\n<h3>Set bookmark (Ctrl + F2)<\/h3>\n<p>E.g., so a macro keyboard works the same. But note that bookmarks are not saved by default (they will be lost when Geany is quit). See section &#8220;<a href=\"https:\/\/pmortensen.eu\/world2\/2020\/03\/29\/using-geany#Persistent_bookmarks\">Persistent bookmarks<\/a>&#8221; below.<\/p>\n<p>Item <em>&#8220;Toggle Marker&#8221;<\/em> in section <em>&#8220;Go to&#8221;<\/em> (about half way down).<\/p>\n<p>Note that the <kbd>Ctrl<\/kbd> key is listed as &#8220;Primary&#8221;.<\/p>\n<p>(Original keyboard shortcut: <kbd>Ctrl<\/kbd> + <kbd>M<\/kbd>)<\/p>\n<h3>Next bookmark (F2)<\/h3>\n<p>E.g., so a macro keyboard works the same.<\/p>\n<p>Item <em>&#8220;Go to Next Marker&#8221;<\/em> in section <em>&#8220;Go to&#8221;<\/em> (about half way down).<\/p>\n<p>Note that the <kbd>Ctrl<\/kbd> key is listed as &#8220;Primary&#8221;.<\/p>\n<p>When prompted, press <em>&#8220;Override&#8221;<\/em> to remove the existing keyboard shortcut for <em>&#8220;Switch to Editor&#8221;<\/em>.<\/p>\n<p>(Original keyboard shortcut: <kbd>Ctrl<\/kbd> + <kbd>.<\/kbd>)<\/p>\n<h3 id=\"previous_bookmark\">Previous bookmark (Alt + F2)<\/h3>\n<p>E.g., so a macro keyboard works the same.<\/p>\n<p>Preparation: <a href=\"https:\/\/help.ubuntu.com\/stable\/ubuntu-help\/shell-keyboard-shortcuts.html.en\">Ubuntu (and variants like Ubuntu MATE) may already use<\/a> this keyboard shortcut. The same in <a href=\"https:\/\/en.wikipedia.org\/wiki\/KDE_Plasma_5\">KDE Plasma<\/a> (e.g., under <a href=\"https:\/\/en.wikipedia.org\/wiki\/Fedora_Linux\">Fedora<\/a>), where it activates <a href=\"https:\/\/en.wikipedia.org\/wiki\/KDE_Frameworks#Components\">KRunner<\/a>. And the same in Cinnamon.<\/p>\n<p>In Ubuntu, disable the keyboard shortcut for <em>&#8220;Key to execute a command&#8221;<\/em> or <em>&#8220;Show the run command prompt&#8221;<\/em>. The way depends on the Ubuntu version. In <strong><em>older versions<\/em><\/strong> of Ubuntu, do it by <a href=\"https:\/\/askubuntu.com\/questions\/126817\/how-can-i-disable-the-alt-f1-and-alt-f2-shortcuts\/336168#336168\"> by installing and using CompizConfig Settings Manager<\/a>. It worked for me on <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ubuntu_version_history#Ubuntu_16.04_LTS_.28Xenial_Xerus.29\">Ubuntu&nbsp;16.04 (Xenial Xerus)<\/a>. <br \/>In <strong><em>newer versions<\/em><\/strong> of Ubuntu, the CompizConfig Settings Manager method does not work. Instead, it is done without installing any software, in <em>Settings<\/em> &rarr; <em>Devices<\/em> (or just <em>Keyboard<\/em>) &rarr; <em>Keyboard<\/em> (left panel) &rarr; section <em>System<\/em> (2\/3 down) &rarr; click <em>&#8220;Show the run command prompt&#8221;<\/em> &rarr; press the &#8220;Backspace&#8221; key to clear it &rarr; click <em>Set<\/em>. Its status should now be &#8220;Disabled&#8221; instead of &#8220;Alt + F2&#8221;. It worked for me on <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ubuntu_version_history#Ubuntu_18.04_LTS_.28Bionic_Beaver.29\">Ubuntu&nbsp;18.04 (Bionic Beaver)<\/a>. <br \/>In <strong><em>even newer versions<\/em><\/strong> of Ubuntu, in <em>Settings<\/em> &rarr; <em>Keyboard<\/em> (left panel) &rarr; section <em>Keyboard Shortcuts<\/em> &rarr; <em>View and Customize Shortcuts<\/em> &rarr; <em>System<\/em> &rarr; click <em>&#8220;Show the run command prompt&#8221;<\/em> &rarr; press the &#8220;Backspace&#8221; key to clear it &rarr; click <em>Set<\/em>. Its status should now be &#8220;Disabled&#8221; instead of &#8220;Alt + F2&#8221;. It worked for me on <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ubuntu_version_history#Ubuntu_18.04_LTS_.28Bionic_Beaver.29\">Ubuntu&nbsp;18.04 (Bionic Beaver)<\/a>. <br \/><strong><em>In Ubuntu 20.04<\/em><\/strong>, in <em>Settings<\/em> &rarr; <em>Keyboard Shortcuts<\/em> (left panel) &rarr; section <em>System<\/em> (about 60% down on the right) &rarr; click <em>&#8220;Show the run command prompt&#8221;<\/em> (the last one in the section) &rarr; press the &#8220;Backspace&#8221; key to clear it &rarr; click <em>Set<\/em>. Its status should now be &#8220;Disabled&#8221; instead of &#8220;Alt + F2&#8221;.<\/p>\n<p>In Ubuntu MATE (much easier): <kbd>Window key<\/kbd> &rarr; &#8220;k&#8221; &rarr; select <em>&#8220;Keyboard Shortcuts&#8221;<\/em>. In section &#8220;Desktop&#8221; (second section), double click <em>&#8220;Show the panel&#8217;s &#8216;Run Application&#8217; dialog box&#8221;<\/em> and press backspace (to clear it). It takes effect immediately; there is no need to restart anything.<\/p>\n<p>In Cinnamon (for example, with underlying Ubuntu, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Linux_Mint#LMDE\">LMDE<\/a>, or Fedora): <kbd>Window key<\/kbd> &rarr; &#8220;sys&#8221; &rarr; select <em>&#8220;System Settings&#8221;<\/em>. In section &#8220;Hardware&#8221; (third section), open <em>&#8220;Keyboard&#8221;<\/em>. In tab &#8220;Shortcuts&#8221;, click &#8220;General&#8221; (left panel) &rarr; click on &#8220;Run dialogue&#8221; on the right &rarr; select and single click on &#8220;Alt + F2&#8221; (will display &#8220;Pick an accelerator&#8221;) in the lower half (&#8220;Keyboard bindings&#8221;) &rarr; press Backspace (to delete\/clear the shortcut). In later versions of Cinnamon, it is highly unintuitive: first <strong><em>double click<\/em><\/strong> the existing Alt + F2&mdash; before pressing Backspace (pressing the <em>&#8220;Remove custom shortcut&#8221;<\/em> button in the lower right doesn&#8217;t do anything). It takes effect immediately; there is no need to restart anything.<\/p>\n<p>In <a href=\"https:\/\/en.wikipedia.org\/wiki\/Xfce\">Xfce<\/a> (e.g., using <a href=\"https:\/\/en.wikipedia.org\/wiki\/MX_Linux\">MX Linux<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Xubuntu\">Xubuntu<\/a>, or <a href=\"https:\/\/arcolinux.info\/\">ArcoLinux<\/a>): Activate the start menu (Win key or click on it) &rarr; type &#8220;k&#8221; &rarr; <em>&#8220;Keyboard&#8221;<\/em> &rarr; tab <em>&#8220;Application Shortcuts&#8221;<\/em> &rarr; select <em>&#8220;xfce4-appfinder &#8211;collapsed&#8221;<\/em> &rarr; press <em>&#8220;Remove&#8221;<\/em> &rarr; <em>&#8220;Close&#8221;<\/em>.<\/p>\n<p>In Lubuntu (<a href=\"https:\/\/en.wikipedia.org\/wiki\/LXQt\">LXQt<\/a> (v18.10 or higher) or <a href=\"https:\/\/en.wikipedia.org\/wiki\/LXDE\">LXDE<\/a> (v18.04 or lower)), edit file <em>~\/.config\/openbox\/lubuntu-rc.xml<\/em> near &#8220;A-F2&#8221;. For example, change &#8220;A-F2&#8221; to &#8220;A-F22&#8221; and add an XML comment as to why and document the original value (so it can more easily be reverted). It was tested with Lubuntu 18.04.<\/p>\n<p><!-- <kbd>Window key<\/kbd> &rarr; type <em>Setting<\/em> &rarr; choose <em>System Settings<\/em> &rarr; <em>Keyboard<\/em> &rarr; <em>Shortcuts<\/em>. --> <\/p>\n<p>In Geany&#8217;s preferences, <em>Keybindings<\/em>, set <kbd>Alt<\/kbd> + <kbd>F2<\/kbd> for item <em>&#8220;Go to Previous Marker&#8221;<\/em> in section <em>&#8220;Go to&#8221;<\/em> (about half way down).<\/p>\n<p>(Original keyboard shortcut: <kbd>Ctrl<\/kbd> + <kbd>,<\/kbd>)<\/p>\n<h3>Insert date (<kbd>Alt<\/kbd> + <kbd>2<\/kbd>)<\/h3>\n<p>User-defined as text template &#8220;2&#8221; in UltraEdit.<\/p>\n<p>Example: 2020-03-29<\/p>\n<p>But unfortunately it is <em>not<\/em> possible to set this keyboard shortcut. It conflicts with selecting a tab (the second tab in this case) and using combinations of <kbd>Ctrl<\/kbd>, <kbd>Shift<\/kbd> and <kbd>Alt<\/kbd> conflicts with the Geany plugin &#8220;Numbered Bookmarks&#8221;.<\/p>\n<p>A workaround is to create a text template with the name &#8220;_2&#8221; and content &#8220;{command:date +&#8221;%Y-%m-%d&#8221;}&#8221; (does not work on Windows). Then the date is inserted by typing &#8220;_2&#8221; followed by TAB. <strong><em>Gotcha 1<\/em><\/strong>: It may not work as intended if copy-pasted from this page (due to the &#8220;smart quotes&#8221;; for example, Unicode <a href=\"https:\/\/www.charset.org\/utf-8\/9\">U+201C<\/a> (LEFT DOUBLE QUOTATION MARK) and <a href=\"https:\/\/www.charset.org\/utf-8\/9\">U+201D<\/a> (RIGHT DOUBLE QUOTATION MARK)); all the double quotes should be <a href=\"https:\/\/en.wikipedia.org\/wiki\/ASCII#Printable_character_table\">ASCII double quotes<\/a>&#8230; <strong><em>Gotcha 2<\/em><\/strong>: &#8220;[Default]&#8221; should be uncommented, that is, not be preceded by &#8220;#~ &#8221; (it may not be by default) <\/p>\n<p>Another workaround is to use Alt + 3 (which does work &#8211; after the change below) and delete the time part, leaving only date part.<\/p>\n<h3>Insert date and time (<kbd>Alt<\/kbd> + <kbd>3<\/kbd>)<\/h3>\n<p>Change keyboard shortcut:<\/p>\n<p>In menu <em>Edit<\/em> &rarr; <em>Preferences<\/em> &rarr; <em>Keybindings<\/em> &rarr; sub section <em>Insert<\/em> (about 40% down) &rarr; <em>Insert date<\/em>: Change to <kbd>Alt<\/kbd> + <kbd>3<\/kbd> (from the default <kbd>Shift<\/kbd> + <kbd>Alt<\/kbd> + <kbd>D<\/kbd>)<\/p>\n<p>User defined as text template &#8220;3&#8221; in UltraEdit.<\/p>\n<p>Example: 2020-03-29T144457. This presumes the data format has been set as in section <em>&#8220;Insert date and date\/time&#8221;<\/em> below.<\/p>\n<p>Note that this overrides selecting the third tab with <kbd>Alt<\/kbd> + <kbd>3<\/kbd>&#8230;<\/p>\n<p>(Original keyboard shortcut: <kbd>Shift<\/kbd> + <kbd>Alt<\/kbd> + <kbd>D<\/kbd>)<\/p>\n<h3>Go to line (Ctrl + G)<\/h3>\n<p>Item <em>&#8220;Go to Line&#8221;<\/em> in section <em>&#8220;Go to&#8221;<\/em> (about half way down).<\/p>\n<p>Note that the <kbd>Ctrl<\/kbd> key is listed as &#8220;Primary&#8221;.<\/p>\n<p>(Original keyboard shortcut: <kbd>Ctrl<\/kbd> + <kbd>L<\/kbd>)<\/p>\n<h3>Trim trailing spaces (Shift + F12)<\/h3>\n<p>Note: A keyboard shortcut was not added <a href=\"https:\/\/www.geany.org\/documentation\/releasenotes\/1.34\">until version 1.34<\/a> (2018-12-16). Thus the default installed version of Geany on Ubuntu 16.04 (<a href=\"https:\/\/www.geany.org\/documentation\/releasenotes\/1.27\">version 1.27<\/a>, 2016-04-17) and Ubuntu 18.04 (<a href=\"https:\/\/www.geany.org\/documentation\/releasenotes\/1.32\">version 1.32<\/a>, 2017-11-19) does not have it&#8230; Ubuntu 19.10 has <a href=\"https:\/\/www.geany.org\/documentation\/releasenotes\/1.35\">version 1.35<\/a>, 2019-04-28. MX Linux 19.3 from November 2020 only has version 1.33 of Geany&#8230; Ubuntu 22.04 has version 1.38.<\/p>\n<p>Item <em>&#8220;Strip Trailing Spaces&#8221;<\/em> in section <em>&#8220;Document&#8221;<\/em> (about 3\/4 way down).<\/p>\n<p>If it is not available, an alternative is to use the implicit <kbd>Alt<\/kbd> + <kbd>D<\/kbd>, <kbd>S<\/kbd> keyboard shortcut.<\/p>\n<h2>More keyboard shortcuts<\/h2>\n<h3 id=\"tabNavigation\">Physical navigation of tabs<\/h3>\n<p>We want physical navigation of tabs with Ctrl + Tab (to the right) and Shift + Ctrl + Tab (to the left), like it is possible in Firefox (with <strong><em>unchecking<\/em><\/strong> of option <em>&#8220;Ctrl+Tab cycles through tabs in recently used order&#8221;<\/em>). Or in other words, we want the same keyboard shortcuts for this navigation in both Firefox and Geany, so we can easily use a macro keyboard (no need to use <em>modifier keys<\/em> for this very very common action).<\/p>\n<p>There isn&#8217;t any setting for that in Geany, but there are actions for both kinds of navigation (with associated keyboard shortcuts):<\/p>\n<p>Switch to left document<br \/>\nSwitch to right document<br \/>\nSwitch to last used document<\/p>\n<p>In Geany&#8217;s preferences, <em>Keybindings<\/em>, section <em>&#8220;Notebook tab&#8221;<\/em> (near the end):<\/p>\n<p>Clear the keyboard shortcut item <em>&#8220;Switch to last used document&#8221;<\/em> by double clicking and pressing OK &#8211; without pressing any keyboard shortcut (original keyboard shortcut: <kbd>Ctrl<\/kbd> + <kbd>Tab<\/kbd>).<\/p>\n<p>Set <em>&#8220;Switch to left document&#8221;<\/em> to <kbd>Shift<\/kbd> + <kbd>Ctrl<\/kbd> + <kbd>Tab<\/kbd> (original keyboard shortcut: <kbd>Ctrl<\/kbd> + <kbd>Page_Up<\/kbd>).<\/p>\n<p>Set <em>&#8220;Switch to right document&#8221;<\/em> to <kbd>Ctrl<\/kbd> + <kbd>Tab<\/kbd> (original keyboard shortcut: <kbd>Ctrl<\/kbd> + <kbd>Page_Down<\/kbd>).<\/p>\n<p>(Note: <em>Page_Up<\/em> and <em>Page_Down<\/em> is the notation Geany uses, not e.g. <em>Page Up<\/em> or <em>PgUp<\/em>.)<\/p>\n<h3>Move tabs<\/h3>\n<p>We change the keyboard shortcuts for rearranging (document) tabs to be the same as in Firefox (so we can use the same keys on a macro keyboard).<\/p>\n<p>In Geany&#8217;s preferences, <em>Keybindings<\/em>, section <em>&#8220;Notebook tab&#8221;<\/em> (near the end):<\/p>\n<p>Set <kbd>Shift<\/kbd> + <kbd>Ctrl<\/kbd> + <kbd>Page_Up<\/kbd> for item <em>&#8220;Move document left&#8221;<\/em> (original keyboard shortcut: <kbd>Alt<\/kbd> + <kbd>Page_Up<\/kbd>).<\/p>\n<p>Set <kbd>Shift<\/kbd> + <kbd>Ctrl<\/kbd> + <kbd>Page_Down<\/kbd> for item <em>&#8220;Move document right&#8221;<\/em> (original keyboard shortcut: <kbd>Alt<\/kbd> + <kbd>Page_Down<\/kbd>).<\/p>\n<h2>Text templates<\/h2>\n<p>In Geany, they are called <a href=\"https:\/\/wiki.geany.org\/snippets\/start\">&#8220;snippets&#8221;<\/a> (<em>templates<\/em> mean something else in Geany).<\/p>\n<p>Edit file <em>snippets.conf<\/em>, from menu <em>Tools<\/em> &rarr; <em>Configuration Files<\/em> &rarr; <em>snippets.conf<\/em>. Add to the &#8220;[Default]&#8221; or &#8220;[None]&#8221; section (if they are outcommented with &#8220;#~ &#8221; remove the outcommenting).<\/p>\n<p>Example &#8211; inserting a timestamp template for a video or podcast: <code>_5=%cursor%ZZ min AA secs:  BB\\n\\n<\/code><\/p>\n<p>Output (entering &#8220;_5&#8221;  followed by the TAB key): <code>_ZZ min AA secs:  BB<\/code>. The cursor is set between the underscore and the &#8220;Z&#8221;.<\/p>\n<p>And we can assign a keyboard shortcut, like in UltraEdit, in section &#8220;[Keybindings]&#8221; (<!-- note that defined. -->but even then, <kbd>Ctrl<\/kbd> + <kbd>0<\/kbd> does not work &#8211; it could be a similar shortcut to the one in UltraEdit where we have used <kbd>Alt<\/kbd> + <kbd>0<\/kbd>):<\/p>\n<h3>Insert date<\/h3>\n<p>Change the format of the template <em>&#8220;Date&#8221;<\/em>: Menu <em>Edit<\/em> &rarr; <em>Preferences<\/em> (<kbd>Ctrl<\/kbd> + <kbd>Alt<\/kbd> + <kbd>P<\/kbd>) &rarr; <em>Templates<\/em> &rarr; <em>Date<\/em>, to &#8220;%Y-%m-%d&#8221; (it may already to set to that, depending on how and where Geany was installed).<\/p>\n<h3>Insert date and date\/time<\/h3>\n<p>This is a built-in function in Geany: <\/p>\n<p>Change the date format to <a href=\"https:\/\/en.wikipedia.org\/wiki\/ISO_8601\">ISO&nbsp;8601<\/a>:<\/p>\n<p>Menu <em>Edit<\/em> &rarr; <em>Insert Date<\/em> &rarr; <em>Set Custom Data Format<\/em>, to &#8220;%Y-%m-%dT%H%M%S&#8221;.<\/p>\n<p>Usage (see above for changing the keyboard shortcut, near &#8220;Insert date and time&#8221;): Menu <em>Edit<\/em> &rarr; <em>Insert Date<\/em> &rarr; <em>Use Custom Data Format<\/em>.<\/p>\n<p>It can also be done with templates (like in UltraEdit). Setting the date\/time format to ISO 8601: <\/p>\n<p>Menu <em>Edit<\/em> &rarr; <em>Preferences<\/em> (<kbd>Ctrl<\/kbd> + <kbd>Alt<\/kbd> + <kbd>P<\/kbd>) &rarr; <em>Templates<\/em> &rarr; <em>Date &#038; Time<\/em>, to &#8220;%Y-%m-%dT%H%M%S&#8221;.<\/p>\n<h2>Bookmarks<\/h2>\n<h3 id=\"Persistent_bookmarks\">Persistent bookmarks<\/h3>\n<p>Geany does not remember bookmarks by default, making them pretty much useless. What is the point of bookmarks if they are not saved across sessions??<\/p>\n<p>For this to work, the plugin <em>&#8220;Numbered Booksmarks&#8221;<\/em> must be installed. For instructions, see <em><a href=\"https:\/\/askubuntu.com\/questions\/487030\">Is there a bookmarks feature in Geany?<\/a><\/em>. <a href=\"https:\/\/plugins.geany.org\/install.html\">General install instruction for Geany plugins<\/a>. Essentially it is: <code>apt-cache search geany<\/code> on Ubuntu to get the list, and <code>sudo apt-get install geany-plugin-numberedbookmarks<\/code> to install. On Windows and Arch Linux (e.g., ArcoLinux), it is part of the single plugin package.<\/p>\n<p>In the plugin manager, enable it to load at startup.<\/p>\n<p>Note that even then the document must be saved before the current bookmarks are persisted. And it does <em>not<\/em> work if the document is <em>already<\/em> saved and bookmarks are added after that. <strong><em>Workaround<\/em><\/strong>: Add a trailing space somewhere (or some other harmless change) and then save &#8211; this will save the current bookmarks. Or in other words, bookmarks may be lost if the document is not &#8220;dirtied&#8221; and then immediately saved.<\/p>\n<h2>Dismiss the Find dialog<\/h2>\n<p>Menu <em>Edit<\/em> &rarr; <em>Preferences<\/em> (<kbd>Ctrl<\/kbd> + <kbd>Alt<\/kbd> + <kbd>P<\/kbd>) &rarr; <em>&#8220;General&#8221;<\/em> &rarr; tab <em>&#8220;Miscellaneous&#8221;<\/em>, check <em>&#8220;Hide the Find dialog&#8221;<\/em>.<\/p>\n<h2>Make search wrap around<\/h2>\n<p>That is, also search from the beginning of the document after the last match at the end of a document (otherwise, apparent false negative search results).<\/p>\n<p>Menu <em>Edit<\/em> &rarr; <em>Preferences<\/em> (<kbd>Ctrl<\/kbd> + <kbd>Alt<\/kbd> + <kbd>P<\/kbd>) &rarr; <em>&#8220;General&#8221;<\/em> &rarr; tab <em>&#8220;Miscellaneous&#8221;<\/em>, check <em>&#8220;Always wrap search&#8221;<\/em>.<\/p>\n<h2>Insert newlines when using search&#038;replace<\/h2>\n<p>For find and replace, empty lines can be used in the replacement string, but it is far from obvious that it is possible. To do it:<\/p>\n<ul>\n<li>Use &#8220;\\n&#8221; in field <em>&#8220;Replace with:&#8221;<\/em><\/li>\n<li>Check option <em>&#8220;Use regular expressions&#8221;<\/em><\/li>\n<li>Check option <em>&#8220;Use multi-line matching&#8221;<\/em><\/li>\n<\/ul>\n<p>Or simpler:<\/p>\n<ul>\n<li>Use &#8220;\\n&#8221; in field <em>&#8220;Replace with:&#8221;<\/em><\/li>\n<li>Check option <em>&#8220;Use escape sequences&#8221;<\/em><\/li>\n<\/ul>\n<p>This feature is e.g. useful when breaking up very long lines of HTML by replacing space with newline. <\/p>\n<p>Similarly, it is also possible to match newlines in the search (e.g., to find lines separate by more than one empty line).<\/p>\n<p>An alternative (incl. for more complex scenarios) is to use the plugin <a href=\"https:\/\/plugins.geany.org\/geanyminiscript.html\">Mini Script<\/a> (see above for details). It enables to run arbitrary script code on the selection in a Geany document (passed to the script by standard input (as seen by the script)) and replacing the selection (passed from the script by standard output). For example, script code for this in Perl:<\/p>\n<pre class=\"brush: perl; gutter: false; title: ; notranslate\" title=\"\">\r\nwhile (&lt;&gt;)\r\n{\r\n    chomp;\r\n\r\n    s\/\\s\/\\n\/g; # Replace space with newline\r\n\r\n    print &quot;$_\\n&quot;;\r\n}\r\n<\/pre>\n<p>Note that Mini Script does not remember the script code and thus it must be manually set up for every Geany session&#8230; The alternative is to use external commands &#8211; see near &#8220;Sort lines&#8221; below.<\/p>\n<h2>Changing case of text<\/h2>\n<p>Geany doesn&#8217;t have the same range of functions as UltraEdit, but toggling the case of the selection may be sufficient (menu <em>Edit<\/em> &rarr; <em>Format<\/em> &rarr; <em>&#8220;Toggle Case of Selection&#8221;<\/em> (<kbd>Ctrl<\/kbd> + <kbd>Alt<\/kbd> + <kbd>U<\/kbd>). Note: despite the name, it doesn&#8217;t toggle the case of each individual character. Instead it changes all to lower case unless all is already lowercase. This is what we want &#8211; this covers the case (no pun intended) of changing from title case to sentence case.<\/p>\n<p>Map the keyboard shortcut to <kbd>Ctrl<\/kbd> + <kbd>F5<\/kbd> (UltraEdit&#8217;s to lower case) &#8211; &#8220;Toggle Case of Selection&#8221; in section &#8220;Format&#8221; (about 30% down) in keybindings.<\/p>\n<h2 id=\"numberSeries\">Generate number series<\/h2>\n<p>Corresponding to UltraEdit&#8217;s &#8220;Insert Number&#8221;.<\/p>\n<p>Use the Geany plugin <a href=\"https:\/\/plugins.geany.org\/geanyinsertnum.html\">&#8220;Insert Numbers&#8221;<\/a>. Install it by &#8220;sudo apt-get install geany-plugins&#8221; (this step is not required for Windows and Arch Linux (e.g., ArcoLinux)). Enable it in the Plugin Manager. Geany may have be restarted for it to turn up in menu <em>Tools<\/em>. Note that this will install 40 other plugins, not just <em>&#8220;Insert Numbers&#8221;<\/em>.<\/p>\n<p>Note that it only works on <a href=\"https:\/\/pmortensen.eu\/world2\/2020\/12\/31\/block-column-mode-in-text-editors-geany-visual-studio-ultraedit-notepad-and-visual-studio-code-and-vim\/\">a block selection<\/a> (use Shift + Alt + arrow keys), not a normal selection. It even supports binary and hexadecimal number series.<\/p>\n<h2>Split windows (vertical or horizontal)<\/h2>\n<p>Split windows are supported, but not through standard menus. It is by the plugin <em>&#8220;Split Window&#8221;<\/em>. The plugin is part of the standard plugins package (already installed if the instructions have been followed here). Enable it using the Plugin Manager: menu <em>Tools<\/em> &rarr; <em>Plugin Manager<\/em>. After this, there is a new sub menu, menu <em>Tools<\/em> &rarr; <em>Split Window<\/em> with commands <em>&#8220;Side by Side&#8221;<\/em> and <em>&#8220;Top and Buttom&#8221;<\/em>. Note that it is available immediately; there isn&#8217;t any need to restart Geany.<\/p>\n<p>Unfortunately, it is <strong><em>completely broken<\/em><\/strong> for any practical use. Most operations, like find (Ctrl + F, F3), will not take place in the part with focus, but only in the original part (left for <em>&#8220;Side by Side&#8221;<\/em> and top for <em>&#8220;Top and Buttom&#8221;<\/em>). <\/p>\n<h2 id=\"Sort_lines\">Sort lines<\/h2>\n<p>There isn&#8217;t a built-in sort function. On Linux, external tools can be used instead (that can be used directly on selected text):<\/p>\n<p>Menu <em>Edit<\/em> &rarr; <em>Format<\/em> &rarr; <em>Send Selection to<\/em> &rarr; <em>Format<\/em> &rarr; <em>Set Custom Commands<\/em>. Click &#8220;Add&#8221;. Type &#8220;sort&#8221; (it is the name of <a href=\"https:\/\/linux.die.net\/man\/1\/sort\">the executable on a Linux system<\/a> that can take input from standard input and output a sorted version to standard output). Also fill in the &#8220;Label&#8221; field. E.g., with &#8220;Sort&#8221;.<\/p>\n<p>Note 1: The &#8220;Label&#8221; field <strong><em>must<\/em><\/strong> be filled in (even if it is not actually displayed anywhere (it appears to be a bug in Geany &#8211; the intent was probably for the content of the &#8220;Label&#8221; to show up in the menu item (instead of the raw command-line))). Though it does seem it is possible to set the label later (and it will show up in the menu), but only if button &#8220;OK&#8221; is not pressed immediately when the label text has been filled in&mdash;only after changing focus to some other element or clicking in the free space&#8230;<\/p>\n<p>Note 2 (<strong><em>major gotcha<\/em><\/strong>): As in note 1, if the &#8220;Command&#8221; field is later changed, <strong><em>the change is lost<\/em><\/strong> if the OK button is pressed immediately when the text is in edit mode. Click on some other element before pressing &#8220;OK&#8221;, in order not to lose the change&#8230;<\/p>\n<p>Note 3: With GNOME on Ubuntu, there are severe screen update problems if (ironically) the accessibility setting &#8220;High Contrast&#8221; is enabled (Win + &#8220;sett&#8221;  &rarr; <em>Settings<\/em> (or <em>System Settings<\/em>) &rarr; <em>Universal Access<\/em> (or <em>Accessibility<\/em>)). Though it is sadly not a surprise when it comes to GNOME. The workaround is to switch off &#8220;High Contrast&#8221; while setting up the commands in dialog <em>&#8220;Set Custom Commands&#8221;<\/em>.<\/p>\n<p>Note 4: Only the first three keyboard shortcuts are automatic, Ctrl&nbsp;+&nbsp;1, Ctrl&nbsp;+&nbsp;2, and Ctrl&nbsp;+&nbsp;3. <\/p>\n<p>Note 5: When making changes to a command line in the &#8220;Set Custom Commands&#8221; dialog, changes are <strong><em>silently discarded<\/em><\/strong> if the dialog is dismissed with &#8220;Esc&#8221; (there isn&#8217;t any warning). Always press &#8220;OK&#8221; or Alt + O after making changes&#8230; See also note 2 (major gotcha).<\/p>\n<p>Note 6: If there is a syntax error in the Perl one-liner it seems to silently fail (there isn&#8217;t any error message to the output about the syntax error). The input is cleared because nothing is output to standard output due to the error occurring. <strong><em>However, the error is actually displayed at the bottom of the screen<\/em><\/strong> in Geany. Example: <em>&#8220;The executed custom command returned an error. Your selection was not changed. Error message: Bareword found where operator expected at -e line 1, near &#8220;qx\/export&#8221;&#8221;<\/em>. The error is also shown in the message window (menu <em>View<\/em> &rarr; <em>Message Window<\/em>).<\/p>\n<p>To exclude duplicates, use &#8220;sort -u&#8221; instead of &#8220;sort&#8221;. They can be two separate commands.<\/p>\n<p>The sort can be invoked much the same way as it was defined, but it is much easier to use the automatic keyboard shortcuts, Ctrl + 1, Ctrl + 2, etc.<\/p>\n<p>Note: Unlike the built-in sort function in many text editors, this works on the selection, so nothing happens if there isn&#8217;t any (text) selection&#8230; Thus, select the lines to sorted before doing Ctrl + 1, Ctrl + 2, etc.<\/p>\n<p>Note that, as any command-line can be used, it is very flexible and some highly specialised sort could be implemented by means of a Perl, or Python, or Bash script. It is not known how long a Perl one-liner is allowed &#8211; but in any case the command line could be running &#8216;perl&#8217; on a Perl script stored in a file (thus no restrictions).<\/p>\n<p>On Windows, if Perl is installed, Perl one-liners can very easily be used to achieve the same effect. Even if some system-provided commands on Windows may work with both standard input and standard output (required for use in Geany), Perl is the more general solution that always works. Use <a href=\"https:\/\/en.wikipedia.org\/wiki\/Strawberry_Perl\">Strawberry Perl<\/a>.<\/p>\n<p>Some other useful commands are:<\/p>\n<ul>\n<li>Reverse lines (without sorting). For example, using &#8216;<a href=\"https:\/\/www.gnu.org\/software\/coreutils\/manual\/html_node\/tac-invocation.html#tac-invocation\">tac<\/a>&#8216;<\/li>\n<\/ul>\n<h2 id=\"open-urls\">Open URLs in selected lines in a web browser<\/h2>\n<p>As for &#8220;Sort lines&#8221;, this Perl one-liner can be used (it limits the number of opened URLs to 50, in case way too many lines with URLs are selected&#8230;):<\/p>\n<pre class=\"brush: perl; gutter: false; title: ; notranslate\" title=\"\">\r\nperl -e 'my $maxURLs = 50; my $inputCount = 0; my $outputCount = 0; while (&lt;&gt;) { $inputCount++; chomp; print &quot;$_\\n&quot;; if ($outputCount &lt; $maxURLs) { if (\/(http[^\\s\\&gt;]+)\/) { $outputCount++; $URL = $1; system(&quot;xdg-open \\&quot;$URL\\&quot;&quot;); sleep(3); } } }'\r\n<\/pre>\n<p>Or in other words, if Perl one-liner is used in the first item, Ctrl + 1 will open the selected URLs in Geany. It tries to extract the URL from surrounding punctuation, space, etc., so the lines do not have to be pure URLs. It also only opens the URL if it looks like one, containing &#8220;http&#8221;, etc.<\/p>\n<p>The label could be something like <em>&#8220;Open URLs&#8221;<\/em>.<\/p>\n<p>On Windows, it is very similar. Only the system call, <code>start<\/code> instead of <code>xdg-open<\/code>, is different and on Windows double quotes are used instead of single quotes for the Perl one-liner itself, so using literal double quotes and &#8216;\\n&#8217; in the Perl one-liner is more cumbersome (an alternative is to use a Perl script (committed to disk)):<\/p>\n<pre class=\"brush: perl; gutter: false; title: ; notranslate\" title=\"\">\r\nperl -e &quot;my $maxURLs = 50; my $inputCount = 0; my $outputCount = 0; while (&lt;&gt;) { $inputCount++; chomp; print $_ . chr(10); if ($outputCount &lt; $maxURLs) { if (\/(http[^\\s\\&gt;]+)\/) { $outputCount++; $URL = $1; $quot = chr(34); system('start ' . $quot . $quot . ' ' . $URL); sleep(3); } } }&quot;\r\n<\/pre>\n<p><strong><em>Gotcha<\/em><\/strong>: The default browser, e.g. Firefox, should <strong><em>already be running<\/em><\/strong> when invoking the command. Otherwise, Firefox will launch, but Geany becomes unresponsive! Geany will be a zombie until Firefox is closed. If Firefox is already open when invoking, Geany is unaffected.<\/p>\n<h2 id=\"NumberConversion\">Converting between binary, octal, decimal, and hexadecimal numbers<\/h2>\n<p>UltraEdit has the <em>Number Converter<\/em> window (it is not a menu command, but it is invoked through the context menu in a text document and is only available if there is selected text):<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/pmortensen.eu\/world2\/wp-content\/uploads\/2021\/03\/Ultradit_Number_Converter.png\" width=\"237\" height=\"258\" alt=\"UltraEdit's number converter\" \/><\/p>\n<p>Geany doesn&#8217;t have anything built-in, but it can be achieved through a custom command with a Perl one-liner. For example, to convert from octal numbers that are constrained to eight bits (for the binary number output), to output in binary, octal, decimal, and hexadecimal:<\/p>\n<pre class=\"brush: perl; gutter: false; title: ; notranslate\" title=\"\">\r\nperl -nle 'my $number = oct($_); my $binStr = substr(unpack(&quot;B32&quot;, pack(&quot;N&quot;, $number)), 24, 8); my $asOctal = sprintf(&quot;%o&quot;, $number); my $asHex = sprintf(&quot;0x%X&quot;, $number); if (\/\\d\/) {print &quot;$binStr  $asOctal  $number  $asHex&quot;} else { print } '\r\n<\/pre>\n<p>Similar for hexadecimal input (presumes the leading &#8220;0x&#8221; in such numbers and no leading space, otherwise it will not do any conversion (this could be changed by modifying the script or making it more complex by changing it to handle more kinds of input (this is the advantage of having a full-blown script programming language at your disposal))):<\/p>\n<pre class=\"brush: perl; gutter: false; title: ; notranslate\" title=\"\">\r\nperl -nle 'my $number = hex($_); my $binStr = substr(unpack(&quot;B32&quot;, pack(&quot;N&quot;, $number)), 24, 8); my $asOctal = sprintf(&quot;%o&quot;, $number); my $asHex = sprintf(&quot;0x%X&quot;, $number); if (\/\\d\/) {print &quot;$binStr  $asOctal  $number  $asHex&quot;} else { print } '\r\n<\/pre>\n<p>See section &#8220;Sort lines&#8221; on how to add it to the custom commands.<\/p>\n<p>If the one-liner is one of the first three custom commands, it automatically gets a keyboard shortcut, Ctrl + 1, Ctrl + 2, or Ctrl + 3, depending on the ID\/order.<\/p>\n<p>If one of those three are not available, then it becomes really cumbersome to use. One solution is to use a macro key on <a href=\"https:\/\/pmortensen.eu\/world2\/2023\/02\/13\/low-cost-fully-macro-capable-mechanical-keyboard-cooler-master-ck-550\/\">a macro-capable keyboard<\/a> (for example, using keyboard shortcut <em>Alt<\/em> + <em>E<\/em>, <em>F<\/em>, <em>S<\/em>, 4 x <em>arrow down<\/em>, <em>Enter<\/em>, for the fifth item in the script list).<\/p>\n<p>One advantage is the complete freedom in how the output should be formatted. For instance, it could output in both binary, octal, decimal, and hexadecimal (in UltraEdit, only one number base is output at a time). Another is that, in contrast to UltraEdit where it is more like a calculator and only one value can be converted at a time, it works on the selected lines &#8211; any number of numbers can be converted (though limited to one number per line for the particular script shown here).<\/p>\n<div id=\"Column_mode_blues\"> <\/div>\n<h2>Column mode blues<\/h2>\n<p>On <a href=\"https:\/\/en.wikipedia.org\/wiki\/Lubuntu\">Lubuntu<\/a>, the keyboard shortcuts for <a href=\"https:\/\/pmortensen.eu\/world2\/2020\/12\/31\/block-column-mode-in-text-editors-geany-visual-studio-ultraedit-notepad-and-visual-studio-code-and-vim\/\">selecting a rectangular area of text<\/a> (&#8220;column mode&#8221; in UltraEdit) do not work, because they conflict with four default keyboard shortcuts in the window manager (<a href=\"https:\/\/en.wikipedia.org\/wiki\/LXDE\">LXDE<\/a>? <a href=\"https:\/\/en.wikipedia.org\/wiki\/Openbox\">Openbox<\/a>?), <kbd>Shift<\/kbd> + <kbd>Alt<\/kbd> + <kbd>arrow up<\/kbd>, <kbd>Shift<\/kbd> + <kbd>Alt<\/kbd> + <kbd>arrow down<\/kbd>, <kbd>Shift<\/kbd> + <kbd>Alt<\/kbd> + <kbd>arrow left<\/kbd>, and <kbd>Shift<\/kbd> + <kbd>Alt<\/kbd> + <kbd>arrow right<\/kbd>.<\/p>\n<p>Disable the window manager keyboard shortcuts by editing file <em>~\/.config\/openbox\/lubuntu-rc.xml<\/em> near &#8220;S-A-Up&#8221;, &#8220;S-A-Down&#8221;, &#8220;S-A-Left&#8221;, and &#8220;S-A-Right&#8221;. For example, change &#8220;S-A-Up&#8221; to &#8220;S-A-Up99&#8221;, &#8220;S-A-Down&#8221; to &#8220;S-A-Down99&#8221;, &#8220;S-A-Left&#8221; to &#8220;S-A-Left99&#8221;, and &#8220;S-A-Right&#8221; to &#8220;S-A-Right99&#8221;, 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):<\/p>\n<pre class=\"brush: perl; gutter: false; title: ; notranslate\" title=\"\">\r\nvi ~\/.config\/openbox\/lubuntu-rc.xml\r\nopenbox --reconfigure\r\n<\/pre>\n<p>It was tested with Lubuntu 18.04 (32 bit).<\/p>\n<h2>Record and use macros<\/h2>\n<p>The Geany plugin <a href=\"https:\/\/plugins.geany.org\/geanymacro.html\">&#8220;Geany Macro&#8221;<\/a> may be able to do it.<\/p>\n<h2>Location of some Geany files<\/h2>\n<p>For example, for backup purposes. A lot of important state may be lost if the <strong><em>current tabs<\/em><\/strong> are lost. This can happen if the current instance Geany freezes, another instance of Geany is started, and that instance is quit (the open tabs are written at program exit). As the first instance is frozen there isn&#8217;t any way to save them&#8230;<\/p>\n<ul>\n<li>Session file (with the open tabs): <em>~\/.config\/geany\/geany.conf<\/em>. For example, <em>\/home\/mortensen\/.config\/geany\/geany.conf<\/em>. The open tabs are stored near &#8220;recent_files=&#8221;. It also stores the setup in menu <em>Edit<\/em> &rarr; <em>Format<\/em> &rarr; <em>Send Selection to<\/em> &rarr; <em>Format<\/em>.<\/li>\n<li>Snippets file: <em>~\/.config\/geany\/snippets.conf<\/em>. For example, <em>\/home\/mortensen\/.config\/geany\/snippets.conf<\/em><\/li>\n<li>Keyboard shortcuts file: <em>~\/.config\/geany\/keybindings.conf<\/em>. For example, <em>\/home\/mortensen\/.config\/geany\/keybindings.conf<\/em><\/li>\n<li>Bookmarks file: <em>~\/.config\/geany\/plugins\/Geany_Numbered_Bookmarks\/settings.conf<\/em>\n<\/ul>\n<h2>Extra features not in UltraEdit<\/h2>\n<h3>Apply own Perl scripts directly on selected text<\/h2>\n<p>The Geany plugin <a href=\"https:\/\/plugins.geany.org\/geanyminiscript.html\">&#8220;Mini Script&#8221;<\/a> (GMS) enables this. And it actually works, despite the poor documentation (missing or misleading). E.g., information (e.g., the current text selection in Geany) to the script (e.g., in Perl) is through the script&#8217;s standard input and what is output to standard output will replace the selection.<\/p>\n<p>Note, however, that Mini Script does not save the configuration, so it must be set up for every session. The alternative is to use custom commands as described above in section <em>&#8220;Sort lines&#8221;<\/em>. The drawback is that there is only <em>one<\/em> line available. But it is possible to use scripts committed to disk instead. Perl one-liners can definitely be used, but it is unviable for more complicated\/longer scripts.<\/p>\n<h3>Document tabs can be moved without using the mouse<\/h2>\n<p>Ctrl + Shift + PageUp moves a document tab to the left (presumes the keyboard shortcuts have been set as described above, near &#8220;Move tabs&#8221;). Ctrl + Shift + PageDown moves a document tab to the right. (The same also works in Firefox.)<\/p>\n<h3>Long line marker<\/h2>\n<p>Change it from 72 to the standard 77: <\/p>\n<p>Menu <em>Edit<\/em> &rarr; <em>Preferences<\/em> &rarr; <em>Editor<\/em> &rarr; tab <em>Display<\/em>. Set <em>&#8220;Column&#8221;<\/em> to 77 (under <em>&#8220;Long line marker&#8221;<\/em>).<\/p>\n<h2>Missing features in Geany<\/h2>\n<p>A find next (now <kbd>F3<\/kbd>) on <strong><em>selected<\/em><\/strong> text will not search for that text, unlike in many other text editors (e.g., UltraEdit, Notepad++, and Visual Studio). This is quite cumbersome (the Arduino IDE and Visual Studio Code have the same problem). Though it may prevent the broken F3 for regular expression search in UltraEdit.<\/p>\n<p>A feature to add some text to all columns in a block selection (UltraEdit&#8217;s menu <em>Column<\/em> &rarr; <em>&#8220;Insert\/Fill Columns&#8221;)<\/em>. To look at <a href=\"https:\/\/plugins.geany.org\/geanyextrasel.html\">column selection in plugin &#8220;Extra Selection&#8221;.<\/a><\/p>\n<p>In newer versions of Geany (e.g., 1.36), using replace everything in a document with the <strong><em>same<\/em><\/strong> string does not display statistics about how many replaces took place (useful for counting strings in a document (by replacing it with the same string)). Geany is too smart in this case; in earlier versions of Geany (e.g., 1.27), it worked fine, not making a distinction between replacing with the same string or not. A possible workaround is to use a custom action to count the word (see section <em>&#8220;Sort lines&#8221;<\/em>). Another workaround is to make the two strings different (this will change the document, but it will be acceptable in a temporary document (that is going to be thrown away anyway). Undo (Ctrl + Z) could also be used, but it is an extra complication.)<\/p>\n<h2>Unexpected behaviour\/bugs in Geany<\/h2>\n<h3>Inserting the date (Alt + 3) does not replace the selection<\/h3>\n<p>It ought to work like a paste.<\/p>\n<h3>Non-standard keyboard shortcut for case sensitive in the Find dialog<\/h3>\n<p>It ought to be the standard <kbd>Alt<\/kbd> + <kbd>C<\/kbd> (as in Visual Studio, Notepad, and Notepad++). UltraEdit has the same problem &#8211; it uses the non-standard <kbd>Alt<\/kbd> + <kbd>M<\/kbd> (from &#8220;m&#8221; in <em>Match case<\/em>).<\/p>\n<h3>Replace (in the search dialog) does not replace <strong><em>and<\/em><\/strong> find next<\/h3>\n<p>This unlike in all other text editors. Instead, use the button <kbd>Replace & Find<\/kbd> (keyboard shortcut <kbd>Alt<\/kbd> + <kbd>N<\/kbd>).<\/p>\n<h3>An <em>accidental<\/em> keypress in the search\/replace dialog crashes Geany<\/h3>\n<p>It doesn&#8217;t technically crash, but it becomes unresponsive for a very long time, minutes to hours. It does eventually finish.<\/p>\n<p>The keyboard shortcut for replace all in the document in the dialog is Alt + I (letter &#8220;I&#8221;). If Alt + O (letter &#8220;O&#8221;) is <em>accidentally<\/em> hit instead, it replaces all <strong><em>in all open documents<\/em><\/strong>. Letter &#8220;O&#8221; is right next to letter &#8220;I&#8221; on the keyboard, so this happens quite often.<\/p>\n<p>As Geany is generally very slow in replacing, especially if there are many replaces, documents with a few 100,000 lines of text will make Geany be frozen and unresponsive. Reverting the changes with Ctrl + Z in each document takes an equal amount of time. In most cases, if there aren&#8217;t any significant changes, it is easier to force quit Geany.<\/p>\n<h3>Opening a file with long lines crashes Geany<\/h3>\n<p>It doesn&#8217;t technically crash, but it becomes unresponsive for an unknown (long) length of time. 10 minutes? 2 days? Longer than the heat death of the universe? Who knows. It probably needs to be killed, so it is the same effect as a crash.<\/p>\n<p>It was tried on the export file (SQL) for the (MySQL) database for this very blog. It wasn&#8217;t that long, about 7&nbsp;MB and 20,000 lines. But the file had some long lines, e.g., 31000 characters (it seems to be the HTML content of the blog posts as long lines (one long line per a blog post)).<\/p>\n<p>By contrast, UltraEdit opens the exact same file instantly.<\/p>\n<h3>Search with a regular expression does not work backwards in the document<\/h3>\n<p>Button <em>&#8220;Previous&#8221;<\/em> is dimmed when <em>&#8220;Use regular expressions&#8221;<\/em> is checked.<\/p>\n<p>It at least ought to work on a line-to-line basis (go back one line, search forward &#8211; in most cases it wouldn&#8217;t matter if it only indicated the first match on a line).<\/p>\n<p>UltraEdit does not have a problem searching backwards, so it ought to work in Geany as well.<\/p>\n<h2>See also<\/h2>\n<p><em><a href=\"https:\/\/wiki.geany.org\/howtos\/start\">Geany HowTos<\/a><\/em> (Geany wiki)<\/p>\n<p><em><a href=\"https:\/\/wiki.geany.org\/howtos\/convert_camelcase\">Convert CamelCase to lower_case_underscore and vice versa<\/a><\/em> (Geany wiki). Uses Python and custom commands.<\/p>\n<p><em><a href=\"https:\/\/www.geany.org\/manual\/current\/index.html#user-definable-snippets\">User-definable snippets<\/a><\/em> (Geany user manual)<\/p>\n<p><!- Marker for editing in WordPress: pppp --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>UltraEdit for Linux is extremely buggy and corrupts the text documents. The corruption happens with using column mode, possibly worsened by using split windows (I mostly use vertically split). Column mode has always been buggy in UltraEdit, but in the &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/pmortensen.eu\/world2\/2020\/03\/29\/using-geany\/\"> <span class=\"screen-reader-text\">Using Geany as a replacement for UltraEdit<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17,23,18,24],"tags":[],"_links":{"self":[{"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/posts\/333"}],"collection":[{"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/comments?post=333"}],"version-history":[{"count":510,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/posts\/333\/revisions"}],"predecessor-version":[{"id":6113,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/posts\/333\/revisions\/6113"}],"wp:attachment":[{"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/media?parent=333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/categories?post=333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/tags?post=333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}