【问题标题】:Can I set the vim colorscheme from the command line?我可以从命令行设置 vim 颜色方案吗?
【发布时间】:2016-09-20 21:01:35
【问题描述】:

我设置了一个热键,可以在我通过 SSH 连接到服务器时自动创建一些别名并安装脚本(为了我的工作)。有谁知道从命令行设置 vim colo 以便我可以在热键中使用它的方法?谢谢!

【问题讨论】:

  • 如果您要安装脚本,为什么不将配色方案添加到$HOME/.vimrc
  • 最奇怪的是,我通过 SSH 连接的服务器没有 vimrc。他们安装了 vim,还有一个 .viminfo,但没有 .vimrc。不知道该怎么做。
  • 这只是意味着还没有人创建一个!并非所有点配置文件都带有默认值。

标签: bash vim ssh colors terminal


【解决方案1】:

你可以在启动vim时运行命令:

vim +'colorscheme blue' my_file

man vim:

   -c {command}
       {command}  will  be  executed after the first file has been read.
       {command} is interpreted as an Ex command.  If the {command} contains 
       spaces it must be enclosed in double quotes (this depends on the shell 
       that is used). Example: Vim "+set si" main.c
       Note: You can use up to 10 "+" or "-c" commands.

【讨论】:

  • 啊,谢谢!我可以使用它来制作这样的别名:alias vim="vim +'colo elflord'"。没有考虑使用附加命令的可能性。
  • @Egrodo 如果您想在每次打开 vim 时设置颜色方案,那么您应该将该行添加到您的 vimrc 文件中。见$ vim '+help vimrc'
猜你喜欢
  • 2011-02-27
  • 1970-01-01
  • 2016-11-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-18
  • 1970-01-01
相关资源
最近更新 更多