Add yank and put mappings
This commit is contained in:
		
							parent
							
								
									95e5e97463
								
							
						
					
					
						commit
						ff82892720
					
				| @ -21,3 +21,25 @@ vim.keymap.set('n', '<leader><Space>', ':nohlsearch<CR>', {noremap = true}) | ||||
| 
 | ||||
| -- Disable 'Q' from opening Ex mode | ||||
| vim.keymap.set('n', 'Q', '<nop>', {noremap = true}) | ||||
| 
 | ||||
| -- Yank and put mappings | ||||
| -- TODO: This doesn't handle all use cases, only the basics. For example, | ||||
| -- this doesn't handle a local tmux session with a remote nvim in a pane. | ||||
| -- if tmux#isOption('set-clipboard', 'on') || $SSH_CONNECTION !=# '' | ||||
|   -- " When connected to a remote session the + selection register is not | ||||
|   -- " available and the unnamed register is used instead. Add mappings using the | ||||
|   -- " z register instead. | ||||
|   -- noremap <leader>y "zy | ||||
|   -- noremap <leader>Y "zY | ||||
|   -- " Enable OSC 52 copy on yank. | ||||
|   -- call osc52#autocmd() | ||||
| -- else | ||||
|   -- System clipboard yank/put | ||||
|   vim.keymap.set('', '<leader>y', '"+y', { noremap = true }) | ||||
|   vim.keymap.set('', '<leader>Y', '"+Y', { noremap = true }) | ||||
|   vim.keymap.set('', '<leader>p', '"+p', { noremap = true }) | ||||
|   vim.keymap.set('', '<leader>P', '"+P', { noremap = true }) | ||||
| -- end | ||||
| 
 | ||||
| -- Undo neovim's default mapping of Y to y$ | ||||
| vim.cmd('unmap Y') | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user