Skip to content

Commit 6f0d41f

Browse files
authored
Merge pull request #1107 from tsuyoshicho/update/20220612/map
Update map.{txt,jax}
2 parents 07ae1a3 + df8abfa commit 6f0d41f

File tree

2 files changed

+56
-16
lines changed

2 files changed

+56
-16
lines changed

doc/map.jax

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*map.txt* For Vim バージョン 9.0. Last change: 2022 May 09
1+
*map.txt* For Vim バージョン 9.0. Last change: 2022 Jun 18
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -61,6 +61,7 @@
6161
す。マップを入れ子にしたり再帰的にすることができます。
6262
Note: 空白は有効なノーマルモードのコマンドであるため、
6363
末尾の空白は {rhs} に含まれます。
64+
|map-trailing-white| を参照。
6465

6566
*:nore* *:norem*
6667
:no[remap] {lhs} {rhs} |mapmode-nvo| *:no* *:noremap* *:nor*
@@ -99,10 +100,8 @@
99100
削除します。他のモードのマップは残ります。
100101
{lhs} がマッピングの {rhs} にマッチするときも機能しま
101102
す。これは略語が適用された場合に使用します。
102-
Note: 末尾の空白は {lhs} に含まれます。次の unmap コマ
103-
ンドは機能しません: >
104-
:map @@ foo
105-
:unmap @@ | print
103+
Note: 末尾の空白は {lhs} に含まれます。
104+
|map-trailing-white| を参照。
106105

107106
:mapc[lear] |mapmode-nvo| *:mapc* *:mapclear*
108107
:nmapc[lear] |mapmode-n| *:nmapc* *:nmapclear*
@@ -167,14 +166,36 @@
167166
れず、次の入力まで待機状態になります。例えば空白文字を入力すれば "foo" と空白
168167
文字が挿入されます。"a" を入力すれば "bar" が挿入されます。
169168

169+
末尾空白 ~
170+
*map-trailing-white*
171+
このunmapコマンドは動作しません: >
172+
:map @@ foo
173+
:unmap @@ | print
174+
175+
なぜなら unmap "@@ " を試行するとき、コマンド区切りの "|" の前の空白を含んでい
176+
るためです。他の末尾空白の例として: >
177+
unmap @@
178+
unmap @@ # Vim9 script コメント
179+
unmap @@ " 旧来のスクリプトのコメント
180+
181+
`unmap @@ ` の末尾が空白文字のためエラーになりますが、これは見えないので特定す
182+
るのが非常に困難です。
183+
184+
一般的な解決策はマップしたキーの後の右にコマンド区切りの "|" を置くことです。
185+
その後に空白とコメントを続けます: >
186+
187+
unmap @@| # Vim9 script コメント
188+
unmap @@| " 旧来のスクリプトのコメント
189+
170190
171191
1.2 特別な引数 *:map-arguments*
172192

173193
引数に "<buffer>"、"<nowait>"、"<silent>"、"<special>"、"<script>"、"<expr>"、
174194
"<unique>" を指定できます。マップコマンドの直後 (他の引数の前) に置いてくださ
175195
い。
176196

177-
*:map-local* *:map-<buffer>* *:map-buffer* *E224* *E225*
197+
*:map-local* *:map-<buffer>* *:map-buffer*
198+
*E224* *E225*
178199
カレントバッファだけで使用できるマップを作成するには、マップコマンドの引数に
179200
"<buffer>" を指定します。例: >
180201
:map <buffer> ,w /[.,;]<CR>
@@ -365,8 +386,6 @@ Note:
365386
りません。
366387
- ビジュアルモードでは、`line('v')``col('v')` を使って、ビジュアルエリアの
367388
一端を取得でき、カーソルは反対の端にいます。
368-
- 選択モードでは、|:map||:vmap| コマンドでのマッピングがビジュアルモード内
369-
で実行されます。|:smap| を使う選択モードとは別の方法で処理します。
370389

371390
*E1255* *E1136*
372391
<Cmd><ScriptCmd> コマンドではマッピング定義の {rhs}<CR> で終わる必要が
@@ -698,6 +717,7 @@ Note: 変数 "mapleader" はマップを定義するときに使用されます
698717
*<MouseMove>*
699718
特別な文字列 "<MouseMove>" を使ってマウスの移動を取り扱えます。そのためには
700719
'mousemoveevent' が有効になっている必要があります。現在、GUI でのみ動作します。
720+
|getmousepos()| 関数がマウスの位置を取得するのに使えます。
701721

702722
*<Char>* *<Char->*
703723
<Char> を使って、文字を10進数、8進数、16進数の数値指定でマップできます:

en/map.txt

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*map.txt* For Vim version 9.0. Last change: 2022 May 09
1+
*map.txt* For Vim version 9.0. Last change: 2022 Jun 18
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -63,6 +63,7 @@ modes.
6363
allows for nested and recursive use of mappings.
6464
Note: Trailing spaces are included in the {rhs},
6565
because space is a valid Normal mode command.
66+
See |map-trailing-white|.
6667

6768
*:nore* *:norem*
6869
:no[remap] {lhs} {rhs} |mapmode-nvo| *:no* *:noremap* *:nor*
@@ -100,10 +101,8 @@ modes.
100101
for other modes where it applies.
101102
It also works when {lhs} matches the {rhs} of a
102103
mapping. This is for when an abbreviation applied.
103-
Note: Trailing spaces are included in the {lhs}. This
104-
unmap does NOT work: >
105-
:map @@ foo
106-
:unmap @@ | print
104+
Note: Trailing spaces are included in the {lhs}.
105+
See |map-trailing-white|.
107106

108107
:mapc[lear] |mapmode-nvo| *:mapc* *:mapclear*
109108
:nmapc[lear] |mapmode-n| *:nmapc* *:nmapclear*
@@ -168,14 +167,36 @@ that mapping won't get expanded yet, Vim is waiting for another character.
168167
If you type a space, then "foo" will get inserted, plus the space. If you
169168
type "a", then "bar" will get inserted.
170169

170+
Trailing white space ~
171+
*map-trailing-white*
172+
This unmap command does NOT work: >
173+
:map @@ foo
174+
:unmap @@ | print
175+
176+
Because it tries to unmap "@@ ", including the white space before the command
177+
separator "|". Other examples with trailing white space: >
178+
unmap @@
179+
unmap @@ # Vim9 script comment
180+
unmap @@ " legacy script comment
181+
182+
An error will be issued, which is very hard to identify, because the ending
183+
whitespace character in `unmap @@ ` is not visible.
184+
185+
A generic solution is to put the command separator "|" right after the mapped
186+
keys. After that white space and a comment may follow: >
187+
188+
unmap @@| # Vim9 script comment
189+
unmap @@| " legacy script comment
190+
171191
172192
1.2 SPECIAL ARGUMENTS *:map-arguments*
173193

174194
"<buffer>", "<nowait>", "<silent>", "<special>", "<script>", "<expr>" and
175195
"<unique>" can be used in any order. They must appear right after the
176196
command, before any other arguments.
177197

178-
*:map-local* *:map-<buffer>* *:map-buffer* *E224* *E225*
198+
*:map-local* *:map-<buffer>* *:map-buffer*
199+
*E224* *E225*
179200
If the first argument to one of these commands is "<buffer>" the mapping will
180201
be effective in the current buffer only. Example: >
181202
:map <buffer> ,w /[.,;]<CR>
@@ -374,8 +395,6 @@ Note:
374395
mapping is recursive.
375396
- In Visual mode you can use `line('v')` and `col('v')` to get one end of the
376397
Visual area, the cursor is at the other end.
377-
- In Select mode, |:map| and |:vmap| command mappings are executed in
378-
Visual mode. Use |:smap| to handle Select mode differently.
379398

380399
*E1255* *E1136*
381400
<Cmd> and <ScriptCmd> commands must terminate, that is, they must be followed
@@ -701,6 +720,7 @@ not to be matched with any key sequence. This is useful in plugins
701720
*<MouseMove>*
702721
The special key name "<MouseMove>" can be used to handle mouse movement. It
703722
needs to be enabled with 'mousemoveevent'. Currently only works in the GUI.
723+
The |getmousepos()| function can be used to obtain the mouse position.
704724

705725
*<Char>* *<Char->*
706726
To map a character by its decimal, octal or hexadecimal number the <Char>

0 commit comments

Comments
 (0)