vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

osc52.txt (3515B)


      1 *osc52.txt*   For Vim version 9.1.  Last change:  2025 Dec 18
      2 
      3 
      4 			  VIM REFERENCE MANUAL
      5 
      6 Use the OSC 52 terminal command for clipboard support
      7 ==============================================================================
      8 
      9 1. OVERVIEW					        *osc52-overview*
     10 
     11 The osc52.vim plugin provides support for the OSC 52 terminal command, which
     12 allows an application to access the clipboard by communicating with the
     13 terminal.  This is useful in situations such as if you are in a SSH session.
     14 
     15                                                         *osc52-support*
     16 In order for this plugin to work, the terminal Vim is running in must
     17 recognize and handle the OSC 52 escape sequence.  You can easily check this
     18 online.  Additionally, while yanking is guaranteed to work, some terminals
     19 don't implement the paste functionality.  If the terminal doesn't support
     20 pasting, then Vim will just block waiting for the data which will never come.
     21 In this case just press Ctrl-C to cancel the operation.
     22 
     23                                                         *osc52-selections*
     24 Note that this only applies to users on Wayland or X11 platforms
     25 
     26 Some terminals support the selection type parameter in the OSC 52 command.
     27 This originates from X11, and some terminals check this parameter and handle
     28 it accordingly.  If your terminal handles this parameter, then the "+"
     29 register corresponds to the regular selection, and the "*" register
     30 corresponds to the primary selection.  If your terminal does not handle it,
     31 then it is up to the terminal to handle what selection to use.
     32 
     33 2. HOW TO USE THE PLUGIN                                *osc52-how-to-use*
     34 
     35 The osc52.vim package relies on Vim's clipboard provider functionality, see
     36 |clipboard-providers|.  To enable it, add the following to your |vimrc|: >vim
     37         packadd osc52
     38         set clipmethod+=osc52
     39 <
     40 This appends "osc52" to |clipmethod|, causing Vim to try it only after any
     41 earlier clipboard methods.  This allows Vim to use the system clipboard
     42 directly when available, and automatically fall back to OSC 52 method when it
     43 is not (for example, when running over SSH).
     44 
     45 Note: that this fallback behavior applies only on platforms that use
     46 |clipmethod| for accessing the clipboard.  On macOS and Windows, Vim does not
     47 use |clipmethod|, so this behaviour won't happen.  Instead if OSC 52 support is
     48 detected and "osc52" is the only value in |clipmethod|, then it will always be
     49 used.
     50 
     51 You can check whether the osc52.vim provider is active by inspecting
     52 |v:clipmethod|.  If it contains "osc52", the plugin is enabled.
     53 
     54 Note: terminal multiplexers such as tmux may interfere with automatic OSC 52
     55 detection.
     56 
     57                                                         *g:osc52_force_avail*
     58 In most cases, the plugin should automatically detect and work if your
     59 terminal supports the OSC 52 command.  Internally, it does this by sending the
     60 Primary Device Attributes (DA1) query.  You may force enable the plugin by
     61 setting |g:osc52_force_avail| to true.
     62 
     63                                                         *g:osc52_disable_paste*
     64 If your terminal does not support pasting via OSC 52, or has it disabled, then
     65 it is a good idea to set g:osc52_disable_paste to TRUE.  This will register
     66 only the "copy" method for the osc52.vim clipboard provider, so Vim will not
     67 attempt an OSC 52 paste query and avoids the blocking wait described in
     68 |osc52-support|.
     69 
     70 ==============================================================================
     71 vim:tw=78:ts=8:fo=tcq2:ft=help: