How do I setup keyboard macros?How do I assign a string as a keyboard shortcut?Permanant shortcut to paste custom textCan I use Keyboard Shortcuts to implement text macros?How can I assign macros to my keyboard keys on Ubuntu, similar to Razer Keyboard Macros in Windows?what is a good mouse/keyboard macro recorder?Can I create a keyboard shortcut to kicking on my WiFi hotspot?Can I use Keyboard Shortcuts to implement text macros?Cannot type after Gnome login since last updateIs there any way to use QWERTY's keyboard shortcut position while the Dvorak layout is active?Is there a way how to customize my keyboard layout in Xubuntu in a graphical way (by clicking)?Unity elements sometimes appear while full screen in Virtualbox - how to stop it?How can I assign macros to my keyboard keys on Ubuntu, similar to Razer Keyboard Macros in Windows?Gaming macros on ubuntuUsing macros on blackwidow ultimateRemapping USB number keypad as text macros?Is it possible to have a complex macro layout using multiple keyboards?

Finitely many repeated replacements

What do *foreign films* mean for an American?

Possible to detect presence of nuclear bomb?

Is it a Cyclops number? "Nobody" knows!

Is it safe to abruptly remove Arduino power?

What is this diamond of every day?

What is the population of Romulus in the TNG era?

Professor forcing me to attend a conference, I can't afford even with 50% funding

When a wind turbine does not produce enough electricity how does the power company compensate for the loss?

How do we create new idioms and use them in a novel?

The meaning of ‘otherwise’

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

Confusion about Complex Continued Fraction

Why couldn't the separatists legally leave the Republic?

How exactly does an Ethernet collision happen in the cable, since nodes use different circuits for Tx and Rx?

Proving a statement about real numbers

Why do we say ‘pairwise disjoint’, rather than ‘disjoint’?

NASA's RS-25 Engines

Doesn't allowing a user mode program to access kernel space memory and execute the IN and OUT instructions defeat the purpose of having CPU modes?

In the late 1940’s to early 1950’s what technology was available that could melt ice?

What materials can be used to make a humanoid skin warm?

Which situations would cause a company to ground or recall a aircraft series?

What is better: yes / no radio, or simple checkbox?

What are some noteworthy "mic-drop" moments in math?



How do I setup keyboard macros?


How do I assign a string as a keyboard shortcut?Permanant shortcut to paste custom textCan I use Keyboard Shortcuts to implement text macros?How can I assign macros to my keyboard keys on Ubuntu, similar to Razer Keyboard Macros in Windows?what is a good mouse/keyboard macro recorder?Can I create a keyboard shortcut to kicking on my WiFi hotspot?Can I use Keyboard Shortcuts to implement text macros?Cannot type after Gnome login since last updateIs there any way to use QWERTY's keyboard shortcut position while the Dvorak layout is active?Is there a way how to customize my keyboard layout in Xubuntu in a graphical way (by clicking)?Unity elements sometimes appear while full screen in Virtualbox - how to stop it?How can I assign macros to my keyboard keys on Ubuntu, similar to Razer Keyboard Macros in Windows?Gaming macros on ubuntuUsing macros on blackwidow ultimateRemapping USB number keypad as text macros?Is it possible to have a complex macro layout using multiple keyboards?













13















In my daily life I'm always typing <kbd>Keyboard Character</kbd> and I'd like to set up a macro in Ubuntu to automatically enter <kbd> </kbd>.



I'd like to assign it to say Shift+Control+K or whatever keyboard control character combination isn't assigned and already used by Ubuntu.



Back in the day of TSR (Terminate and Stay Resident) MS-DOS programs this was possible. Certainly it must be in Ubuntu too?



Do I have to write a daemon to accomplish this?










share|improve this question
























  • Points for bringing up the TSR :-)

    – drudru
    Jan 18 at 1:01















13















In my daily life I'm always typing <kbd>Keyboard Character</kbd> and I'd like to set up a macro in Ubuntu to automatically enter <kbd> </kbd>.



I'd like to assign it to say Shift+Control+K or whatever keyboard control character combination isn't assigned and already used by Ubuntu.



Back in the day of TSR (Terminate and Stay Resident) MS-DOS programs this was possible. Certainly it must be in Ubuntu too?



Do I have to write a daemon to accomplish this?










share|improve this question
























  • Points for bringing up the TSR :-)

    – drudru
    Jan 18 at 1:01













13












13








13


4






In my daily life I'm always typing <kbd>Keyboard Character</kbd> and I'd like to set up a macro in Ubuntu to automatically enter <kbd> </kbd>.



I'd like to assign it to say Shift+Control+K or whatever keyboard control character combination isn't assigned and already used by Ubuntu.



Back in the day of TSR (Terminate and Stay Resident) MS-DOS programs this was possible. Certainly it must be in Ubuntu too?



Do I have to write a daemon to accomplish this?










share|improve this question
















In my daily life I'm always typing <kbd>Keyboard Character</kbd> and I'd like to set up a macro in Ubuntu to automatically enter <kbd> </kbd>.



I'd like to assign it to say Shift+Control+K or whatever keyboard control character combination isn't assigned and already used by Ubuntu.



Back in the day of TSR (Terminate and Stay Resident) MS-DOS programs this was possible. Certainly it must be in Ubuntu too?



Do I have to write a daemon to accomplish this?







keyboard shortcut-keys






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 '17 at 3:51









muru

1




1










asked Dec 31 '16 at 22:21









WinEunuuchs2UnixWinEunuuchs2Unix

46.5k1190180




46.5k1190180












  • Points for bringing up the TSR :-)

    – drudru
    Jan 18 at 1:01

















  • Points for bringing up the TSR :-)

    – drudru
    Jan 18 at 1:01
















Points for bringing up the TSR :-)

– drudru
Jan 18 at 1:01





Points for bringing up the TSR :-)

– drudru
Jan 18 at 1:01










3 Answers
3






active

oldest

votes


















11














I found other questions here (How to assign macros to my keyboard keys on Ubuntu, similar to Razer Keyboard Macros in windows?) and here (what is a good mouse/keyboard macro recorder?) with no answers.



I found a similar question with an answer here (Can I use Keyboard Shortcuts to implement text macros?). However that question stipulated the answer could not be AutoKey.



I did some googling and found the program called AutoKey (Autokey - Linux utility for text substitution hotkeys) near the top of the list.



Rather than a hotkey using Ctrl+Shift+K I chose to assign the abbreviation "k z" (with no space in between) which is automatically expanded into "< k b d > < / k b d > +" (with no spaces in between)



It is simply installed using:



sudo apt install autokey-gtk


It installs in Launcher and the screen is pretty simple to use:



Autokey






share|improve this answer
































    9














    What also can be done is to use xdotool withtype flag, like so:



    bash -c ' sleep 0.5; xdotool getactivewindow type "<kbd></kbd>"'


    Go to System Settings-> Keyboard-> Shortcuts -> Custom and bind that command to whatever keyboard shortcut you want. I chose CtrlSuperK. What happens here is that we give user delay of 0.5 seconds to release keyboard shortcut, and then xdotool will type out the key markup tags just as if you were doing it yourself on keyboard. Very easy and simple approach. In fact I am used it just now to put in those 3 keys above.



    Note that xdotool doesn't come with Ubuntu by default, so you will have to install it via sudo apt-get install xdotool






    share|improve this answer























    • Can you also make the insertion pointer go back so that it will be between <kbd> and </kbd>?

      – DK Bose
      Jan 1 '17 at 15:55






    • 3





      I'm using bash -c 'sleep 0.5; xdotool getactivewindow type "[CODE][/CODE]" && sleep 0.5 && xdotool key Left Left Left Left Left Left Left' to get the text cursor between the code tags.

      – DK Bose
      Jan 1 '17 at 16:29



















    0














    If you have a compose file you can use it as a poor-man’s text insertion utility.



    You can use a few of the modifiers in X. Apparently you can use Shift as a modifier:



    ! Ctrl Shift <k> : "<kbd></kbd>"


    But this does not work, at least on my machine.



    Nor does this work (omitted Shift, capitalized K):



    ! Ctrl <K> : "<kbd></kbd>"


    However, you can use Ctrl and Ctrl+Alt:



    ! Ctrl Alt <k> : "<kbd></kbd>"
    ! Ctrl <k> : "<kbd></kbd>"


    Placing the cursor correctly



    The above mappings will place the cursor after the string (| indicates the cursor):



    <kbd></kbd>|


    I reckon there can be no general-purpose solution for putting the cursor inside of the tag; for that you would need to use a fit-for-purpose tool. But you can the cursor go inside the tag in certain applications.



    I use gnome-terminal with Bash which uses readline keybindings (Emacs-like). Ctrl-b is the keybinding for going backwards one character. In my terminal I can type Ctrl+v b and get the control character ^B (U+0002 (Start of Text)). So type six of these characters at the end of the string:



    ! Ctrl Alt <k> : "<kbd></kbd>^B^B^B^B^B^B"


    The cursor will be placed inside the tag if you are inside an application that interprets ^B correctly (e.g. terminals and Emacs):



    <kbd>|</kbd>


    Using the compose key



    You can of course use the compose key (<Multi_key>) to achieve the same thing. For example, use t (“tag”) and k (“keyboard”):



    <Multi_key> <t> <k> : "<kbd></kbd>^B^B^B^B^B^B"




    share






















      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "89"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f866619%2fhow-do-i-setup-keyboard-macros%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      11














      I found other questions here (How to assign macros to my keyboard keys on Ubuntu, similar to Razer Keyboard Macros in windows?) and here (what is a good mouse/keyboard macro recorder?) with no answers.



      I found a similar question with an answer here (Can I use Keyboard Shortcuts to implement text macros?). However that question stipulated the answer could not be AutoKey.



      I did some googling and found the program called AutoKey (Autokey - Linux utility for text substitution hotkeys) near the top of the list.



      Rather than a hotkey using Ctrl+Shift+K I chose to assign the abbreviation "k z" (with no space in between) which is automatically expanded into "< k b d > < / k b d > +" (with no spaces in between)



      It is simply installed using:



      sudo apt install autokey-gtk


      It installs in Launcher and the screen is pretty simple to use:



      Autokey






      share|improve this answer





























        11














        I found other questions here (How to assign macros to my keyboard keys on Ubuntu, similar to Razer Keyboard Macros in windows?) and here (what is a good mouse/keyboard macro recorder?) with no answers.



        I found a similar question with an answer here (Can I use Keyboard Shortcuts to implement text macros?). However that question stipulated the answer could not be AutoKey.



        I did some googling and found the program called AutoKey (Autokey - Linux utility for text substitution hotkeys) near the top of the list.



        Rather than a hotkey using Ctrl+Shift+K I chose to assign the abbreviation "k z" (with no space in between) which is automatically expanded into "< k b d > < / k b d > +" (with no spaces in between)



        It is simply installed using:



        sudo apt install autokey-gtk


        It installs in Launcher and the screen is pretty simple to use:



        Autokey






        share|improve this answer



























          11












          11








          11







          I found other questions here (How to assign macros to my keyboard keys on Ubuntu, similar to Razer Keyboard Macros in windows?) and here (what is a good mouse/keyboard macro recorder?) with no answers.



          I found a similar question with an answer here (Can I use Keyboard Shortcuts to implement text macros?). However that question stipulated the answer could not be AutoKey.



          I did some googling and found the program called AutoKey (Autokey - Linux utility for text substitution hotkeys) near the top of the list.



          Rather than a hotkey using Ctrl+Shift+K I chose to assign the abbreviation "k z" (with no space in between) which is automatically expanded into "< k b d > < / k b d > +" (with no spaces in between)



          It is simply installed using:



          sudo apt install autokey-gtk


          It installs in Launcher and the screen is pretty simple to use:



          Autokey






          share|improve this answer















          I found other questions here (How to assign macros to my keyboard keys on Ubuntu, similar to Razer Keyboard Macros in windows?) and here (what is a good mouse/keyboard macro recorder?) with no answers.



          I found a similar question with an answer here (Can I use Keyboard Shortcuts to implement text macros?). However that question stipulated the answer could not be AutoKey.



          I did some googling and found the program called AutoKey (Autokey - Linux utility for text substitution hotkeys) near the top of the list.



          Rather than a hotkey using Ctrl+Shift+K I chose to assign the abbreviation "k z" (with no space in between) which is automatically expanded into "< k b d > < / k b d > +" (with no spaces in between)



          It is simply installed using:



          sudo apt install autokey-gtk


          It installs in Launcher and the screen is pretty simple to use:



          Autokey







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 13 '17 at 12:24









          Community

          1




          1










          answered Dec 31 '16 at 23:10









          WinEunuuchs2UnixWinEunuuchs2Unix

          46.5k1190180




          46.5k1190180























              9














              What also can be done is to use xdotool withtype flag, like so:



              bash -c ' sleep 0.5; xdotool getactivewindow type "<kbd></kbd>"'


              Go to System Settings-> Keyboard-> Shortcuts -> Custom and bind that command to whatever keyboard shortcut you want. I chose CtrlSuperK. What happens here is that we give user delay of 0.5 seconds to release keyboard shortcut, and then xdotool will type out the key markup tags just as if you were doing it yourself on keyboard. Very easy and simple approach. In fact I am used it just now to put in those 3 keys above.



              Note that xdotool doesn't come with Ubuntu by default, so you will have to install it via sudo apt-get install xdotool






              share|improve this answer























              • Can you also make the insertion pointer go back so that it will be between <kbd> and </kbd>?

                – DK Bose
                Jan 1 '17 at 15:55






              • 3





                I'm using bash -c 'sleep 0.5; xdotool getactivewindow type "[CODE][/CODE]" && sleep 0.5 && xdotool key Left Left Left Left Left Left Left' to get the text cursor between the code tags.

                – DK Bose
                Jan 1 '17 at 16:29
















              9














              What also can be done is to use xdotool withtype flag, like so:



              bash -c ' sleep 0.5; xdotool getactivewindow type "<kbd></kbd>"'


              Go to System Settings-> Keyboard-> Shortcuts -> Custom and bind that command to whatever keyboard shortcut you want. I chose CtrlSuperK. What happens here is that we give user delay of 0.5 seconds to release keyboard shortcut, and then xdotool will type out the key markup tags just as if you were doing it yourself on keyboard. Very easy and simple approach. In fact I am used it just now to put in those 3 keys above.



              Note that xdotool doesn't come with Ubuntu by default, so you will have to install it via sudo apt-get install xdotool






              share|improve this answer























              • Can you also make the insertion pointer go back so that it will be between <kbd> and </kbd>?

                – DK Bose
                Jan 1 '17 at 15:55






              • 3





                I'm using bash -c 'sleep 0.5; xdotool getactivewindow type "[CODE][/CODE]" && sleep 0.5 && xdotool key Left Left Left Left Left Left Left' to get the text cursor between the code tags.

                – DK Bose
                Jan 1 '17 at 16:29














              9












              9








              9







              What also can be done is to use xdotool withtype flag, like so:



              bash -c ' sleep 0.5; xdotool getactivewindow type "<kbd></kbd>"'


              Go to System Settings-> Keyboard-> Shortcuts -> Custom and bind that command to whatever keyboard shortcut you want. I chose CtrlSuperK. What happens here is that we give user delay of 0.5 seconds to release keyboard shortcut, and then xdotool will type out the key markup tags just as if you were doing it yourself on keyboard. Very easy and simple approach. In fact I am used it just now to put in those 3 keys above.



              Note that xdotool doesn't come with Ubuntu by default, so you will have to install it via sudo apt-get install xdotool






              share|improve this answer













              What also can be done is to use xdotool withtype flag, like so:



              bash -c ' sleep 0.5; xdotool getactivewindow type "<kbd></kbd>"'


              Go to System Settings-> Keyboard-> Shortcuts -> Custom and bind that command to whatever keyboard shortcut you want. I chose CtrlSuperK. What happens here is that we give user delay of 0.5 seconds to release keyboard shortcut, and then xdotool will type out the key markup tags just as if you were doing it yourself on keyboard. Very easy and simple approach. In fact I am used it just now to put in those 3 keys above.



              Note that xdotool doesn't come with Ubuntu by default, so you will have to install it via sudo apt-get install xdotool







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jan 1 '17 at 3:34









              Sergiy KolodyazhnyySergiy Kolodyazhnyy

              73.8k9154323




              73.8k9154323












              • Can you also make the insertion pointer go back so that it will be between <kbd> and </kbd>?

                – DK Bose
                Jan 1 '17 at 15:55






              • 3





                I'm using bash -c 'sleep 0.5; xdotool getactivewindow type "[CODE][/CODE]" && sleep 0.5 && xdotool key Left Left Left Left Left Left Left' to get the text cursor between the code tags.

                – DK Bose
                Jan 1 '17 at 16:29


















              • Can you also make the insertion pointer go back so that it will be between <kbd> and </kbd>?

                – DK Bose
                Jan 1 '17 at 15:55






              • 3





                I'm using bash -c 'sleep 0.5; xdotool getactivewindow type "[CODE][/CODE]" && sleep 0.5 && xdotool key Left Left Left Left Left Left Left' to get the text cursor between the code tags.

                – DK Bose
                Jan 1 '17 at 16:29

















              Can you also make the insertion pointer go back so that it will be between <kbd> and </kbd>?

              – DK Bose
              Jan 1 '17 at 15:55





              Can you also make the insertion pointer go back so that it will be between <kbd> and </kbd>?

              – DK Bose
              Jan 1 '17 at 15:55




              3




              3





              I'm using bash -c 'sleep 0.5; xdotool getactivewindow type "[CODE][/CODE]" && sleep 0.5 && xdotool key Left Left Left Left Left Left Left' to get the text cursor between the code tags.

              – DK Bose
              Jan 1 '17 at 16:29






              I'm using bash -c 'sleep 0.5; xdotool getactivewindow type "[CODE][/CODE]" && sleep 0.5 && xdotool key Left Left Left Left Left Left Left' to get the text cursor between the code tags.

              – DK Bose
              Jan 1 '17 at 16:29












              0














              If you have a compose file you can use it as a poor-man’s text insertion utility.



              You can use a few of the modifiers in X. Apparently you can use Shift as a modifier:



              ! Ctrl Shift <k> : "<kbd></kbd>"


              But this does not work, at least on my machine.



              Nor does this work (omitted Shift, capitalized K):



              ! Ctrl <K> : "<kbd></kbd>"


              However, you can use Ctrl and Ctrl+Alt:



              ! Ctrl Alt <k> : "<kbd></kbd>"
              ! Ctrl <k> : "<kbd></kbd>"


              Placing the cursor correctly



              The above mappings will place the cursor after the string (| indicates the cursor):



              <kbd></kbd>|


              I reckon there can be no general-purpose solution for putting the cursor inside of the tag; for that you would need to use a fit-for-purpose tool. But you can the cursor go inside the tag in certain applications.



              I use gnome-terminal with Bash which uses readline keybindings (Emacs-like). Ctrl-b is the keybinding for going backwards one character. In my terminal I can type Ctrl+v b and get the control character ^B (U+0002 (Start of Text)). So type six of these characters at the end of the string:



              ! Ctrl Alt <k> : "<kbd></kbd>^B^B^B^B^B^B"


              The cursor will be placed inside the tag if you are inside an application that interprets ^B correctly (e.g. terminals and Emacs):



              <kbd>|</kbd>


              Using the compose key



              You can of course use the compose key (<Multi_key>) to achieve the same thing. For example, use t (“tag”) and k (“keyboard”):



              <Multi_key> <t> <k> : "<kbd></kbd>^B^B^B^B^B^B"




              share



























                0














                If you have a compose file you can use it as a poor-man’s text insertion utility.



                You can use a few of the modifiers in X. Apparently you can use Shift as a modifier:



                ! Ctrl Shift <k> : "<kbd></kbd>"


                But this does not work, at least on my machine.



                Nor does this work (omitted Shift, capitalized K):



                ! Ctrl <K> : "<kbd></kbd>"


                However, you can use Ctrl and Ctrl+Alt:



                ! Ctrl Alt <k> : "<kbd></kbd>"
                ! Ctrl <k> : "<kbd></kbd>"


                Placing the cursor correctly



                The above mappings will place the cursor after the string (| indicates the cursor):



                <kbd></kbd>|


                I reckon there can be no general-purpose solution for putting the cursor inside of the tag; for that you would need to use a fit-for-purpose tool. But you can the cursor go inside the tag in certain applications.



                I use gnome-terminal with Bash which uses readline keybindings (Emacs-like). Ctrl-b is the keybinding for going backwards one character. In my terminal I can type Ctrl+v b and get the control character ^B (U+0002 (Start of Text)). So type six of these characters at the end of the string:



                ! Ctrl Alt <k> : "<kbd></kbd>^B^B^B^B^B^B"


                The cursor will be placed inside the tag if you are inside an application that interprets ^B correctly (e.g. terminals and Emacs):



                <kbd>|</kbd>


                Using the compose key



                You can of course use the compose key (<Multi_key>) to achieve the same thing. For example, use t (“tag”) and k (“keyboard”):



                <Multi_key> <t> <k> : "<kbd></kbd>^B^B^B^B^B^B"




                share

























                  0












                  0








                  0







                  If you have a compose file you can use it as a poor-man’s text insertion utility.



                  You can use a few of the modifiers in X. Apparently you can use Shift as a modifier:



                  ! Ctrl Shift <k> : "<kbd></kbd>"


                  But this does not work, at least on my machine.



                  Nor does this work (omitted Shift, capitalized K):



                  ! Ctrl <K> : "<kbd></kbd>"


                  However, you can use Ctrl and Ctrl+Alt:



                  ! Ctrl Alt <k> : "<kbd></kbd>"
                  ! Ctrl <k> : "<kbd></kbd>"


                  Placing the cursor correctly



                  The above mappings will place the cursor after the string (| indicates the cursor):



                  <kbd></kbd>|


                  I reckon there can be no general-purpose solution for putting the cursor inside of the tag; for that you would need to use a fit-for-purpose tool. But you can the cursor go inside the tag in certain applications.



                  I use gnome-terminal with Bash which uses readline keybindings (Emacs-like). Ctrl-b is the keybinding for going backwards one character. In my terminal I can type Ctrl+v b and get the control character ^B (U+0002 (Start of Text)). So type six of these characters at the end of the string:



                  ! Ctrl Alt <k> : "<kbd></kbd>^B^B^B^B^B^B"


                  The cursor will be placed inside the tag if you are inside an application that interprets ^B correctly (e.g. terminals and Emacs):



                  <kbd>|</kbd>


                  Using the compose key



                  You can of course use the compose key (<Multi_key>) to achieve the same thing. For example, use t (“tag”) and k (“keyboard”):



                  <Multi_key> <t> <k> : "<kbd></kbd>^B^B^B^B^B^B"




                  share













                  If you have a compose file you can use it as a poor-man’s text insertion utility.



                  You can use a few of the modifiers in X. Apparently you can use Shift as a modifier:



                  ! Ctrl Shift <k> : "<kbd></kbd>"


                  But this does not work, at least on my machine.



                  Nor does this work (omitted Shift, capitalized K):



                  ! Ctrl <K> : "<kbd></kbd>"


                  However, you can use Ctrl and Ctrl+Alt:



                  ! Ctrl Alt <k> : "<kbd></kbd>"
                  ! Ctrl <k> : "<kbd></kbd>"


                  Placing the cursor correctly



                  The above mappings will place the cursor after the string (| indicates the cursor):



                  <kbd></kbd>|


                  I reckon there can be no general-purpose solution for putting the cursor inside of the tag; for that you would need to use a fit-for-purpose tool. But you can the cursor go inside the tag in certain applications.



                  I use gnome-terminal with Bash which uses readline keybindings (Emacs-like). Ctrl-b is the keybinding for going backwards one character. In my terminal I can type Ctrl+v b and get the control character ^B (U+0002 (Start of Text)). So type six of these characters at the end of the string:



                  ! Ctrl Alt <k> : "<kbd></kbd>^B^B^B^B^B^B"


                  The cursor will be placed inside the tag if you are inside an application that interprets ^B correctly (e.g. terminals and Emacs):



                  <kbd>|</kbd>


                  Using the compose key



                  You can of course use the compose key (<Multi_key>) to achieve the same thing. For example, use t (“tag”) and k (“keyboard”):



                  <Multi_key> <t> <k> : "<kbd></kbd>^B^B^B^B^B^B"





                  share











                  share


                  share










                  answered 7 mins ago









                  GuildensternGuildenstern

                  3871413




                  3871413



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f866619%2fhow-do-i-setup-keyboard-macros%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

                      Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

                      Antonio De Lisio Carrera Referencias Menú de navegación«Caracas: evolución relacional multipleja»«Cuando los gobiernos subestiman a las localidades: L a Iniciativa para la Integración de la Infraestructura Regional Suramericana (IIRSA) en la frontera Colombo-Venezolana»«Maestría en Planificación Integral del Ambiente»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«Conózcanos»«Caracas: evolución relacional multipleja»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»