11

I'm not able to use unicode composition (The ctrl+shift+u method) to enter unicode characters in Sublime Text 2 (v2.0.1, Build 2217) on Ubuntu 12.04 (Unity). To reproduce, just open up a tab and do this:

  1. Press ctrl+shift+u
  2. Type 00B0
  3. Press enter

Normally the degree sign (°) will be entered. I'm not sure if some Sublime command is overriding this keybinding, Is anyone else able to do this?

Martin Thoma
  • 3,604
  • 10
  • 36
  • 65
dhulihan
  • 308
  • 1
  • 3
  • 15

6 Answers6

24

I also got here, but these days it seems you really aren't meant to edit the default settings, and the binding can't be unbound in user settings.

My solution is to press ctrl+alt+shift+u in sublime. It works and I don't have to change any key bindings. Still have to press space when you're done.

Martin Thoma
  • 3,604
  • 10
  • 36
  • 65
13

I just ran into this same issue and I couldn't find an answer anywhere, but I did find a solution. The problem is that the default key bindings in Sublime for Linux overwrite ctrl+shift+u with a soft_redo command. To disable this:

  1. Open up your default key bindings: Preferences > Key Bindings - Default
  2. Search for ctrl+shift+u and comment out the line containing that key binding. For example: //{ "keys": ["ctrl+shift+u"], "command": "soft_redo" },. Optionally, you could remap this to a different key binding if you really want soft_redo (I have no idea what this command does See comment below for soft_redo functionality).
  3. Save and you're good to go!

One note though, you'll need to use <space> instead of <enter> when you've completed the unicode character code as Sublime has a key binding for <enter>.

Edit:

Since you can no longer easily edit the default key bindings in Sublime Text 3, I would suggest using the answer by @brandon-lockaby.

2

Being a Vim user, I'm used to working with my keyboard, and while my IDE is heavily configured, I like to use default options for computers which are not mine, for instance. This should work.

A possible solution which should work on any default setup:

Type any letter or word (just a placeholder), and just hit Ctrl+D. It selects the word.

Then press Ctrl+H. It opens search and replace. Hit Tab, type \x{<unicode>}, making sure RegEx is activated (toggled with Alt+R), and hit Ctrl+Shift+H to replace it with the Unicode value.

Hit Esc to close the search and replace menu.

If you need the same Unicode several times

After you've done one replacement, you can repeat the same process by selecting (with Ctrl+D again) whatever you want, and Ctrl+Shift+H will automatically replace it, since it stores your last replacement in memory. No need to bring up the menu again.

TL;DR:

Use search and replace. \x{<unicode} in RegEx mode will serve as Unicode characters.

mazunki
  • 275
1

By Editing 'Default (Linux).keymap' in /opt/sublime_text/Packages/Default.sublime-package one could disable the conflicting ctrl+shift+u binding

0xAnime
  • 11
0

In Sublime Text 3 you cannot alter the Default key bindings...normally. However, if you install PackageResourceViewer, you can use the command PackageResourceViewer: Open Resource and then choose Default, then Default (Linux).sublime.keymap...and then you can delete (or comment out) the soft_redo line, and save the file.

Phrogz
  • 1,052
0

The above solutions did not work for me on Ubuntu 22.04, using Sublime Build 4143.

The only solution that worked was to repeat the keybinding in the user keybinding, ommiting the "command":

{ "keys": ["ctrl+shift+u"] }

It won't show the underline "u" like other editors do, though. It will still print the correct character after entering the number and hitting the space key.

Suzana
  • 358