|
Karsten Hopp |
9316c5 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
9316c5 |
Subject: Patch 7.3.1179
|
|
Karsten Hopp |
9316c5 |
Fcc: outbox
|
|
Karsten Hopp |
9316c5 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
9316c5 |
Mime-Version: 1.0
|
|
Karsten Hopp |
9316c5 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
9316c5 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
9316c5 |
------------
|
|
Karsten Hopp |
9316c5 |
|
|
Karsten Hopp |
9316c5 |
Patch 7.3.1179
|
|
Karsten Hopp |
9316c5 |
Problem: When a global mapping starts with the same characters as a
|
|
Karsten Hopp |
9316c5 |
buffer-local mapping Vim waits for a character to be typed to find
|
|
Karsten Hopp |
9316c5 |
out whether the global mapping is to be used. (Andy Wokula)
|
|
Karsten Hopp |
9316c5 |
Solution: Use the local mapping without waiting. (Michael Henry)
|
|
Karsten Hopp |
9316c5 |
Files: runtime/doc/map.txt, src/getchar.c
|
|
Karsten Hopp |
9316c5 |
|
|
Karsten Hopp |
9316c5 |
|
|
Karsten Hopp |
9316c5 |
*** ../vim-7.3.1178/runtime/doc/map.txt 2013-06-08 15:24:41.000000000 +0200
|
|
Karsten Hopp |
9316c5 |
--- runtime/doc/map.txt 2013-06-12 20:50:01.000000000 +0200
|
|
Karsten Hopp |
9316c5 |
***************
|
|
Karsten Hopp |
9316c5 |
*** 107,112 ****
|
|
Karsten Hopp |
9316c5 |
--- 107,114 ----
|
|
Karsten Hopp |
9316c5 |
:cmapc[lear] |mapmode-c| *:cmapc* *:cmapclear*
|
|
Karsten Hopp |
9316c5 |
Remove ALL mappings for the modes where the map
|
|
Karsten Hopp |
9316c5 |
command applies. {not in Vi}
|
|
Karsten Hopp |
9316c5 |
+ Use the <buffer> argument to remove buffer-local
|
|
Karsten Hopp |
9316c5 |
+ mappings |:map-<buffer>|
|
|
Karsten Hopp |
9316c5 |
Warning: This also removes the default mappings.
|
|
Karsten Hopp |
9316c5 |
|
|
Karsten Hopp |
9316c5 |
:map |mapmode-nvo|
|
|
Karsten Hopp |
9316c5 |
***************
|
|
Karsten Hopp |
9316c5 |
*** 173,178 ****
|
|
Karsten Hopp |
9316c5 |
--- 175,181 ----
|
|
Karsten Hopp |
9316c5 |
:mapclear <buffer>
|
|
Karsten Hopp |
9316c5 |
Local mappings are also cleared when a buffer is deleted, but not when it is
|
|
Karsten Hopp |
9316c5 |
unloaded. Just like local option values.
|
|
Karsten Hopp |
9316c5 |
+ Also see |map-precedence|.
|
|
Karsten Hopp |
9316c5 |
|
|
Karsten Hopp |
9316c5 |
*:map-<silent>* *:map-silent*
|
|
Karsten Hopp |
9316c5 |
To define a mapping which will not be echoed on the command line, add
|
|
Karsten Hopp |
9316c5 |
***************
|
|
Karsten Hopp |
9316c5 |
*** 644,649 ****
|
|
Karsten Hopp |
9316c5 |
--- 655,672 ----
|
|
Karsten Hopp |
9316c5 |
you type slowly, or your system is slow, reset the 'timeout' option. Then you
|
|
Karsten Hopp |
9316c5 |
might want to set the 'ttimeout' option.
|
|
Karsten Hopp |
9316c5 |
|
|
Karsten Hopp |
9316c5 |
+ *map-precedence*
|
|
Karsten Hopp |
9316c5 |
+ Buffer-local mappings (defined using |:map-<buffer>|) take precedence over
|
|
Karsten Hopp |
9316c5 |
+ global mappings. When a buffer-local mapping is the same as a global mapping,
|
|
Karsten Hopp |
9316c5 |
+ Vim will use the buffer-local mapping. In addition, Vim will use a complete
|
|
Karsten Hopp |
9316c5 |
+ buffer-local mapping immediately, even if a longer global mapping has the
|
|
Karsten Hopp |
9316c5 |
+ buffer-local mapping as a prefix. For example, given the following two
|
|
Karsten Hopp |
9316c5 |
+ mappings: >
|
|
Karsten Hopp |
9316c5 |
+ :map <buffer> \a :echo "Local \a"<CR>
|
|
Karsten Hopp |
9316c5 |
+ :map \abc :echo "Global \abc"<CR>
|
|
Karsten Hopp |
9316c5 |
+ The buffer-local mapping \a will be used immediately. Vim will not wait for
|
|
Karsten Hopp |
9316c5 |
+ more characters to see if the user might be typing \abc.
|
|
Karsten Hopp |
9316c5 |
+
|
|
Karsten Hopp |
9316c5 |
*map-keys-fails*
|
|
Karsten Hopp |
9316c5 |
There are situations where key codes might not be recognized:
|
|
Karsten Hopp |
9316c5 |
- Vim can only read part of the key code. Mostly this is only the first
|
|
Karsten Hopp |
9316c5 |
*** ../vim-7.3.1178/src/getchar.c 2013-05-06 05:50:22.000000000 +0200
|
|
Karsten Hopp |
9316c5 |
--- src/getchar.c 2013-06-12 20:52:49.000000000 +0200
|
|
Karsten Hopp |
9316c5 |
***************
|
|
Karsten Hopp |
9316c5 |
*** 1924,1929 ****
|
|
Karsten Hopp |
9316c5 |
--- 1924,1930 ----
|
|
Karsten Hopp |
9316c5 |
mapblock_T *mp;
|
|
Karsten Hopp |
9316c5 |
#ifdef FEAT_LOCALMAP
|
|
Karsten Hopp |
9316c5 |
mapblock_T *mp2;
|
|
Karsten Hopp |
9316c5 |
+ int expecting_global_mappings;
|
|
Karsten Hopp |
9316c5 |
#endif
|
|
Karsten Hopp |
9316c5 |
mapblock_T *mp_match;
|
|
Karsten Hopp |
9316c5 |
int mp_match_len = 0;
|
|
Karsten Hopp |
9316c5 |
***************
|
|
Karsten Hopp |
9316c5 |
*** 2105,2110 ****
|
|
Karsten Hopp |
9316c5 |
--- 2106,2112 ----
|
|
Karsten Hopp |
9316c5 |
/* First try buffer-local mappings. */
|
|
Karsten Hopp |
9316c5 |
mp = curbuf->b_maphash[MAP_HASH(local_State, c1)];
|
|
Karsten Hopp |
9316c5 |
mp2 = maphash[MAP_HASH(local_State, c1)];
|
|
Karsten Hopp |
9316c5 |
+ expecting_global_mappings = (mp && mp2);
|
|
Karsten Hopp |
9316c5 |
if (mp == NULL)
|
|
Karsten Hopp |
9316c5 |
{
|
|
Karsten Hopp |
9316c5 |
mp = mp2;
|
|
Karsten Hopp |
9316c5 |
***************
|
|
Karsten Hopp |
9316c5 |
*** 2128,2133 ****
|
|
Karsten Hopp |
9316c5 |
--- 2130,2145 ----
|
|
Karsten Hopp |
9316c5 |
#endif
|
|
Karsten Hopp |
9316c5 |
(mp = mp->m_next))
|
|
Karsten Hopp |
9316c5 |
{
|
|
Karsten Hopp |
9316c5 |
+ #ifdef FEAT_LOCALMAP
|
|
Karsten Hopp |
9316c5 |
+ if (expecting_global_mappings && mp2 == NULL)
|
|
Karsten Hopp |
9316c5 |
+ {
|
|
Karsten Hopp |
9316c5 |
+ /* This is the first global mapping. If we've
|
|
Karsten Hopp |
9316c5 |
+ * got a complete buffer-local match, use it. */
|
|
Karsten Hopp |
9316c5 |
+ if (mp_match)
|
|
Karsten Hopp |
9316c5 |
+ break;
|
|
Karsten Hopp |
9316c5 |
+ expecting_global_mappings = FALSE;
|
|
Karsten Hopp |
9316c5 |
+ }
|
|
Karsten Hopp |
9316c5 |
+ #endif
|
|
Karsten Hopp |
9316c5 |
/*
|
|
Karsten Hopp |
9316c5 |
* Only consider an entry if the first character
|
|
Karsten Hopp |
9316c5 |
* matches and it is for the current state.
|
|
Karsten Hopp |
9316c5 |
*** ../vim-7.3.1178/src/version.c 2013-06-12 20:35:46.000000000 +0200
|
|
Karsten Hopp |
9316c5 |
--- src/version.c 2013-06-12 20:56:36.000000000 +0200
|
|
Karsten Hopp |
9316c5 |
***************
|
|
Karsten Hopp |
9316c5 |
*** 730,731 ****
|
|
Karsten Hopp |
9316c5 |
--- 730,733 ----
|
|
Karsten Hopp |
9316c5 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
9316c5 |
+ /**/
|
|
Karsten Hopp |
9316c5 |
+ 1179,
|
|
Karsten Hopp |
9316c5 |
/**/
|
|
Karsten Hopp |
9316c5 |
|
|
Karsten Hopp |
9316c5 |
--
|
|
Karsten Hopp |
9316c5 |
If Apple would build a car...
|
|
Karsten Hopp |
9316c5 |
... it would be powered by the sun, be reliable, five times
|
|
Karsten Hopp |
9316c5 |
as fast and twice as easy to drive; but would only run on
|
|
Karsten Hopp |
9316c5 |
five percent of the roads.
|
|
Karsten Hopp |
9316c5 |
|
|
Karsten Hopp |
9316c5 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
9316c5 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
9316c5 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
9316c5 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|