Show mappings for all function keys
Why does smartdiagram replace the Greek letter xi by a number?
Derivative of a double integral over a circular region
What would be the way to say "just saying" in German? (Not the literal translation)
Why the output signal of my amplifier is heavily distorted
Does putting salt first make it easier for attacker to bruteforce the hash?
How do we say "within a kilometer radius spherically"?
Analogy between an unknown in an argument, and a contradiction in the principle of explosion
What are the implications when matrix's lowest eigenvalue is equal to 0?
Who is "He that flies" in Lord of the Rings?
Grep Match and extract
Reference to understand the notation of orbital charts
Possible runaway argument using circuitikz
2019 gold coins to share
Please figure out this Pan digital Prince
Why Does Mama Coco Look Old After Going to the Other World?
How do i export activities related to an account with a specific recordtype?
Do you need to let the DM know when you are multiclassing?
How can I make 12 tone and atonal melodies sound interesting?
Amplitude of a crest and trough in a sound wave?
Is there a DSLR/mirorless camera with minimal options like a classic, simple SLR?
60s or 70s novel about Empire of Man making 1st contact with 1st discovered alien race
What is the logic behind charging tax _in the form of money_ for owning property when the property does not produce money?
The origin of the Russian proverb about two hares
Who won a Game of Bar Dice?
Show mappings for all function keys
How can I show the mappings for all function keys <F1>
to <F12>
at once? I know that :map <F1>
shows the mapping for <F1>
, and I can repeat this 12 times for each key. But is there a faster way? I have tried :map <F
but that doesn't work.
key-bindings
add a comment |
How can I show the mappings for all function keys <F1>
to <F12>
at once? I know that :map <F1>
shows the mapping for <F1>
, and I can repeat this 12 times for each key. But is there a faster way? I have tried :map <F
but that doesn't work.
key-bindings
add a comment |
How can I show the mappings for all function keys <F1>
to <F12>
at once? I know that :map <F1>
shows the mapping for <F1>
, and I can repeat this 12 times for each key. But is there a faster way? I have tried :map <F
but that doesn't work.
key-bindings
How can I show the mappings for all function keys <F1>
to <F12>
at once? I know that :map <F1>
shows the mapping for <F1>
, and I can repeat this 12 times for each key. But is there a faster way? I have tried :map <F
but that doesn't work.
key-bindings
key-bindings
asked Jun 3 at 7:13
husBhusB
234
234
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You could do this with a loop:
for i in range(1, 12) | execute 'map <F'.i.'>' | endfor
If you don't want any output for F-keys without mappings, you can use mapcheck()
, as suggested by @BLayer:
for i in range(1, 12) | if !empty(mapcheck('<F'.i.'>')) | execute 'map <F'.i.'>' | endif | endfor
For more details, see:
:help :for
:help :execute
:help range()
:help mapcheck()
2
For cleaner output, omitting non-mapped "F" keys, theexecute
expression could be expanded to'if mapcheck("<F'.i.'>") != "" | map <F'.i.'> | endif'
– B Layer
Jun 4 at 1:18
Thanks for the clean and simple solution. Initially, I had thought of using regex (and later, with:filter
), but it seems that a loop is better suited for this situation.
– husB
Jun 4 at 8:13
add a comment |
The :filter allows to filter the output of certain vim commands. Currently, this is not yet supported by every Vim command, but according to :h map-listing, it should be possible. As the help states:
The :filter command can be used to select what mappings to list. The
pattern is matched against the lhs and rhs in the raw form.
This means, you would need to put up a custom filter command with the raw key codes as input to the filter command. I was able to come up with this somewhat convoluted example for all <f>
keys:
exe ":filter" join(map(range(1,12), i,v -> eval('"<f'.v.'>"')), '|') ":map"
This creates a list of each raw <f>
key by using the "<f1>"
form (which will then be parsed into the correct raw key code by vim (therefore, the eval()
is needed). The resulting list, is then joined together into a regular expression, with each item joined by the |
regex atom (OR).
As the help states, the filter criteria will be applied to both, the left and right side of a mapping, so if the criteria matches the right side, it will be output as well.
Note, in order to really get all mapping output, you might as well need the :map!
command to get insert and commandline mappings.
Overall this is a lot more complicated than to use the solution provided by Rich
Is it possible to do something such as:filter /raw code of <f3>/ map
without usingexec
?
– dedowsdi
Jun 3 at 11:09
1
I don't think so, since one needs the special"<key>"
notation
– Christian Brabandt
Jun 3 at 13:43
I guess you are right. If the raw code sequence starts with 0x80, one have to use the special "<key>" notation.
– dedowsdi
Jun 3 at 13:56
Thanks,:filter
was what I was looking for. I managed to grasp the main gist behind your example but it will take me some time before I fully understand it. Also, can the example be simplified to something along the lines of"<f".'d1,2'.">"
?
– husB
Jun 4 at 4:40
@husB no, because as I said, the filter works on the raw key codes.
– Christian Brabandt
Jun 4 at 5:50
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "599"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f20192%2fshow-mappings-for-all-function-keys%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could do this with a loop:
for i in range(1, 12) | execute 'map <F'.i.'>' | endfor
If you don't want any output for F-keys without mappings, you can use mapcheck()
, as suggested by @BLayer:
for i in range(1, 12) | if !empty(mapcheck('<F'.i.'>')) | execute 'map <F'.i.'>' | endif | endfor
For more details, see:
:help :for
:help :execute
:help range()
:help mapcheck()
2
For cleaner output, omitting non-mapped "F" keys, theexecute
expression could be expanded to'if mapcheck("<F'.i.'>") != "" | map <F'.i.'> | endif'
– B Layer
Jun 4 at 1:18
Thanks for the clean and simple solution. Initially, I had thought of using regex (and later, with:filter
), but it seems that a loop is better suited for this situation.
– husB
Jun 4 at 8:13
add a comment |
You could do this with a loop:
for i in range(1, 12) | execute 'map <F'.i.'>' | endfor
If you don't want any output for F-keys without mappings, you can use mapcheck()
, as suggested by @BLayer:
for i in range(1, 12) | if !empty(mapcheck('<F'.i.'>')) | execute 'map <F'.i.'>' | endif | endfor
For more details, see:
:help :for
:help :execute
:help range()
:help mapcheck()
2
For cleaner output, omitting non-mapped "F" keys, theexecute
expression could be expanded to'if mapcheck("<F'.i.'>") != "" | map <F'.i.'> | endif'
– B Layer
Jun 4 at 1:18
Thanks for the clean and simple solution. Initially, I had thought of using regex (and later, with:filter
), but it seems that a loop is better suited for this situation.
– husB
Jun 4 at 8:13
add a comment |
You could do this with a loop:
for i in range(1, 12) | execute 'map <F'.i.'>' | endfor
If you don't want any output for F-keys without mappings, you can use mapcheck()
, as suggested by @BLayer:
for i in range(1, 12) | if !empty(mapcheck('<F'.i.'>')) | execute 'map <F'.i.'>' | endif | endfor
For more details, see:
:help :for
:help :execute
:help range()
:help mapcheck()
You could do this with a loop:
for i in range(1, 12) | execute 'map <F'.i.'>' | endfor
If you don't want any output for F-keys without mappings, you can use mapcheck()
, as suggested by @BLayer:
for i in range(1, 12) | if !empty(mapcheck('<F'.i.'>')) | execute 'map <F'.i.'>' | endif | endfor
For more details, see:
:help :for
:help :execute
:help range()
:help mapcheck()
edited Jun 4 at 8:19
answered Jun 3 at 9:34
RichRich
15.8k12168
15.8k12168
2
For cleaner output, omitting non-mapped "F" keys, theexecute
expression could be expanded to'if mapcheck("<F'.i.'>") != "" | map <F'.i.'> | endif'
– B Layer
Jun 4 at 1:18
Thanks for the clean and simple solution. Initially, I had thought of using regex (and later, with:filter
), but it seems that a loop is better suited for this situation.
– husB
Jun 4 at 8:13
add a comment |
2
For cleaner output, omitting non-mapped "F" keys, theexecute
expression could be expanded to'if mapcheck("<F'.i.'>") != "" | map <F'.i.'> | endif'
– B Layer
Jun 4 at 1:18
Thanks for the clean and simple solution. Initially, I had thought of using regex (and later, with:filter
), but it seems that a loop is better suited for this situation.
– husB
Jun 4 at 8:13
2
2
For cleaner output, omitting non-mapped "F" keys, the
execute
expression could be expanded to 'if mapcheck("<F'.i.'>") != "" | map <F'.i.'> | endif'
– B Layer
Jun 4 at 1:18
For cleaner output, omitting non-mapped "F" keys, the
execute
expression could be expanded to 'if mapcheck("<F'.i.'>") != "" | map <F'.i.'> | endif'
– B Layer
Jun 4 at 1:18
Thanks for the clean and simple solution. Initially, I had thought of using regex (and later, with
:filter
), but it seems that a loop is better suited for this situation.– husB
Jun 4 at 8:13
Thanks for the clean and simple solution. Initially, I had thought of using regex (and later, with
:filter
), but it seems that a loop is better suited for this situation.– husB
Jun 4 at 8:13
add a comment |
The :filter allows to filter the output of certain vim commands. Currently, this is not yet supported by every Vim command, but according to :h map-listing, it should be possible. As the help states:
The :filter command can be used to select what mappings to list. The
pattern is matched against the lhs and rhs in the raw form.
This means, you would need to put up a custom filter command with the raw key codes as input to the filter command. I was able to come up with this somewhat convoluted example for all <f>
keys:
exe ":filter" join(map(range(1,12), i,v -> eval('"<f'.v.'>"')), '|') ":map"
This creates a list of each raw <f>
key by using the "<f1>"
form (which will then be parsed into the correct raw key code by vim (therefore, the eval()
is needed). The resulting list, is then joined together into a regular expression, with each item joined by the |
regex atom (OR).
As the help states, the filter criteria will be applied to both, the left and right side of a mapping, so if the criteria matches the right side, it will be output as well.
Note, in order to really get all mapping output, you might as well need the :map!
command to get insert and commandline mappings.
Overall this is a lot more complicated than to use the solution provided by Rich
Is it possible to do something such as:filter /raw code of <f3>/ map
without usingexec
?
– dedowsdi
Jun 3 at 11:09
1
I don't think so, since one needs the special"<key>"
notation
– Christian Brabandt
Jun 3 at 13:43
I guess you are right. If the raw code sequence starts with 0x80, one have to use the special "<key>" notation.
– dedowsdi
Jun 3 at 13:56
Thanks,:filter
was what I was looking for. I managed to grasp the main gist behind your example but it will take me some time before I fully understand it. Also, can the example be simplified to something along the lines of"<f".'d1,2'.">"
?
– husB
Jun 4 at 4:40
@husB no, because as I said, the filter works on the raw key codes.
– Christian Brabandt
Jun 4 at 5:50
add a comment |
The :filter allows to filter the output of certain vim commands. Currently, this is not yet supported by every Vim command, but according to :h map-listing, it should be possible. As the help states:
The :filter command can be used to select what mappings to list. The
pattern is matched against the lhs and rhs in the raw form.
This means, you would need to put up a custom filter command with the raw key codes as input to the filter command. I was able to come up with this somewhat convoluted example for all <f>
keys:
exe ":filter" join(map(range(1,12), i,v -> eval('"<f'.v.'>"')), '|') ":map"
This creates a list of each raw <f>
key by using the "<f1>"
form (which will then be parsed into the correct raw key code by vim (therefore, the eval()
is needed). The resulting list, is then joined together into a regular expression, with each item joined by the |
regex atom (OR).
As the help states, the filter criteria will be applied to both, the left and right side of a mapping, so if the criteria matches the right side, it will be output as well.
Note, in order to really get all mapping output, you might as well need the :map!
command to get insert and commandline mappings.
Overall this is a lot more complicated than to use the solution provided by Rich
Is it possible to do something such as:filter /raw code of <f3>/ map
without usingexec
?
– dedowsdi
Jun 3 at 11:09
1
I don't think so, since one needs the special"<key>"
notation
– Christian Brabandt
Jun 3 at 13:43
I guess you are right. If the raw code sequence starts with 0x80, one have to use the special "<key>" notation.
– dedowsdi
Jun 3 at 13:56
Thanks,:filter
was what I was looking for. I managed to grasp the main gist behind your example but it will take me some time before I fully understand it. Also, can the example be simplified to something along the lines of"<f".'d1,2'.">"
?
– husB
Jun 4 at 4:40
@husB no, because as I said, the filter works on the raw key codes.
– Christian Brabandt
Jun 4 at 5:50
add a comment |
The :filter allows to filter the output of certain vim commands. Currently, this is not yet supported by every Vim command, but according to :h map-listing, it should be possible. As the help states:
The :filter command can be used to select what mappings to list. The
pattern is matched against the lhs and rhs in the raw form.
This means, you would need to put up a custom filter command with the raw key codes as input to the filter command. I was able to come up with this somewhat convoluted example for all <f>
keys:
exe ":filter" join(map(range(1,12), i,v -> eval('"<f'.v.'>"')), '|') ":map"
This creates a list of each raw <f>
key by using the "<f1>"
form (which will then be parsed into the correct raw key code by vim (therefore, the eval()
is needed). The resulting list, is then joined together into a regular expression, with each item joined by the |
regex atom (OR).
As the help states, the filter criteria will be applied to both, the left and right side of a mapping, so if the criteria matches the right side, it will be output as well.
Note, in order to really get all mapping output, you might as well need the :map!
command to get insert and commandline mappings.
Overall this is a lot more complicated than to use the solution provided by Rich
The :filter allows to filter the output of certain vim commands. Currently, this is not yet supported by every Vim command, but according to :h map-listing, it should be possible. As the help states:
The :filter command can be used to select what mappings to list. The
pattern is matched against the lhs and rhs in the raw form.
This means, you would need to put up a custom filter command with the raw key codes as input to the filter command. I was able to come up with this somewhat convoluted example for all <f>
keys:
exe ":filter" join(map(range(1,12), i,v -> eval('"<f'.v.'>"')), '|') ":map"
This creates a list of each raw <f>
key by using the "<f1>"
form (which will then be parsed into the correct raw key code by vim (therefore, the eval()
is needed). The resulting list, is then joined together into a regular expression, with each item joined by the |
regex atom (OR).
As the help states, the filter criteria will be applied to both, the left and right side of a mapping, so if the criteria matches the right side, it will be output as well.
Note, in order to really get all mapping output, you might as well need the :map!
command to get insert and commandline mappings.
Overall this is a lot more complicated than to use the solution provided by Rich
edited Jun 3 at 13:44
answered Jun 3 at 11:00
Christian BrabandtChristian Brabandt
16.5k2747
16.5k2747
Is it possible to do something such as:filter /raw code of <f3>/ map
without usingexec
?
– dedowsdi
Jun 3 at 11:09
1
I don't think so, since one needs the special"<key>"
notation
– Christian Brabandt
Jun 3 at 13:43
I guess you are right. If the raw code sequence starts with 0x80, one have to use the special "<key>" notation.
– dedowsdi
Jun 3 at 13:56
Thanks,:filter
was what I was looking for. I managed to grasp the main gist behind your example but it will take me some time before I fully understand it. Also, can the example be simplified to something along the lines of"<f".'d1,2'.">"
?
– husB
Jun 4 at 4:40
@husB no, because as I said, the filter works on the raw key codes.
– Christian Brabandt
Jun 4 at 5:50
add a comment |
Is it possible to do something such as:filter /raw code of <f3>/ map
without usingexec
?
– dedowsdi
Jun 3 at 11:09
1
I don't think so, since one needs the special"<key>"
notation
– Christian Brabandt
Jun 3 at 13:43
I guess you are right. If the raw code sequence starts with 0x80, one have to use the special "<key>" notation.
– dedowsdi
Jun 3 at 13:56
Thanks,:filter
was what I was looking for. I managed to grasp the main gist behind your example but it will take me some time before I fully understand it. Also, can the example be simplified to something along the lines of"<f".'d1,2'.">"
?
– husB
Jun 4 at 4:40
@husB no, because as I said, the filter works on the raw key codes.
– Christian Brabandt
Jun 4 at 5:50
Is it possible to do something such as
:filter /raw code of <f3>/ map
without using exec
?– dedowsdi
Jun 3 at 11:09
Is it possible to do something such as
:filter /raw code of <f3>/ map
without using exec
?– dedowsdi
Jun 3 at 11:09
1
1
I don't think so, since one needs the special
"<key>"
notation– Christian Brabandt
Jun 3 at 13:43
I don't think so, since one needs the special
"<key>"
notation– Christian Brabandt
Jun 3 at 13:43
I guess you are right. If the raw code sequence starts with 0x80, one have to use the special "<key>" notation.
– dedowsdi
Jun 3 at 13:56
I guess you are right. If the raw code sequence starts with 0x80, one have to use the special "<key>" notation.
– dedowsdi
Jun 3 at 13:56
Thanks,
:filter
was what I was looking for. I managed to grasp the main gist behind your example but it will take me some time before I fully understand it. Also, can the example be simplified to something along the lines of "<f".'d1,2'.">"
?– husB
Jun 4 at 4:40
Thanks,
:filter
was what I was looking for. I managed to grasp the main gist behind your example but it will take me some time before I fully understand it. Also, can the example be simplified to something along the lines of "<f".'d1,2'.">"
?– husB
Jun 4 at 4:40
@husB no, because as I said, the filter works on the raw key codes.
– Christian Brabandt
Jun 4 at 5:50
@husB no, because as I said, the filter works on the raw key codes.
– Christian Brabandt
Jun 4 at 5:50
add a comment |
Thanks for contributing an answer to Vi and Vim Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f20192%2fshow-mappings-for-all-function-keys%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown