mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	feat(clipboard): copy to system clipboard in tmux when supported (#20936)
Since version 3.2 tmux has had the ability to read/write buffer contents from/to the system clipboard, if the underlying terminal emulator supports it. Enable this feature when we can detect that tmux supports it.
This commit is contained in:
		@@ -139,7 +139,12 @@ function! provider#clipboard#Executable() abort
 | 
			
		||||
    let s:paste['*'] = s:paste['+']
 | 
			
		||||
    return 'termux-clipboard'
 | 
			
		||||
  elseif !empty($TMUX) && executable('tmux')
 | 
			
		||||
    let s:copy['+'] = ['tmux', 'load-buffer', '-']
 | 
			
		||||
    let [major, minor] = matchlist(systemlist(['tmux', '-V'])[0], 'tmux \(\d\+\)\.\(\d\+\)')[1:2]
 | 
			
		||||
    if major > 3 || (major == 3 && minor >= 2)
 | 
			
		||||
      let s:copy['+'] = ['tmux', 'load-buffer', '-w', '-']
 | 
			
		||||
    else
 | 
			
		||||
      let s:copy['+'] = ['tmux', 'load-buffer', '-']
 | 
			
		||||
    endif
 | 
			
		||||
    let s:paste['+'] = ['tmux', 'save-buffer', '-']
 | 
			
		||||
    let s:copy['*'] = s:copy['+']
 | 
			
		||||
    let s:paste['*'] = s:paste['+']
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user