<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
    <title>Arrecio&#x27;s blog - Nvim</title>
    <link rel="self" type="application/atom+xml" href="https://blog.arrecio.com/tags/nvim/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://blog.arrecio.com"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-10-04T00:00:00+00:00</updated>
    <id>https://blog.arrecio.com/tags/nvim/atom.xml</id>
    <entry xml:lang="es">
        <title>Lidiando con el portapapeles en Nvim+Linux+Wayland</title>
        <published>2026-10-04T00:00:00+00:00</published>
        <updated>2026-10-04T00:00:00+00:00</updated>
        
        <author>
          <name>
            Arrecio
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://blog.arrecio.com/blog/20261004-luchandoclicpboard/"/>
        <id>https://blog.arrecio.com/blog/20261004-luchandoclicpboard/</id>
        
        <content type="html" xml:base="https://blog.arrecio.com/blog/20261004-luchandoclicpboard/">&lt;p&gt;Cuando hablamos de portapapeles en Linux hablamos de &lt;code&gt;PRIMARY&lt;&#x2F;code&gt; y de &lt;code&gt;CLIPBOARD&lt;&#x2F;code&gt;. Las operaciones &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;copy_and_paste&quot;&gt;copy&#x2F;paste&lt;&#x2F;a&gt; son utilizadas masivamente por los usuarios de los sistemas informáticos y son esenciales especialmente para desarrolladores. Su comportamiento en entornos gráficos sigue una serie de principios establecidos y discutidos por &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.freedesktop.org&#x2F;wiki&#x2F;Specifications&#x2F;ClipboardsWiki&#x2F;&quot;&gt;freedesktop.org&lt;&#x2F;a&gt; que habla también de SECUNDARY. Cada una de estas variables pueden contener datos distintos los cuales no tienen porqué ser texto plano sino cualquier otro tipo de dato asociado a su &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;mimetype.io&#x2F;all-types&quot;&gt;MIME&#x2F;Type&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Establecidos los principios, los servidores gráficos &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.x.org&#x2F;&quot;&gt;Xorg&lt;&#x2F;a&gt; y &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;wayland.freedesktop.org&#x2F;&quot;&gt;Wayland&lt;&#x2F;a&gt; deben implementar su propia gestión del portapapeles.&lt;&#x2F;p&gt;
&lt;p&gt;Aunque desde freedesktop indican que primary funciona de manera prácticamente transparente, copiando automáticamente las &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;X_Window_System_selection#Selections&quot;&gt;selecciones&lt;&#x2F;a&gt; y pegando con el botón dentral del ratón, la realidad es que esto no parece funcionar de tal manera, al menos para mi ya que mi entorno tiene otros usos para ese botón central.&lt;&#x2F;p&gt;
&lt;p&gt;Sea como fuere mientras en Windows se trabaja con un &quot;único portapapeles&quot; en Linux esto no sucede y lo que me ha llevado a enfrentar algún problema por incoherencias con el pegado desde el mismo cuando uso &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;neovim.io&#x2F;&quot;&gt;Nvim&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;figure&gt;
&lt;img class=&quot;no-hover&quot;src=&quot;nvimclipboards.jpg&quot;&#x2F;&gt;
&lt;figcaption&gt;Nvim puede copiar y pegar hacia y desde dos &quot;portapapeles&quot; distintos.&lt;&#x2F;figcaption&gt;
&lt;&#x2F;figure&gt;
&lt;h3 id=&quot;lo-que-me-ha-llevado-a-escribir-esto&quot;&gt;Lo que me ha llevado a escribir esto&lt;&#x2F;h3&gt;
&lt;p&gt;Si dentro de Nvim seleccionas texto y pulsas botón derecho del ratón obtienes opciones para el manejo del copiado y pegado de texto. Esto funciona correctamente, si te diriges a otra aplicación como por ejemplo el navegador Firefox, y copias texto con &lt;code&gt;Ctrl-C&lt;&#x2F;code&gt; y luego lo pegas con &lt;code&gt;Ctrl-V o Shift-Ins&lt;&#x2F;code&gt; en la ventana de ese navegador funciona correctamente, cuando lo pegas en con el menu contextual de Nvim se pega correctamente y si lo haces con Shift-Ins también.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
	&lt;p&gt;En Nvim Ctrl-V tiene otras funciones, la combinación para el pegado es &lt;code&gt;Ctrl-Shift-V&lt;&#x2F;code&gt; pero Shift-Ins realiza el mismo comportamiento y al menos a mi me resulta más cómoda.&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;Si vuelvo a seleccionar algo en Nvim y usamos el botón derecho para copiar y posteriormente pegar, el contenido del portapapeles parece actualizado, pero si vuelves a usar Shift-Ins se pega en mi caso el contenido copiado del navegador.&lt;&#x2F;p&gt;
&lt;p&gt;Lo que a mi me sucede:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Copia un texto del navegador Firefox ya sea con Ctrl-C o con la opción de copiar del menu contextual, lo llamo [Firefox].&lt;&#x2F;li&gt;
&lt;li&gt;Copio un texto del buffer de Nvim utilizando el menu contextual, lo llamo [Nvim].&lt;&#x2F;li&gt;
&lt;li&gt;Si pego con el botón derecho en Nvim obtengo [Nvim], si lo hago con Shift-Ins obtengo [Firefox].&lt;&#x2F;li&gt;
&lt;li&gt;Si vuelvo a Firefox y pego con el menu contextual obtengo [Nvim] y si pego con Ctrl-V o Shift-Ins pego igualmente [Nvim].&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;En Nvim existe un lugar propio donde alojar datos para copiar y pegar, algo que funciona como un portapapeles interno. Esto se hace con las operaciones &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;neovim.io&#x2F;doc&#x2F;user&#x2F;usr_04&#x2F;&quot;&gt;yank, delete y paste&lt;&#x2F;a&gt;. Para hacer que Nvim utilice el portapapeles del sistema en lugar del interno se puede configurar con &lt;code&gt;vim.opt.clipboard = &quot;unnamedplus&quot;&lt;&#x2F;code&gt;. Más información con &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;neovim.io&#x2F;doc&#x2F;user&#x2F;provider&#x2F;#_clipboard-integration&quot;&gt;&lt;code&gt;:h clipboard&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; en Nvim.&lt;&#x2F;p&gt;
&lt;p&gt;Al final el comportamiento esperado según lo dicho por freedesktop queda en manos de quien implementa el comportamiento de los menús contextuales y las respuestas a la pulsación de las teclas.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
	&lt;p&gt;Para profundizar en el tema en el siguiente enlace podemos ver como Wayland opera con la &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;wayland.app&#x2F;protocols&#x2F;primary-selection-unstable-v1&quot;&gt;Primary selection&lt;&#x2F;a&gt; y la documentación del &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;isaacfreund.com&#x2F;docs&#x2F;wayland&#x2F;ext-data-control-v1&#x2F;&quot;&gt;ext data control&lt;&#x2F;a&gt; que es el encargado de operar con el portapapeles&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;mi-gestor-de-portapapeles-wl-clipboard&quot;&gt;Mi gestor de portapapeles: wl-clipboard&lt;&#x2F;h3&gt;
&lt;p&gt;Como gestor de portapapeles en Wayland uso &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bugaevc&#x2F;wl-clipboard&quot;&gt;wl-clipboard&lt;&#x2F;a&gt; el cual instalo en mi Arch con &lt;code&gt;sudo pacman -S wl-clipboard&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Este paquete lo que hace es &quot;engancharse&quot; a las operaciones de copiado y pegado de Wayland enviando el contenido a &lt;code&gt;wl-copy&lt;&#x2F;code&gt; y tratándolo de obtener con &lt;code&gt;wl-paste&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Podemos ver el contenido del portapeles con los comandos &lt;code&gt;wl-paste&lt;&#x2F;code&gt; para ver el contenido de CLIPBOARD o &lt;code&gt;wl-paste --primary&lt;&#x2F;code&gt; para ver el contenido de PRIMARY.&lt;&#x2F;p&gt;
&lt;p&gt;Reproduciendo los pasos que indiqué en el apartado enterior y usando después los comandos dados se sacan las siguientes conclusiones.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Lo copiado en Firefox (y probablemente en cualquier otra aplicación &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.gtk.org&#x2F;&quot;&gt;GTK&lt;&#x2F;a&gt;) acaba tanto en PRIMARY como en CLIPBOARD.&lt;&#x2F;li&gt;
&lt;li&gt;Lo copiado en Nvim con el menu contextual se copia únicamente a CLIPBOARD.&lt;&#x2F;li&gt;
&lt;li&gt;Lo pegado en Nvim con el menu contextual es lo que existe en CLIPBOARD, mientras que lo pegado con Shift-Ins es el contenido de PRIMARY.&lt;&#x2F;li&gt;
&lt;li&gt;Lo pegado en Firefox es el contenido de CLIPBOARD.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Hablando de otras aplicaciones por ejemplo mi aplicación para termina es &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;wezterm.org&#x2F;index.html&quot;&gt;WezTerm&lt;&#x2F;a&gt; permite copiar seleccionando y utilizando Ctrl-C o simplemente haciendo click con el botón derecho y el comportamiento por defecto para esta operación copia la selección tanto en PRIMARY como en CLIPBOARD aunque puede establecerse otro comportamiento &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;wezterm.org&#x2F;config&#x2F;lua&#x2F;window&#x2F;copy_to_clipboard.html&quot;&gt;mediante configuración&lt;&#x2F;a&gt; eligiendo únicamente uno de los dos.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;para-no-fallar-usar-ctrl-r&quot;&gt;Para no fallar usar Ctrl-R&lt;&#x2F;h3&gt;
&lt;p&gt;Para evitar comportamientos extraños una opción sería forzar una sincronización permanente para lo que necesitaríamos ejecutar automáticamente algunas llamadas a wl-copy en segundo plano, al menos si usas wl-clipboard.&lt;&#x2F;p&gt;
&lt;p&gt;En mi caso pienso que lo mejor es lidiar con ello. Una vez que conoces la existencia de dos portapapeles distintos, o como prefieras llamarlos, todo resulta un poco más sencillo de manejar.&lt;&#x2F;p&gt;
&lt;p&gt;En el caso de Nvim hay que saber que Shift-Ins pega desde PRIMARY y si la aplicación desde la que copiaste utiliza únicamente CLIPBOARD tendrás que usar el menu contextual para pegar y en cualquier caso siempre está la opción de usar &lt;code&gt;Ctrl-R&lt;&#x2F;code&gt; en modo inserción (copiar desde registro, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;neovim.io&#x2F;doc&#x2F;user&#x2F;insert&#x2F;#i_CTRL-R&quot;&gt;&lt;code&gt;:h i_CTRL-R&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;) y decidir qué insertar, ofreciéndose una diversidad de opciones entre las que estan la copia desde el proveedor de portapapeles del sistema. Con la tecla &lt;code&gt;+&lt;&#x2F;code&gt; inserta texto desde CLIPBOARD y con la &lt;code&gt;*&lt;&#x2F;code&gt; desde PRIMARY. Respecto a ese portapapeles interno del que hablábamos las tecla &lt;code&gt;&quot;&lt;&#x2F;code&gt; inserta su contenido.&lt;&#x2F;p&gt;
&lt;p&gt;Tanto + como * se consideran registros. Con Ctrl-R en modo inserción realizamos operaciones de lectura sobre los mismos y los insertamos en el lugar del cursor. Para realizar la escritura se debe pulsar &lt;code&gt;&quot;&lt;&#x2F;code&gt; en modo visual tras lo que obtendremos la lista de registros, seleccionado el registro correspondiente este quedará a la espera de datos, con la tecla &lt;code&gt;y&lt;&#x2F;code&gt; podremos insertarles el texto seleccionado en ese modo visual. Vimos que Shift-Ins por defecto copiaba del PRIMARY y la realidad es que desconozco una combinación de teclas para copiar al PRIMARY (aunque podría crearla). Con &lt;code&gt;&quot;*y&lt;&#x2F;code&gt; haces esa operación.&lt;&#x2F;p&gt;
&lt;p&gt;La modificación del contenido de ambos registros se realiza mediante el proveedor de clipboard o portapapeles el cual tiene inicialmente un comportamiento por defecto en función del proveedor de portapapeles del sistema detectado pero que puede sobreescribirse mediante la definición de la variable &lt;code&gt;clipboard&lt;&#x2F;code&gt;. Para cambiar el comportamiento de manera global se puede hacer por ejemplo lo siguiente:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #CDD6F4; background-color: #1E1E2E;&quot;&gt;&lt;code data-lang=&quot;lua&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vim.g.clipboard&lt;&#x2F;span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; &amp;quot;wl-clipboard&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    copy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;quot;+&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;] &lt;&#x2F;span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; &amp;#39;wl-copy --foreground --type text&#x2F;plain&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;quot;*&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;] &lt;&#x2F;span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; &amp;#39;wl-copy --foreground --primary --type text&#x2F;plain&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    paste&lt;&#x2F;span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;quot;+&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;] &lt;&#x2F;span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;function&lt;&#x2F;span&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; vim.fn.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;systemlist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;#39;wl-paste --no-newline|sed -e &amp;quot;s&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\r&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;$&#x2F;&#x2F;&amp;quot;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;, {&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #FAB387;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;-- &amp;#39;1&amp;#39; keeps empty lines&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;        end&lt;&#x2F;span&gt;&lt;span&gt;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;quot;*&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;] &lt;&#x2F;span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;function&lt;&#x2F;span&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;()&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; vim.fn.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;systemlist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;#39;wl-paste --primary --no-newline|sed -e &amp;quot;s&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\r&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;$&#x2F;&#x2F;&amp;quot;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;, {&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #FAB387;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;        end&lt;&#x2F;span&gt;&lt;span&gt;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cache_enabled&lt;&#x2F;span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F38BA8;&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Con ello cambiamos el comportamiento de la escritura y la escritura en los registros. Si hacemos &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;neovim.io&#x2F;doc&#x2F;user&#x2F;provider&#x2F;#g%3Aclipboard&quot;&gt;&lt;code&gt;:h g:clipboard&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; encontramos información sobre como configurar el proveedor de portapapeles.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;solucion-particular-para-nvim&quot;&gt;Solución particular para Nvim&lt;&#x2F;h3&gt;
&lt;p&gt;Por otro lado si queremos cambiar el comportamiento de Ctrl-Shift-V, y de paso el de Ctrl-Ins, podemos modificar otra variable global llamada &lt;code&gt;paste&lt;&#x2F;code&gt; (ver &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;neovim.io&#x2F;doc&#x2F;user&#x2F;provider&#x2F;#paste&quot;&gt;&lt;code&gt;h: paste&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;). Modificando ese objeto (ver &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;neovim.io&#x2F;doc&#x2F;user&#x2F;lua&#x2F;#vim.paste()&quot;&gt;&lt;code&gt;:h vim.paste())&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; podemos solucionar el problema para Nvim forzando que siempre se utilice el proveedor de CLIPBOARD. En mi caso al utilizar wl-clipboard obtengo el contenido con la llamada al comando del sistema wl-paste sin argumentos (con --primary obtendría el contenido de PRIMARY).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #CDD6F4; background-color: #1E1E2E;&quot;&gt;&lt;code data-lang=&quot;lua&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vim.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;paste&lt;&#x2F;span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt; function&lt;&#x2F;span&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    clipboard&lt;&#x2F;span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; vim.fn.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;system&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;#39;wl-paste&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    lines&lt;&#x2F;span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F9E2AF;font-style: italic;&quot;&gt; clipboard&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;gmatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;quot;[^&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\r\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;]+&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;        table.insert&lt;&#x2F;span&gt;&lt;span&gt;(lines, s)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;    end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    vim.api.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;nvim_put&lt;&#x2F;span&gt;&lt;span&gt;(lines, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;#39;c&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F38BA8;&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F38BA8;&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Con esta modificación Shift-Ins insertará siempre lo que devuelva wl-paste y no únicamente cuando se trate de contenido catalogado como texto plano. Esto se puede evitar con la comprobación inicial del contenido buscando &lt;code&gt;text&#x2F;plain&lt;&#x2F;code&gt; en el resultado de &lt;code&gt;wl-paste --list&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
</content>
        
    </entry>
</feed>
