Is there a way to duplicate current line in gedit using a keyboard shortcut?
OS: Ubuntu 20.04.1 LTS
gedit version: 3.36.2
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
As far as what I searched, there is no official keyboard shortcut for duplicating a current line in gedit.
Refer this link for more information: https://help.gnome.org/users/gedit/stable/gedit-shortcut-keys.html.en
There actually is a 3rd party gedit plugin (compatible with gedit version >= 3.14) that adds a keyboard shortcut to duplicate the current line or selection. Here is how to enable it:
Download and extract the zip file containing the plugin from this GitHub repository: https://github.com/hannenz/duplicate
Alternatively you can use
git (install it running
sudo apt install git) to download it in your
~ folder using:
git clone https://github.com/hannenz/duplicate.git ~/duplicate
Copy the contents of the extracted or cloned (depending on how you downloaded) folder (
~/.local/share/gedit/plugins. If the folder does not exist, create it using your file manager or by running:
mkdir -p ~/.local/share/gedit/plugins
Then open gedit → click the hamburger menu (the icon with the three lines on the top right) → Preferences → Plugins and check Duplicate Line.
You can now use the Ctrl+Shift+D shortcut to duplicate the current line or selection.
To uninstall the plugin follow step 3 and uncheck Duplicate Line and also delete the files