comparison runtime/doc/eval.txt @ 20522:729853a754ea v8.2.0815

patch 8.2.0815: maparg() does not provide enough information for mapset() Commit: https://github.com/vim/vim/commit/9c65253fe702ea010afec11aa971acd542c35de2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 24 13:10:18 2020 +0200 patch 8.2.0815: maparg() does not provide enough information for mapset() Problem: maparg() does not provide enough information for mapset(). Solution: Add "lhsraw" and "lhsrawalt" items. Drop "simplified"
author Bram Moolenaar <Bram@vim.org>
date Sun, 24 May 2020 13:15:04 +0200
parents aee0b72ca6d6
children 74e3316c1d5a
comparison
equal deleted inserted replaced
20521:fb1d6f728a72 20522:729853a754ea
2584 maparg({name} [, {mode} [, {abbr} [, {dict}]]]) 2584 maparg({name} [, {mode} [, {abbr} [, {dict}]]])
2585 String or Dict 2585 String or Dict
2586 rhs of mapping {name} in mode {mode} 2586 rhs of mapping {name} in mode {mode}
2587 mapcheck({name} [, {mode} [, {abbr}]]) 2587 mapcheck({name} [, {mode} [, {abbr}]])
2588 String check for mappings matching {name} 2588 String check for mappings matching {name}
2589 mapset({name}, {mode}, {abbr}, {dict} 2589 mapset({mode}, {abbr}, {dict})
2590 none restore mapping from |maparg()| result 2590 none restore mapping from |maparg()| result
2591 match({expr}, {pat} [, {start} [, {count}]]) 2591 match({expr}, {pat} [, {start} [, {count}]])
2592 Number position where {pat} matches in {expr} 2592 Number position where {pat} matches in {expr}
2593 matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]]) 2593 matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
2594 Number highlight {pattern} with {group} 2594 Number highlight {pattern} with {group}
6827 instead of mappings. 6827 instead of mappings.
6828 6828
6829 When {dict} is there and it is |TRUE| return a dictionary 6829 When {dict} is there and it is |TRUE| return a dictionary
6830 containing all the information of the mapping with the 6830 containing all the information of the mapping with the
6831 following items: 6831 following items:
6832 "lhs" The {lhs} of the mapping. 6832 "lhs" The {lhs} of the mapping as it would be typed
6833 "lhsraw" The {lhs} of the mapping as raw bytes
6834 "lhsrawalt" The {lhs} of the mapping as raw bytes, alternate
6835 form, only present when it differs from "lhsraw"
6833 "rhs" The {rhs} of the mapping as typed. 6836 "rhs" The {rhs} of the mapping as typed.
6834 "silent" 1 for a |:map-silent| mapping, else 0. 6837 "silent" 1 for a |:map-silent| mapping, else 0.
6835 "noremap" 1 if the {rhs} of the mapping is not remappable. 6838 "noremap" 1 if the {rhs} of the mapping is not remappable.
6836 "script" 1 if mapping was defined with <script>. 6839 "script" 1 if mapping was defined with <script>.
6837 "expr" 1 for an expression mapping (|:map-<expr>|). 6840 "expr" 1 for an expression mapping (|:map-<expr>|).
6845 "sid" The script local ID, used for <sid> mappings 6848 "sid" The script local ID, used for <sid> mappings
6846 (|<SID>|). 6849 (|<SID>|).
6847 "lnum" The line number in "sid", zero if unknown. 6850 "lnum" The line number in "sid", zero if unknown.
6848 "nowait" Do not wait for other, longer mappings. 6851 "nowait" Do not wait for other, longer mappings.
6849 (|:map-<nowait>|). 6852 (|:map-<nowait>|).
6850 "simplified"
6851 6853
6852 The dictionary can be used to restore a mapping with 6854 The dictionary can be used to restore a mapping with
6853 |mapset()|. 6855 |mapset()|.
6854 6856
6855 The mappings local to the current buffer are checked first, 6857 The mappings local to the current buffer are checked first,
6895 mapping for "_v" or for "_vvv". 6897 mapping for "_v" or for "_vvv".
6896 6898
6897 Can also be used as a |method|: > 6899 Can also be used as a |method|: >
6898 GetKey()->mapcheck('n') 6900 GetKey()->mapcheck('n')
6899 6901
6902
6900 mapset({mode}, {abbr}, {dict}) *mapset()* 6903 mapset({mode}, {abbr}, {dict}) *mapset()*
6901 Restore a mapping from a dictionary returned by |maparg()|. 6904 Restore a mapping from a dictionary returned by |maparg()|.
6902 {name}, {mode} and {abbr} should be the same as for the call 6905 {mode} and {abbr} should be the same as for the call to
6903 to |maparg()|. 6906 |maparg()|. *E460*
6904 {mode} is used to define the mode in which the mapping is set, 6907 {mode} is used to define the mode in which the mapping is set,
6905 not the "mode" entry in {dict}. 6908 not the "mode" entry in {dict}.
6906 Example for saving and restoring a mapping: > 6909 Example for saving and restoring a mapping: >
6907 let save_map = maparg('K', 'n', 0, 1) 6910 let save_map = maparg('K', 'n', 0, 1)
6908 nnoremap K somethingelse 6911 nnoremap K somethingelse
6909 ... 6912 ...
6910 call mapset('n', 0, save_map) 6913 call mapset('n', 0, save_map)
6911 < 6914 < Note that if you are going to replace a map in several modes,
6915 e.g. with `:map!`, you need to save the mapping for all of
6916 them, since they can differe.
6917
6918
6912 match({expr}, {pat} [, {start} [, {count}]]) *match()* 6919 match({expr}, {pat} [, {start} [, {count}]]) *match()*
6913 When {expr} is a |List| then this returns the index of the 6920 When {expr} is a |List| then this returns the index of the
6914 first item where {pat} matches. Each item is used as a 6921 first item where {pat} matches. Each item is used as a
6915 String, |Lists| and |Dictionaries| are used as echoed. 6922 String, |Lists| and |Dictionaries| are used as echoed.
6916 6923