如何从 vim/gvim 外部重新加载所有正在运行的实例中的 vim/gvim 配置

问题描述 投票:0回答:1

例如,我有一个可以从 bash 脚本运行的命令,并且所有打开的 gvim 和 vim 会话都将重新加载其配置。

这实际上已经是整个问题了,但我还将包括我的具体问题:

我希望能够通过脚本在浅色和深色主题之间切换。 我在 ~/:

中有这些文件
.vimrc             # contains "source ~/.vimrc_theme"
.vimrc_theme       # is a symbolic link to either of the following two files
.vimrc_theme_light # contains "colorscheme morning"
.vimrc_theme_dark  # contains "colorscheme evening"

和我的主题变换脚本:

#!/bin/bash

# should be either "light" or "dark"
_mode=${1:-light}

cd \
    && rm .vimrc_theme \
    && ln -s .vimrc_theme_${_mode} .vimrc_theme \
    && touch .vimrc \
    && touch .gvimrc

这个问题涉及类似的事情。在那里,人们想要从 vim 内部编辑 .vimrc,然后重新加载它。我想从外部触发重新加载。

bash vim
1个回答
0
投票

我看过类似的作品

mkfifo mypipe

还有定制,

watch -color...

但这适合文本共享。 或者,您可以从 bash 脚本写入一些 tmpfile,并放置某种循环来读取它作为 vimenter autocmd 的一部分,然后运行您的内部命令。

© www.soinside.com 2019 - 2024. All rights reserved.