Visual feedback after executing mapping

Multi tool use
I have the following mapping in my ~/.vimrc
file:
map <F3> my0v$"+y`y
It works correctly, but I'd like some visual feedback or some other indication to show that I've pressed the key. Any suggestions?
key-bindings
add a comment |
I have the following mapping in my ~/.vimrc
file:
map <F3> my0v$"+y`y
It works correctly, but I'd like some visual feedback or some other indication to show that I've pressed the key. Any suggestions?
key-bindings
1
No answer, but isn't that the same asmap <F3> "+yy
?
– Ralf
Jan 14 at 16:08
This will copy the line character-wise instead of linewise. However, it will also copy the newline so it feels more linewise. I agree that it would probably be easier to just doyy
/Y
or:yank
and just accept to do a little cleanup on paste/put.
– Peter Rincker
Jan 14 at 17:17
add a comment |
I have the following mapping in my ~/.vimrc
file:
map <F3> my0v$"+y`y
It works correctly, but I'd like some visual feedback or some other indication to show that I've pressed the key. Any suggestions?
key-bindings
I have the following mapping in my ~/.vimrc
file:
map <F3> my0v$"+y`y
It works correctly, but I'd like some visual feedback or some other indication to show that I've pressed the key. Any suggestions?
key-bindings
key-bindings
asked Jan 14 at 16:02
SabreWolfySabreWolfy
346313
346313
1
No answer, but isn't that the same asmap <F3> "+yy
?
– Ralf
Jan 14 at 16:08
This will copy the line character-wise instead of linewise. However, it will also copy the newline so it feels more linewise. I agree that it would probably be easier to just doyy
/Y
or:yank
and just accept to do a little cleanup on paste/put.
– Peter Rincker
Jan 14 at 17:17
add a comment |
1
No answer, but isn't that the same asmap <F3> "+yy
?
– Ralf
Jan 14 at 16:08
This will copy the line character-wise instead of linewise. However, it will also copy the newline so it feels more linewise. I agree that it would probably be easier to just doyy
/Y
or:yank
and just accept to do a little cleanup on paste/put.
– Peter Rincker
Jan 14 at 17:17
1
1
No answer, but isn't that the same as
map <F3> "+yy
?– Ralf
Jan 14 at 16:08
No answer, but isn't that the same as
map <F3> "+yy
?– Ralf
Jan 14 at 16:08
This will copy the line character-wise instead of linewise. However, it will also copy the newline so it feels more linewise. I agree that it would probably be easier to just do
yy
/Y
or :yank
and just accept to do a little cleanup on paste/put.– Peter Rincker
Jan 14 at 17:17
This will copy the line character-wise instead of linewise. However, it will also copy the newline so it feels more linewise. I agree that it would probably be easier to just do
yy
/Y
or :yank
and just accept to do a little cleanup on paste/put.– Peter Rincker
Jan 14 at 17:17
add a comment |
1 Answer
1
active
oldest
votes
You have options:
- Explicitly put an
:echo
at the end of your mapping.map <key> foo:echo "done"<cr>
- Use
'showcmd'
which will show partial commands. This will give you a slight clue that something happened for multi-key mappings/commands. (Not really helpful here) - Use a plugin like vim-highlightedyank to quickly highlight the last yank
General rule of thumbs for mappings:
- Supply a mode for mappings. e.g.
nmap
for normal mode - Use
*noremap
variants unless you want remapping to occur or using a<Plug>
mapping
This means your mapping would look like:
nnoremap <F3> my0v$"+y`y
Some more thoughts:
- This is very similar to
"+yy
/"+Y
,:yank +
, orV"+y
. There is another newline in the register, but that is easy to reason about. - You may not want the ending newline at all, so use
g_
instead of$
. - This mutates the
y
mark. This could be surprising, consider using a:yank
oryy
/Y
- Could "cast" put/paste or change the register type to accomplish the same effect. e.g.
nnoremap <f3> "+yy:call setreg('+', @+, 'v')<cr>
Personally, I lean toward using vim-highlightyank and the following mapping:
nnoremap <silent> <f3> "+yy:call setreg('+', @+, 'v')<cr>
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%2f18565%2fvisual-feedback-after-executing-mapping%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have options:
- Explicitly put an
:echo
at the end of your mapping.map <key> foo:echo "done"<cr>
- Use
'showcmd'
which will show partial commands. This will give you a slight clue that something happened for multi-key mappings/commands. (Not really helpful here) - Use a plugin like vim-highlightedyank to quickly highlight the last yank
General rule of thumbs for mappings:
- Supply a mode for mappings. e.g.
nmap
for normal mode - Use
*noremap
variants unless you want remapping to occur or using a<Plug>
mapping
This means your mapping would look like:
nnoremap <F3> my0v$"+y`y
Some more thoughts:
- This is very similar to
"+yy
/"+Y
,:yank +
, orV"+y
. There is another newline in the register, but that is easy to reason about. - You may not want the ending newline at all, so use
g_
instead of$
. - This mutates the
y
mark. This could be surprising, consider using a:yank
oryy
/Y
- Could "cast" put/paste or change the register type to accomplish the same effect. e.g.
nnoremap <f3> "+yy:call setreg('+', @+, 'v')<cr>
Personally, I lean toward using vim-highlightyank and the following mapping:
nnoremap <silent> <f3> "+yy:call setreg('+', @+, 'v')<cr>
add a comment |
You have options:
- Explicitly put an
:echo
at the end of your mapping.map <key> foo:echo "done"<cr>
- Use
'showcmd'
which will show partial commands. This will give you a slight clue that something happened for multi-key mappings/commands. (Not really helpful here) - Use a plugin like vim-highlightedyank to quickly highlight the last yank
General rule of thumbs for mappings:
- Supply a mode for mappings. e.g.
nmap
for normal mode - Use
*noremap
variants unless you want remapping to occur or using a<Plug>
mapping
This means your mapping would look like:
nnoremap <F3> my0v$"+y`y
Some more thoughts:
- This is very similar to
"+yy
/"+Y
,:yank +
, orV"+y
. There is another newline in the register, but that is easy to reason about. - You may not want the ending newline at all, so use
g_
instead of$
. - This mutates the
y
mark. This could be surprising, consider using a:yank
oryy
/Y
- Could "cast" put/paste or change the register type to accomplish the same effect. e.g.
nnoremap <f3> "+yy:call setreg('+', @+, 'v')<cr>
Personally, I lean toward using vim-highlightyank and the following mapping:
nnoremap <silent> <f3> "+yy:call setreg('+', @+, 'v')<cr>
add a comment |
You have options:
- Explicitly put an
:echo
at the end of your mapping.map <key> foo:echo "done"<cr>
- Use
'showcmd'
which will show partial commands. This will give you a slight clue that something happened for multi-key mappings/commands. (Not really helpful here) - Use a plugin like vim-highlightedyank to quickly highlight the last yank
General rule of thumbs for mappings:
- Supply a mode for mappings. e.g.
nmap
for normal mode - Use
*noremap
variants unless you want remapping to occur or using a<Plug>
mapping
This means your mapping would look like:
nnoremap <F3> my0v$"+y`y
Some more thoughts:
- This is very similar to
"+yy
/"+Y
,:yank +
, orV"+y
. There is another newline in the register, but that is easy to reason about. - You may not want the ending newline at all, so use
g_
instead of$
. - This mutates the
y
mark. This could be surprising, consider using a:yank
oryy
/Y
- Could "cast" put/paste or change the register type to accomplish the same effect. e.g.
nnoremap <f3> "+yy:call setreg('+', @+, 'v')<cr>
Personally, I lean toward using vim-highlightyank and the following mapping:
nnoremap <silent> <f3> "+yy:call setreg('+', @+, 'v')<cr>
You have options:
- Explicitly put an
:echo
at the end of your mapping.map <key> foo:echo "done"<cr>
- Use
'showcmd'
which will show partial commands. This will give you a slight clue that something happened for multi-key mappings/commands. (Not really helpful here) - Use a plugin like vim-highlightedyank to quickly highlight the last yank
General rule of thumbs for mappings:
- Supply a mode for mappings. e.g.
nmap
for normal mode - Use
*noremap
variants unless you want remapping to occur or using a<Plug>
mapping
This means your mapping would look like:
nnoremap <F3> my0v$"+y`y
Some more thoughts:
- This is very similar to
"+yy
/"+Y
,:yank +
, orV"+y
. There is another newline in the register, but that is easy to reason about. - You may not want the ending newline at all, so use
g_
instead of$
. - This mutates the
y
mark. This could be surprising, consider using a:yank
oryy
/Y
- Could "cast" put/paste or change the register type to accomplish the same effect. e.g.
nnoremap <f3> "+yy:call setreg('+', @+, 'v')<cr>
Personally, I lean toward using vim-highlightyank and the following mapping:
nnoremap <silent> <f3> "+yy:call setreg('+', @+, 'v')<cr>
edited Jan 15 at 15:05
answered Jan 14 at 17:40
Peter RinckerPeter Rincker
10.2k11728
10.2k11728
add a comment |
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%2f18565%2fvisual-feedback-after-executing-mapping%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
nWDYan,ChF8guN8O rid795,yrMerYtWxot0G,LJS5t3wsbg,gSgkt,7fnP79WMX,S2js4qtP
1
No answer, but isn't that the same as
map <F3> "+yy
?– Ralf
Jan 14 at 16:08
This will copy the line character-wise instead of linewise. However, it will also copy the newline so it feels more linewise. I agree that it would probably be easier to just do
yy
/Y
or:yank
and just accept to do a little cleanup on paste/put.– Peter Rincker
Jan 14 at 17:17