├── doc ├── .gitignore └── pastefix.txt ├── autoload └── pastefix.vim ├── plugin └── pastefix.vim ├── README.md └── LICENSE /doc/.gitignore: -------------------------------------------------------------------------------- 1 | tags 2 | -------------------------------------------------------------------------------- /autoload/pastefix.vim: -------------------------------------------------------------------------------- 1 | function! pastefix#put(cmd) abort 2 | let internal = getreg('0', 0, 1) 3 | let external = getreg(v:register, 0, 1) 4 | return internal ==# external 5 | \ ? printf('"0%s', a:cmd) 6 | \ : a:cmd 7 | endfunction 8 | -------------------------------------------------------------------------------- /plugin/pastefix.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_pastefix') || !has('nvim') 2 | finish 3 | endif 4 | let g:loaded_pastefix = 1 5 | 6 | nnoremap (pastefix-p) pastefix#put('p') 7 | nnoremap (pastefix-P) pastefix#put('P') 8 | 9 | if !get(g:, 'pastefix_no_default_mappings') 10 | nmap p (pastefix-p) 11 | nmap P (pastefix-P) 12 | endif 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pastefix.vim 2 | 3 | A workaround Neovim plugin to fix `clipboard=unnamed` issue ([#1822](https://github.com/neovim/neovim/issues/1822)). 4 | 5 | 6 | 7 | 13 | 19 | 20 |
8 |

9 |
10 | WITHOUT this plugin on Neovim 11 |

12 |
14 |

15 |
16 | WITH this plugin on Neovim 17 |

18 |
21 | 22 | ## License 23 | 24 | The code in this repository follows MIT license written in [LICENSE](./LICENSE). 25 | Contributors need to agree that any modifications sent in this repository follow the license. 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2021 Alisue, hashnote.net 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /doc/pastefix.txt: -------------------------------------------------------------------------------- 1 | *pastefix.txt* Fix Neovim's unnamed clipboard issue 2 | 3 | Author: Alisue 4 | License: MIT license 5 | 6 | ============================================================================= 7 | CONTENTS *pastefix-contents* 8 | 9 | INTRODUCTION |pastefix-introduction| 10 | INTERFACE |pastefix-interface| 11 | VARIABLE |pastefix-interface-variable| 12 | MAPPING |pastefix-interface-mapping| 13 | FUNCTION |pastefix-interface-function| 14 | 15 | 16 | ============================================================================= 17 | INTRODUCTION *pastefix-introduction* 18 | 19 | *pastefix.vim* (pastefix) is a workaround plugin to fix unnamed clipboard issue 20 | on block copy/paste of Neovim (#1822). 21 | 22 | It defines |(pastefix-p)| and |(pastefix-P)| which is mapped to 23 | |p| and |P| respectively in default. 24 | 25 | Use |g:pastefix_no_default_mappings| to disable mappings of |p| and |P|. 26 | 27 | Ref: 28 | https://github.com/neovim/neovim/issues/1822 29 | 30 | ============================================================================= 31 | INTERFACE *pastefix-interface* 32 | 33 | ----------------------------------------------------------------------------- 34 | VARIABLE *pastefix-interface-variable* 35 | 36 | *g:pastefix_no_default_mappings* 37 | Disable default mappings of |p| and |P|. 38 | Users need to map |(pastefix-p)| and |(pastefix-P)| with 39 | themselves like: 40 | > 41 | let g:pastefix_no_default_mappings = 1 42 | nmap p (pastefix-p) 43 | nmap P (pastefix-P) 44 | < 45 | ----------------------------------------------------------------------------- 46 | MAPPING *pastefix-interface-mapping* 47 | 48 | *(pastefix-p)* 49 | Fixed version of normal |p|. 50 | 51 | *(pastefix-P)* 52 | Fixed version of normal |P|. 53 | 54 | ----------------------------------------------------------------------------- 55 | FUNCTION *pastefix-interface-function* 56 | 57 | *pastefix#put()* 58 | pastefix#put({cmd}) 59 | Return a proper expression to execute |put| of the {cmd}. 60 | The {cmd} must be one of "p" or "P". 61 | Use it with |map-| like: 62 | > 63 | nnoremap p pastefix#put("p") 64 | nnoremap P pastefix#put("P") 65 | < 66 | ============================================================================= 67 | vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl 68 | --------------------------------------------------------------------------------