简体   繁体   English

vim 跨屏宏 windows

[英]vim macro across screen windows

I have recorded a vim macro in one screen window. In same screen session, I have multiple windows.我在一个屏幕window中录制了一个vim宏。在同一个屏幕session中,我有多个windows。

How to make macro I recorded in 1st screen window across other screen windows / across screen sessions?如何制作我在第一个屏幕 window 跨其他屏幕 windows / 跨屏幕会话录制的宏?

Do we have to do something with vim registers for this?我们是否必须为此对 vim 寄存器做些什么?

  • If the two screen windows show two separate Vim instances on the same machine如果两个屏幕 windows 在同一台机器上显示两个单独的 Vim 实例

    • If Vim is built with clipboard support如果 Vim 内置了剪贴板支持

      1. In the Vim instance where you recorded that macro, put the content of the macro's register into the clipboard register:在您录制该宏的 Vim 实例中,将宏寄存器的内容放入剪贴板寄存器:

         " assuming you recorded your macro in register `a`:let @+ = @a
      2. In the other Vim instance, put the content of the clipboard register into a named named register:在另一个 Vim 实例中,将剪贴板寄存器的内容放入一个命名的命名寄存器中:

         :let @a = @+
    • If Vim is not built with clipboard support如果 Vim 没有内置剪贴板支持

      Vim stores registers in a .viminfo file. Vim 将寄存器存储在.viminfo文件中。 You are theoretically allowed to write to and read from arbitrary .viminfo files but it can lead to unwanted loss of state in Vim. Read :help viminfo-read-write very carefully and proceed with caution.理论上允许您写入和读取任意.viminfo文件,但它可能导致 Vim 中的 state 意外丢失。阅读:help viminfo-read-write非常仔细并谨慎行事。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM