Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tmux-langmap

CI

Makes tmux bindings work from a Cyrillic keyboard layout, like Vim's langmap option does for Vim. At load the plugin reads your current bindings and duplicates each one onto the character the same physical key produces in a Cyrillic layout: prefix c gets a twin prefix с, copy-mode j gets о, prefix " gets Э. No more switching to a Latin layout to control tmux.

Existing bindings are never overwritten, and re-running (e.g. on config reload) cleans up its own stale mirrors instead of duplicating them.

Install

With TPM, add as the last plugin so it sees keys bound by the plugins before it:

set -g @plugin 'lukashes/tmux-langmap'

Manual: clone anywhere and add after all other bindings and plugins:

run-shell ~/path/to/tmux-langmap/langmap.tmux

A layout-independent prefix is recommended (the plugin does not change it):

set -g prefix C-Space

macOS binds Ctrl+Space to input source switching by default; free it in System Settings > Keyboard > Keyboard Shortcuts > Input Sources.

Options

Set before the plugin loads. Defaults:

set -g @langmap-layouts 'ru-pc ru-mac'
set -g @langmap-tables  'prefix copy-mode copy-mode-vi'

@langmap-layouts takes names of files in layouts/ or absolute paths to custom .map files. Both Russian layouts are applied by default; letter keys are identical between them, so this needs no configuration.

@langmap-tables lists the key tables to mirror. Add root if you have bind -n shortcuts.

Apply

Bindings created after the plugin loaded (a later bind-key, a plugin listed after this one) are not mirrored until you re-apply:

run-shell ~/.config/tmux/plugins/tmux-langmap/scripts/mirror.sh

Reloading your config re-runs the plugin, which is the same thing.

What is not mirrored

  • Punctuation whose Cyrillic-position character lands on an already bound ASCII key. Example on Russian - PC: the physical / key produces ., and prefix . already means move-window, so it is left alone.
  • Text typed into prompts (command-prompt, the choose-tree filter) and display-menu shortcuts stay layout-dependent.

Adding a layout

On macOS the map file is generated straight from the system layout data (the tool reads it via the Carbon framework, so this part is macOS only):

make list-layouts                # find your layout's name
make layout LAYOUT=Ukrainian     # writes layouts/ukrainian.map

Then enable it:

set -g @langmap-layouts 'ukrainian'

Short names expand to com.apple.keylayout.<name>; BASE= (default ABC) and OUT= override the reference layout and the output path. Maps are generated for the ANSI keyboard type; a few corner keys differ on ISO/JIS keyboards, pass --kbd-type native to tools/dump_layout.py for your machine's own type. On other systems write the file by hand: <us-char><TAB><target-char> per line, both cases listed explicitly, identity pairs omitted (see the shipped maps).

Development

make test      # golden (awk transform vs fixtures) + integration (isolated tmux server)
               # + maptool (shipped maps vs live macOS layout data; skipped elsewhere)
make apply     # apply mirrors to the running tmux server
make fixtures  # re-capture test fixtures from a clean tmux server
make lint      # shellcheck over the shell entry points

About

Tmux plugin for mirroring language-specific keyboard bindings

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages