Skip to content
cajhin edited this page May 25, 2022 · 3 revisions

Macros

There are two kinds of macros: default and configured.

The Default Macro

Capsicain provides a macro function out of the box.

Advantages:

  • you don't have to configure anything
  • it can record ESC keys
  • it can copy the macro code to the clipboard, so you can reuse it in your config.

The relevant commands are [ESC] + [ J K L ; ]

How to use it

  1. Optional: Show the capsicain console (I like to see it)
  2. Open a text editor
  3. Press ESC+J (recording of all key events starts)
  4. Type whatever you want in the Text editor.
    Note that all corrections are recorded, too.
  5. Press ESC+K (recording stops).
    Recording automatically stops after 100 characters (looks like you forgot to stop recording)
  6. Press ESC+L (the recorded keys are played back).
    Note that this is not a 'paste' but many single key downs and ups.
    For long texts, this may be too much too fast, and the result is garbled.
    Solution: press [ESC]+[.] to increase the playback delay between keys from 0 to 1 millisecond (this is usually enough)
  7. If you want to reuse that macro in a script: Press [ESC]+[;] to copy the macro to the clipboard
    Press Ctrl+V to paste the clipboard into your text editor
    That string can be used in a Function: sequence()

Real life example

Sometimes I need to indent a block of code with 4 spaces, but my editor can't do that.

I will:

  1. ESC+J to start recording
  2. edit one line (4* space, Down, Home)
  3. ESC+K to stop recording
  4. ESC+ L L L L L L L L L L L to indent 10 lines

Configured Macros

You can configure up to 20 macros in your config, using COMBOs like this:

COMBO F1 [&&] > recordMacro(1)   #record macro 1 with LCtrl+LShift+F1
COMBO F1 [&^] > playMacro(1)     #play back with LCtrl+F1

Stop recording a configured macro with ESC.

Secret macros for passwords

recordSecretMacro(1) the keys are never shown in the console log, and obfuscated in RAM.
This is not super securely encrypted, but probably good enough for the average password.

Note: you cannot have macro(1) and secretMacro(1) at the same time.