This seems to be the source of the confusion right here:

> ... (to map the visual mode yank)

Visual mode doesn't need a separate form of yank. Just use the regular
yank:

:vmap <c-i> y

No <cr> required. When you're in visual mode and then hit y, it yanks the
text and exits visual mode immediately. The <c-i> map then inherits that
behaviour.

As Jürgen says, if you really do want to use the X11 clipboard, you'll need
something like vim-gtk from your package manager, something that ships with
"+X11" (when you check `vim --version`).

If you do end up with a version that has +X11 and you want mappings to work
with the clipboard, you might find something like the following useful:

"""
if has('x11')
    nnoremap + :let @+=@0<CR>
    nnoremap <silent> <C-c> :set opfunc=YankCB<CR>g@
    vnoremap <silent> <C-c> :<C-U>call YankCB(visualmode(), 1)<CR>
    function! YankCB(type, ...)
        let l:sel_save = &selection
        let &selection = 'inclusive'
        if a:0  " Invoked from Visual mode, use gv command.
            silent exe "normal! gv\"+y"
        elseif a:type ==# 'line'
            silent exe "normal! '[V']\"+y"
        else
            silent exe "normal! `[v`]\"+y"
        endif
        let &selection = l:sel_save
    endfunction

    nnoremap * :let @*=@0<CR>
    nnoremap <silent> <leader>c :set opfunc=YankPS<CR>g@
    vnoremap <silent> <leader>c :<C-U>call YankPS(visualmode(), 1)<CR>
    function! YankPS(type, ...)
        let l:sel_save = &selection
        let &selection = 'inclusive'
        if a:0  " Invoked from Visual mode, use gv command.
            silent exe "normal! gv\"*y"
        elseif a:type ==# 'line'
            silent exe "normal! '[V']\"*y"
        else
            silent exe "normal! `[v`]\"*y"
        endif
        let &selection = l:sel_save
    endfunction
endif
"""

This sets up operations that act like the familiar old yank, but sends it
to clipboard or primary selection respectively.


~ Tim

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to