Using espanso as a global text editor

May 13, 2024

Configuration

Installation:

Config file:

  • run espanso path to determine config location
    • on Windows this defaults to C:\Users\lmiloszewski\AppData\Roaming\espanso

Add symlink to dotfile:

# start admin session
Start-Process powershell -Verb runAs
 
# move folder and setup symlink
Move-Item "C:\Users\lmiloszewski\AppData\Roaming\espanso" "C:\Users\lmiloszewski\code\dotfiles\espanso"
New-Item -ItemType SymbolicLink -Path "C:\Users\lmiloszewski\AppData\Roaming\espanso" -Target "C:\Users\lmiloszewski\code\dotfiles\espanso"
 
# confirm symlink
Get-Item "C:\Users\lmiloszewski\AppData\Roaming\espanso"

Basic usage

Matches:

  • matches are defined within the configuration file espanso\match\prompts.yml
  • trigger these matches by running :some-command in any text editor
matches:
  - trigger: ":gpt-md"
    replace: |
      Return the output above in markdown file format. Don't use any headers or any formatting utilities (bold, italics, underlines). Relevant sections can be seperated by normal text which references related content as nested bullet points below. Here is an example output format (make sure to copy this format including the spacing and new lines):
 
      ```md
      Heading 1:
 
      - pros
          - something good
      - cons
          - something bad
 
      Heading 2:
 
      - some comments
 
      ```python
      # this is a code block
      import this

Cursor:

  • when inserting text, make the pointer appear at a certain location: $|$