add custom shortcut key combinations in nano text-editor

Forum rules
Before you post please read how to get help
ckonn
Level 2
Level 2
Posts: 50
Joined: Wed Oct 01, 2014 7:03 pm

add custom shortcut key combinations in nano text-editor

Postby ckonn » Tue Apr 25, 2017 11:23 am

Hello,

how I can set a keyboard shortcut, so that within nano text-editor I can press those keys and see a comment like "this file was created on 24.04.2017" appear at the beginning of every bash script, so the user would not have to write it every time again and again?

or, how to get the F2 key to put the hashbang #!/bin/bash into a new bash script in nano, while still allowing it to reduce the brightness of the screen when nano is not open?

thanks in advance!
linux mint 17.3 mate

lmuserx4849
Level 5
Level 5
Posts: 503
Joined: Wed Dec 17, 2014 2:55 am

Re: add custom shortcut key combinations in nano text-editor

Postby lmuserx4849 » Tue Apr 25, 2017 11:19 pm

ckonn wrote:...
how I can set a keyboard shortcut, so that within nano text-editor I can press those keys and see a comment like "this file was created on 24.04.2017" appear at the beginning of every bash script, so the user would not have to write it every time again and again?

or, how to get the F2 key to put the hashbang #!/bin/bash into a new bash script in nano, while still allowing it to reduce the brightness of the screen when nano is not open?
...


I'm not aware of nano having those features... vim or emacs... graphical editors too would have macros, fields, and templates.

A possible alternative: Linux Command has a script that creates a template. Scroll down to new_script. You could use this as a starting point, to create a skeletal new script complete with timestamp and interpreter. Just a thought...


Return to “Scripts & Bash”