Is there a way to make my own shortcuts for terminal in gedit?

I mean, for example if I want to compile a C++ source, when I press F9 I want it to make g++ source_file.cpp (this is only an example)



For the command itself, you can use aliases.

Edit ~/.bash_aliases and add your alias like this:

alias foobar="g++ /location/of/file/file.cpp" Where foobar is the name of the custom command.

Then do . ~/.bash_aliases to reload the file.

As far as the hotkey part, I'll come back and add to my answer if I figure anything out about that, or hopefully someone else will know.

EDIT: Here is the full answer to your question (as best I can tell): Custom keyboard shortcut to lauch a terminal and run a command in Unity. It looks like it renders the alias section void, but I will leave it there.

EDIT2: Via http://ubuntuforums.org/archive/index.php/t-433538.html, check out gedit external tools: https://live.gnome.org/Gedit/Plugins/ExternalTools. This will give you a variable for your current file name for use in the command.

  • Ok, this is good, but, I actually want something else. For example, if I have in gedit one opened file, named FILE, I want to press F9 and I want it to compile my file.. for example g++ FILE. In VIM I know you have the '%' , but in gedit I can't find nothing :(. Anyway, thank you for helping me :) – Vlad Tarniceru Apr 7 '13 at 15:48
  • Think I have an answer for you. Edited it in!! – Gary Apr 7 '13 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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