How to "bind" a character to a vi command?

Sometimes I write mainly in English, and I need to enter a special Unicode character, for example, a degree symbol or the Greek letter theta. However, both options for remembering the Unicode hexadecimal value, or copying / pasting it from the Internet, are very unsatisfactory.

Is there a way to create a custom command (for example: theta) so that when I enter the command, it automatically inserts a special character exactly where I need it?

+4
source share
1 answer

Search :abbr and :map for starters. I often use :map for sequences of vim commands, but more often I use yank and pull to work with uncomfortable characters. You can use "tyl to pull a letter (e.g. ΞΈ) into a named buffer ( t in this case), and then pull it when necessary (from command mode) with "tp . If you are careful, you can create a repertoire.

+1
source

Source: https://habr.com/ru/post/1388866/


All Articles