Mercurial > vim
annotate vimtutor.bat @ 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 | 79aaaa134298 |
children |
rev | line source |
---|---|
7 | 1 :: Start Vim on a copy of the tutor file. |
2 @echo off | |
3 | |
4 :: Usage: vimtutor [-console] [xx] | |
5 :: | |
6 :: -console means gvim will not be used | |
7 :: xx is a language code like "es" or "nl". | |
8 :: When an xx argument is given, it tries loading that tutor. | |
9 :: When this fails or no xx argument was given, it tries using 'v:lang' | |
10 :: When that also fails, it uses the English version. | |
11 | |
12 :: Use Vim to copy the tutor, it knows the value of $VIMRUNTIME | |
19711
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
13 FOR %%d in (. %TMP% %TEMP%) DO ( |
25812
79aaaa134298
patch 8.2.3441: MS-Windows: vimtutor can't handle path with spaces
Bram Moolenaar <Bram@vim.org>
parents:
25700
diff
changeset
|
14 call :test_dir_writable "%~dpf0" %%d |
19711
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
15 IF NOT ERRORLEVEL 1 GOTO dir_ok |
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
16 ) |
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
17 |
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
18 echo No working directory is found |
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
19 GOTO end |
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
20 |
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
21 :test_dir_writable |
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
22 SET TUTORCOPY=%2\$tutor$ |
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
23 COPY %1 %TUTORCOPY% >nul 2>nul |
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
24 GOTO end |
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
25 |
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
26 :dir_ok |
7 | 27 |
28 SET xx=%1 | |
29 | |
30 IF NOT .%1==.-console GOTO use_gui | |
31 SHIFT | |
32 SET xx=%1 | |
33 GOTO use_vim | |
34 :use_gui | |
35 | |
36 :: Try making a copy of tutor with gvim. If gvim cannot be found, try using | |
37 :: vim instead. If vim cannot be found, alert user to check environment and | |
38 :: installation. | |
39 | |
40 :: The script tutor.vim tells Vim which file to copy. | |
19711
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
41 start "dummy" /b /w "%~dp0gvim.exe" -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim" |
7 | 42 IF ERRORLEVEL 1 GOTO use_vim |
43 | |
44 :: Start gvim without any .vimrc, set 'nocompatible' | |
19711
831a3f3be6f4
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Bram Moolenaar <Bram@vim.org>
parents:
13113
diff
changeset
|
45 start "dummy" /b /w "%~dp0gvim.exe" -u NONE -c "set nocp" %TUTORCOPY% |
7 | 46 |
47 GOTO end | |
48 | |
49 :use_vim | |
50 :: The script tutor.vim tells Vim which file to copy | |
12485
ab40ecb0fd73
patch 8.0.1122: vimtutor.bat doesn't work well with vim.bat
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
51 call vim -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim" |
7 | 52 IF ERRORLEVEL 1 GOTO no_executable |
53 | |
54 :: Start vim without any .vimrc, set 'nocompatible' | |
12485
ab40ecb0fd73
patch 8.0.1122: vimtutor.bat doesn't work well with vim.bat
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
55 call vim -u NONE -c "set nocp" %TUTORCOPY% |
7 | 56 |
57 GOTO end | |
58 | |
59 :no_executable | |
60 ECHO. | |
61 ECHO. | |
62 ECHO No vim or gvim found in current directory or PATH. | |
63 ECHO Check your installation or re-run install.exe | |
64 | |
65 :end | |
66 :: remove the copy of the tutor | |
67 IF EXIST %TUTORCOPY% DEL %TUTORCOPY% | |
68 SET xx= |