-1

So I have a text for example "this is sample text" and I want it to become this "<![CDATA[this is sample text]]>"

I want to work this function like this: I select any text and use hotkey like ctrl+t or so.

I use Sublime Text 3.

How can I do this for the selection of text?

Keith Hall
  • 15,362
  • 3
  • 53
  • 71
Linas
  • 17
  • 5

1 Answers1

1

You can create a new keybinding to use the insert_snippet command to wrap your selection. (Preferences menu -> Keybindings)

{ "keys": ["ctrl+t"], "command": "insert_snippet", "args": {"contents": "<![CDATA[${0:$SELECTION}]]>"}, "context":
    [
        { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true },
    ]
},
Keith Hall
  • 15,362
  • 3
  • 53
  • 71