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


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:

  1. 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
  2. Copy the contents of the extracted or cloned (depending on how you downloaded) folder (duplicateline.plugin and duplicateline.py) to ~/.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
  3. Then open gedit → click the hamburger menu (the icon with the three lines on the top right) → PreferencesPlugins and check Duplicate Line.

    enter image description here

  4. 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 duplicateline.plugin and duplicateline.py from ~/.local/share/gedit/plugins.


This site is temporarily in read only mode and not accepting new answers.

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