I have the following mapping set in vimrc
that saves the file and copy its content to clipboard:
:map <F3> :w<CR>gg<S-V>G"*y
It does what I want, except when I have the cursor positioned at the last character of the buffer. Why is this?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityTo fix the mapping, use V
instead of <S-V>
.
But as Christian points out in the comments, a simpler version exists:
nnoremap <f4> :write | %yank +<cr>
:nnoremap <f4> :%y+
ggVG
instead of<S-V>
? Not sure why it would matter, but generally no reason to do the<S-
version.<S-
it worked. I can see no reason to use it either. I must have meant to "capitalize"V
by mistake.