Tire de todo el archivo


A menudo escribo algo en gVim, luego necesito copiarlo y pegarlo en otra aplicación.

¿Hay una manera fácil de tirar todo el archivo? Normalmente hago algo como esto

ggVG"+y

(Ir a la parte superior, modo de línea visual, ir a la parte inferior, yanqui)

Pero, ¿hay una manera mejor que me estoy perdiendo?

Author: 3 to 5 business days, 2009-05-06

13 answers

Utilizo la siguiente instrucción: :%y+

 177
Author: Luc Hermitte,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-07-08 11:49:58

ggyG (ir a la primera línea, tirar a la última línea)

Editar: Ah, portapapeles del sistema. No es exactamente rodar los dedos, pero: gg"+yG

 48
Author: Annika Backstrom,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-03 19:12:41

Una solución de trabajo en vi antiguo es :r filename en el nuevo archivo.

 14
Author: mouviciel,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-05-06 15:08:15

Otro método es este:

ggyG

Ir a la parte superior, y tirar de la parte inferior.

 12
Author: Glen Solsberry,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-05-06 14:41:41

ggyG

(Ir arriba, tirar hacia abajo)

 7
Author: Francisco Canedo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-05-06 14:44:19

Utilizo la siguiente instrucción: :%y.

 7
Author: Cheng,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-11-25 06:24:38
:0,$ y

No sé qué camino es más fácil.

 3
Author: Meninx - メネンックス,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-03 19:13:15

O simplemente en su .vimrc:

nmap <silent> <F5> ggVG"+y

Así que solo puedes usar una tecla:)

 2
Author: dr Hannibal Lecter,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-03 19:13:27

En OSX:

ggVG
!tee >(pbcopy)

Que encuentro más agradable que:

ggVG
:w !pbcopy

Ya que no muestra un mensaje: "Press ENTER or type command to continue"

 2
Author: James Scriven,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-03 19:13:53

:%y sin +funciona en todo el sistema si está utilizando neo-vim (nvim).

Esto nos permite evitar estirar los dedos hacia + - haciendo que este atajo sea mejor que ggyG.

 1
Author: LearnOPhile,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-04-06 07:23:22

Verificando la predicción en el comentario de Luc Hermitte: :%y+ y :%y* ambos tiran todo el archivo al portapapeles del sistema bajo Win7 y Vim 7.3.

 0
Author: ngks,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-02-05 16:39:26

Está sucio, pero no tiene que usar la tecla mayús en absoluto y solo 3 teclas diferentes que pueden ser más rápidas:

gg1111yy

(Suponiendo que el archivo es más corto que 1111 líneas)

 0
Author: Richard,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-27 15:27:07

En Windows a menudo solo hago CTRL-A, CTRL-C para copiar todo en el portapapeles de Windows... No puede ser más fácil que eso!

Estoy usando un estándar gvim 7.1 del sitio web...

(POR cierto: también funciona en mi mac con MacVim y ese divertido mac-key + A, mac-key + C)

 -1
Author: Daren Thomas,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-05-07 06:38:15