Skip to content

Can't switch auto paste mode in vim after 2.4 version #968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yutkat opened this issue Jun 11, 2017 · 3 comments
Closed

Can't switch auto paste mode in vim after 2.4 version #968

yutkat opened this issue Jun 11, 2017 · 3 comments

Comments

@yutkat
Copy link

yutkat commented Jun 11, 2017

I'm using vim with tmux. I switch to paste mode automatically when pasted from the clipboard. I got it until tmux version 2.3, but now I can not do it.
According to my examination, I think that there is a problem from 743f772 .

environments:

Linux x86_64
tmux 2.5
screen-256color
command: tmux -vv -Ltest -f/dev/null new

expect

language: c
matrix:
    include:
        - compiler: gcc
        - compiler: clang
          env: CFLAGS="-g -O2"

actual

language: c                                                                                                                                                                                                                      
matrix:                                                                                                                                                                                                                          
      include:                                                                                                                                                                                                                   
                - compiler: gcc                                                                                                                                                                                                  
                          - compiler: clang                                                                                                                                                                                      
                                      env: CFLAGS="-g -O2"     

my .vimrc for auto paste

if &term =~? 'xterm' || &term =~? 'screen'
  function! WrapForTmux(s)
    if !exists('$TMUX')
      return a:s
    endif

    let tmux_start = "\<Esc>Ptmux;"
    let tmux_end = "\<Esc>\\"

    return tmux_start . substitute(a:s, "\<Esc>", "\<Esc>\<Esc>", 'g') . tmux_end
  endfunction

  let &t_SI .= WrapForTmux("\<Esc>[?2004h")
  let &t_EI .= WrapForTmux("\<Esc>[?2004l")

  function! XTermPasteBegin(ret)
    set pastetoggle=<Esc>[201~
    set paste
    return a:ret
  endfunction

  inoremap <special> <expr> <Esc>[200~ XTermPasteBegin("<C-g>u")
endif
@nicm
Copy link
Member

nicm commented Jun 11, 2017

tmux supports bracketed paste natively, you don't need to wrap it in the passthrough escape sequence.

@yutkat
Copy link
Author

yutkat commented Jun 12, 2017

Thank you for reply.
My issue was solved by seeing this comment.
ConradIrwin/vim-bracketed-paste#32 (comment)

@yutkat yutkat closed this as completed Jun 12, 2017
@lock
Copy link

lock bot commented Feb 16, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants