I have mapped a key shortcut to copy all lines to system clipboard, which is working fine
nnoremap <localleader>o :silent %w !pbcopy<cr>
I would like to display the message as 'Copied' in the status bar. Reading other answers, I found
echo can be used to display the messages
I have tried below
nnoremap <localleader>o :silent %w !pbcopy<cr>|:echom "Copied" nnoremap <localleader>o :silent %w !pbcopy<cr>|echom "Copied"
These lines are placed in
.vimrc. It appears lines are getting copied to clipboard, but the message is not being displayed anywhere.
1) How do I display the message from mapped command?
2) When opening a file, before Vim actually opens, I see the 'Copied' message, and a line that says 'Press Enter to continue' in the terminal. It appears the mapping is being invoked on sourcing the vimrc. The message should not be echoed while sourcing the vimrc file. How do I stop this?