How to set hotkey to my css snippets

I have a css snippet as below:

  #dashed_underline {
  text-decoration: underline;
  text-decoration-style: dashed;
  }

when I select some text , I want to press a hotkey to call this css code. what can i do?
Thanks.

I’m not sure that CSS will do anything as is; perhaps it’s for use with a plugin?

In any event, this plugin will let you bind individual snippet files to a hotkey:

Thank you! I know this plugin, but i don’t know how to use it. There is no any help documents in this plugin.

Once installed and enabled, your snippet files will show up as hotkey options in Settings > Hotkeys. You can then set a hotkey for each.

1 Like

Snippets don’t work like that. You need to mark the text in some way that allows you to target it. For example if your dashed underline is for highlighting, you could restyle highlights to use that instead of a yellow background. If there isn’t an existing element that matches what you want to use, you can add HTML to your text and style that. There are plugins that can make that easier.

3 Likes