项目作者: Jorengarenar

项目描述 :
Clipboard support for Vim without +clipboard
高级语言: Vim script
项目地址: git://github.com/Jorengarenar/fauxClip.git
创建时间: 2019-12-06T19:54:41Z
项目社区:https://github.com/Jorengarenar/fauxClip

开源协议:MIT License

下载


fauxClip

fauxClip is a Vim plugin allowing to define custom registers, with primary
goal of providing a pseudo clipboard support for versions of Vim compiled
without +clipboard.


Default utilities for clipboard yank and paste are:

  • wl-copy + wl-paste (on Linux with Wayland, or WSL2)
  • xclip (on Linux with X server, or WSL2)
  • xsel (fallback to xclip)
  • pbcopy + pbpaste (on macOS)
  • clip.exe + powershell.exe Get-Clipboard (on Windows)

Assuming you are on Linux, using Tmux, xclip is installed, and you didn’t
change any of fauxClip’s defaults, then the dictionary with commands for
registers will be set as following:

  1. let g:fauxClip_regcmds = {
  2. \ '+': {
  3. \ 'yank': 'xclip -f -i -selection clipboard',
  4. \ 'paste': 'xclip -o -selection clipboard',
  5. \ },
  6. \ '*': {
  7. \ 'yank': 'xclip -f -i',
  8. \ 'paste': 'xclip -o',
  9. \ },
  10. \ ']': {
  11. \ 'yank': 'tmux load-buffer -',
  12. \ 'paste': 'tmux save-buffer -',
  13. \ }
  14. \ }

By manually setting any of the items you can overwrite the defaults, or craft
your own registers:

  1. let g:fauxClip_regcmds = {
  2. \ '!': {
  3. \ 'paste': 'echo "Bang!"'
  4. \ }
  5. \ }

Note: to disable clipboard registers * and + you need to explicitly set
them to empty strings.


To set different “register” for Tmux than ]:

  1. let g:fauxClip_tmux_reg = 't'

If for some reason you don’t want to suppress error messages from clipboard
command (e.g. xclip‘s empty clipboard), then:

  1. let g:fauxClip_suppress_errors = 0

If Vim is compiled with +clipboard, but you want to force usage of custom
commands for system clipboard regardless, then:

  1. let g:fauxClip_sys_force = 1

To disable removal of carriage return on Windows/WSL2 when pasting, set:

  1. let g:fauxClip_crlf2lf = 0

Installation

vim-plug:

  1. Plug 'Jorenar/fauxClip'

Vim’s packages

  1. cd ~/.vim/pack/plugins/start
  2. git clone git://github.com/Jorenar/fauxClip.git

Single file

  1. curl --create-dirs -L https://raw.githubusercontent.com/Jorenar/fauxClip/master/plugin/fauxClip.vim -o ~/.vim/plugin/fauxClip.vim