Mercurial > vim
comparison runtime/doc/map.txt @ 34219:a0a4a774117b v9.1.0058
patch 9.1.0058: Cannot map Super Keys in GTK UI
Commit: https://github.com/vim/vim/commit/92e90a1e102825aa9149262cacfc991264db05df
Author: Casey Tucker <dctucker@hotmail.com>
Date: Thu Jan 25 22:44:00 2024 +0100
patch 9.1.0058: Cannot map Super Keys in GTK UI
Problem: Cannot map Super Keys in GTK UI
(Casey Tucker)
Solution: Enable Super Key mappings in GTK using <D-Key>
(Casey Tucker)
As a developer who works in both Mac and Linux using the same keyboard,
it can be frustrating having to remember different key combinations or
having to rely on system utilities to remap keys.
This change allows `<D-z>` `<D-x>` `<D-c>` `<D-v>` etc. to be recognized
by the `map` commands, along with the `<D-S-...>` shifted variants.
```vimrc
if has('gui_gtk')
nnoremap <D-z> u
nnoremap <D-S-Z> <C-r>
vnoremap <D-x> "+d
vnoremap <D-c> "+y
cnoremap <D-v> <C-R>+
inoremap <D-v> <C-o>"+gP
nnoremap <D-v> "+P
vnoremap <D-v> "-d"+P
nnoremap <D-s> :w<CR>
inoremap <D-s> <C-o>:w<CR>
nnoremap <D-w> :q<CR>
nnoremap <D-q> :qa<CR>
nnoremap <D-t> :tabe<CR>
nnoremap <D-S-T> :vs#<CR><C-w>T
nnoremap <D-a> ggVG
vnoremap <D-a> <ESC>ggVG
inoremap <D-a> <ESC>ggVG
nnoremap <D-f> /
nnoremap <D-g> n
nnoremap <D-S-G> N
vnoremap <D-x> "+x
endif
```
closes: #12698
Signed-off-by: Casey Tucker <dctucker@hotmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 25 Jan 2024 23:00:03 +0100 |
parents | a197265a2e07 |
children | a0754587f167 |
comparison
equal
deleted
inserted
replaced
34218:b383c7665d4d | 34219:a0a4a774117b |
---|---|
1 *map.txt* For Vim version 9.1. Last change: 2024 Jan 04 | 1 *map.txt* For Vim version 9.1. Last change: 2024 Jan 25 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
19 1.7 What keys to map |map-which-keys| | 19 1.7 What keys to map |map-which-keys| |
20 1.8 Examples |map-examples| | 20 1.8 Examples |map-examples| |
21 1.9 Using mappings |map-typing| | 21 1.9 Using mappings |map-typing| |
22 1.10 Mapping alt-keys |:map-alt-keys| | 22 1.10 Mapping alt-keys |:map-alt-keys| |
23 1.11 Mapping meta-keys |:map-meta-keys| | 23 1.11 Mapping meta-keys |:map-meta-keys| |
24 1.12 Mapping in modifyOtherKeys mode |modifyOtherKeys| | 24 1.12 Mapping super-keys or command keys |:map-super-keys| |
25 1.13 Mapping with Kitty keyboard protocol |kitty-keyboard-protocol| | 25 1.13 Mapping in modifyOtherKeys mode |modifyOtherKeys| |
26 1.14 Mapping an operator |:map-operator| | 26 1.14 Mapping with Kitty keyboard protocol |kitty-keyboard-protocol| |
27 1.15 Mapping an operator |:map-operator| | |
27 2. Abbreviations |abbreviations| | 28 2. Abbreviations |abbreviations| |
28 3. Local mappings and functions |script-local| | 29 3. Local mappings and functions |script-local| |
29 4. User-defined commands |user-commands| | 30 4. User-defined commands |user-commands| |
30 | 31 |
31 ============================================================================== | 32 ============================================================================== |
983 | 984 |
984 For the Meta modifier the "T" character is used. For example, to map Meta-b | 985 For the Meta modifier the "T" character is used. For example, to map Meta-b |
985 in Insert mode: > | 986 in Insert mode: > |
986 :imap <T-b> terrible | 987 :imap <T-b> terrible |
987 | 988 |
988 | 989 1.12 MAPPING SUPER-KEYS or COMMAND-KEYS *:map-super-keys* *:map-cmd-key* |
989 1.12 MAPPING IN modifyOtherKeys mode *modifyOtherKeys* | 990 |
991 The Super modifier is available in GUI mode (when |gui_running| is 1) for | |
992 GVim on Linux and MacVim on Mac OS. If you're on a Mac, this represents the | |
993 Command key, on Linux with the GTK GUI it represents the Super key. | |
994 The character "D" is used for the Super / Command modifier. | |
995 | |
996 For example, to map Command-b in Insert mode: > | |
997 :imap <D-b> barritone | |
998 | |
999 1.13 MAPPING IN modifyOtherKeys mode *modifyOtherKeys* | |
990 | 1000 |
991 Xterm and a few other terminals can be put in a mode where keys with modifiers | 1001 Xterm and a few other terminals can be put in a mode where keys with modifiers |
992 are sent with a special escape code. Vim recognizes these codes and can then | 1002 are sent with a special escape code. Vim recognizes these codes and can then |
993 make a difference between CTRL-H and Backspace, even when Backspace sends the | 1003 make a difference between CTRL-H and Backspace, even when Backspace sends the |
994 character 8. And many more special keys, such as Tab and CTRL-I, which cannot | 1004 character 8. And many more special keys, such as Tab and CTRL-I, which cannot |
1046 | 1056 |
1047 When the 'esckeys' option is off, then modifyOtherKeys will be disabled in | 1057 When the 'esckeys' option is off, then modifyOtherKeys will be disabled in |
1048 Insert mode to avoid every key with a modifier causing Insert mode to end. | 1058 Insert mode to avoid every key with a modifier causing Insert mode to end. |
1049 | 1059 |
1050 | 1060 |
1051 1.13 MAPPING WITH KITTY KEYBOARD PROTOCOL *kitty-keyboard-protocol* | 1061 1.14 MAPPING WITH KITTY KEYBOARD PROTOCOL *kitty-keyboard-protocol* |
1052 | 1062 |
1053 If the value of 'term' contains "kitty" then Vim will send out an escape | 1063 If the value of 'term' contains "kitty" then Vim will send out an escape |
1054 sequence to enable the Kitty keyboard protocol. This can be changed with the | 1064 sequence to enable the Kitty keyboard protocol. This can be changed with the |
1055 'keyprotocol' option. | 1065 'keyprotocol' option. |
1056 | 1066 |
1073 by 't_TE' | 1083 by 't_TE' |
1074 Cleared protocol expected to have been disabled by 't_TE', | 1084 Cleared protocol expected to have been disabled by 't_TE', |
1075 previous state is unknown | 1085 previous state is unknown |
1076 | 1086 |
1077 | 1087 |
1078 1.14 MAPPING AN OPERATOR *:map-operator* | 1088 1.15 MAPPING AN OPERATOR *:map-operator* |
1079 | 1089 |
1080 An operator is used before a {motion} command. To define your own operator | 1090 An operator is used before a {motion} command. To define your own operator |
1081 you must create a mapping that first sets the 'operatorfunc' option and then | 1091 you must create a mapping that first sets the 'operatorfunc' option and then |
1082 invoke the |g@| operator. After the user types the {motion} command the | 1092 invoke the |g@| operator. After the user types the {motion} command the |
1083 specified function will be called. | 1093 specified function will be called. |