3

Is there any way (Plugin, Script) to add quotation marks (or square brackets or parentheses) at the beginning and the end of selected text via a keyboard shortcut in the Kate editor?

I think of something like selecting a word and then pressing Ctrl-U (this would upcase the selected word). Is there something similar for quotation marks?

The "Configure Shortcuts" menu does not provide this option.

user1251007
  • 15,891
  • 14
  • 50
  • 76

2 Answers2

1

This should be possible to do by using Kate's Javascript plugin system: http://docs.kde.org/stable/en/kde-baseapps/kate/advanced-editing-tools-scripting.html.

By finding the word at the current cursor position and inserting text before and after, you could create a “surround with quotation marks” function.

For an example of a Kate script, see here: http://kucrut.org/move-cursor-to-next-prev-paragraph-in-kate/.

beta
  • 2,380
  • 21
  • 38
1

One solution would be the following:

  • Go to Settings > Configure Kate > Editing
  • Activate the Auto brackets option

Now you are able to wrap the selected text with brackets.

Though there is one drawback. The Auto brackets option is "always on", meaning that once you type "(" the corresponding ")" also comes up.

user1251007
  • 15,891
  • 14
  • 50
  • 76