Skip to content

Better Japanese word handling on Visual Studio Code.

License

Notifications You must be signed in to change notification settings

sgryjp/japanese-word-handler

Repository files navigation

Japanese Word Handler

Version (VS Marketplace) Rating (VS Marketplace) Installs (VS Marketplace)   CI status zlib license

Better cursor movement in Japanese text for VS Code.

How to activate the logic?

Just install the extension. Doing so changes the action for the keybindings below (on macOS, use ⌥Option instead of Ctrl):

  • Ctrl+Right
  • Ctrl+Left
  • Ctrl+Shift+Right
  • Ctrl+Shift+Left
  • Ctrl+Delete
  • Ctrl+Backspace

Although not visible in command platte, these actions are implemented as commands so that you can reassign any key combinations to them. The table below shows all available commands and their default keybindings:

Command Default Keybinding (except macOS) Default keybinding (for macOS)
japaneseWordHandler.cursorWordEndLeft [*1] [*1]
japaneseWordHandler.cursorWordEndLeftSelect [*1] [*1]
japaneseWordHandler.cursorWordEndRight Ctrl+Right Option+Right
japaneseWordHandler.cursorWordEndRightSelect Ctrl+Shift+Right Option+Shift+Right
japaneseWordHandler.cursorWordStartLeft Ctrl+Left Option+Left
japaneseWordHandler.cursorWordStartLeftSelect Ctrl+Shift+Left Option+Shift+Left
japaneseWordHandler.cursorWordStartRight [*1] [*1]
japaneseWordHandler.cursorWordStartRightSelect [*1] [*1]
japaneseWordHandler.deleteWordEndLeft [*1] [*1]
japaneseWordHandler.deleteWordEndRight Ctrl+Delete Option+Delete
japaneseWordHandler.deleteWordStartLeft Ctrl+Backspace Option+Backspace
japaneseWordHandler.deleteWordStartRight [*1] [*1]
  • [*1] Ctrl+Alt+Shift+9 is assigned for those commands so that they will appear in the Keyboard Shortcuts editor of VSCode. If you want to use those commands, please reassign other keybinding to them.

What's the difference from the original?

With the original logic, pressing Ctrl+Right while the cursor is at the beginning of a chunk of Japanese characters will move the cursor to the end of it.

Original cursor movement

With this extension, on the other hand, the cursor will stop at each place where the Japanese character type (Hiragana, Katakana, ...) changes.

Improved cursor movement

Known limitations

As of VSCode 1.37.0, extension cannot override word related actions below:

  • Word selection on double click
  • Automatic highlight of a word at where the cursor is
  • 'Match Whole Word' option of text search

Issue report

Please visit the project's GitHub page and report it.

Enjoy!