如何设置,配置和使用Vim配色方案

Vim is very popular ans useful text editor based command line and GUI. I prefer vim because of its featured over nano etc. Vim have color scheme and highlighting features where different syntax for programming languages can be printed in a pretty and understandable form. In this tutorial we will look how to change color schemes. Reading following tutorials will be beneficial.

Vim是非常流行的基于命令行和GUI的有用的文本编辑器。 我更喜欢vim,因为它比nano等具有更多的功能。Vim具有配色方案和突出显示功能,可以用一种漂亮易懂的形式打印用于编程语言的不同语法。 在本教程中,我们将研究如何更改配色方案。 阅读以下教程将是有益的。

Linux Vi and Vim Command Line Text Editor Tutorial

Linux Vi和Vim命令行文本编辑器教程

Vim Copy, Cut and Paste Commands and Operations

Vim复制,剪切和粘贴命令和操作

列出Vim配色方案(List Vim Color Schemes)

Before selecting a color scheme we need to list vim provided color schemes.  Vim color schemes are stored in vim directory named /usr/share/vim/vim80/colors/ but vim80 can be different according to vim version. Color schemes have .vim extension. We can use ls -l command in order to print available color schemes.

选择配色方案之前,我们需要列出vim提供的配色方案。 Vim配色方案存储在名为/usr/share/vim/vim80/colors/ vim目录中,但根据vim版本的不同, vim80可以有所不同。 配色方案具有.vim扩展名。 我们可以使用ls -l命令来打印可用的配色方案。

$ ls -l /usr/share/vim/vim*/colors/

使用colorscheme命令列出Vim配色方案 (List Vim Color Schemes with colorscheme Command)

We have an other option where we can list color schemes. We can use colorscheme command and then press space and tab. This will list avaibilible color schemes. Currently selected color scheme will be colored as yellow like below.

我们还有另一个选项可以列出配色方案。 我们可以使用colorscheme命令,然后按spacetab 。 这将列出可用的配色方案。 当前选择的配色方案将变为黄色,如下所示。

:colorscheme

then SPACE and TAB

然后按SPACETAB

List Vim Color Schemes with colorscheme Command
List Vim Color Schemes with colorscheme Command
使用colorscheme命令列出Vim配色方案

使用colorscheme命令设置配色方案(Set Color Scheme with colorscheme Command)

Now we know what color schemes are available. We will select color scheme with colorscheme command. Actually we were very close to select color scheme in previous step. We will just provide the color scheme name to the  colorscheme command. In this example we will select desert.

现在我们知道可以使用哪些配色方案。 我们将使用colorscheme命令选择配色方案。 实际上,我们在上一步中非常接近选择配色方案。 我们仅将颜色方案名称提供给colorscheme命令。 在此示例中,我们将选择沙漠。

: colorscheme desert

and the Python script syntax will be highlighted like below.

并且Python脚本语法将如下所示突出显示。

Set Color Scheme with colorscheme Command
Set Color Scheme with colorscheme Command
使用colorscheme命令设置配色方案

使用colo命令设置配色方案(Set Color Scheme with colo Command)

Vim provides shortcut usage for commands. But provided part should be uniquely identifier. This means we can use colo which is unique and address colorscheme command. We will set color scheme delek in this example.

Vim提供了命令的快捷方式。 但是提供的部分应该是唯一的标识符。 这意味着我们可以使用唯一的colo和address colorscheme命令。 在此示例中,我们将设置配色方案delek

: colo delek
Set Color Scheme with colo Command
Set Color Scheme with colo Command
使用colo命令设置配色方案

使配色方案永久指定vimrc(Make Color scheme Persistent Specifying  vimrc)

Changes are not saved between vim sessions. So color scheme changes we have made will be lost in next sessions. Doing this change again and again in ever is not practical. We can save this configuration to the  vimrc configuration file and made it persistent. vimrc is located at /etc or users home directory.

在vim会话之间不保存更改。 因此,我们所做的配色方案更改将在下一个会话中丢失。 一次又一次地进行这种更改是不切实际的。 我们可以将该配置保存到vimrc配置文件中,并使其持久化。 vimrc位于/etc或用户主目录中。

echo ":colorscheme delek" >> ~/.vimrc
Make Color scheme Persistent Specifying  vimrc
Make Color scheme Persistent Specifying  vimrc
使配色方案永久指定vimrc

第三杆配色方案 (3rd Pary Color Schemes)

As vim is modular tool there are alot of different color schemes provided by 3rd parties. We can find them by searching in google. As an example following github repository provides a lot of new color schemes.

由于vim是模块化工具,因此第三方提供了许多不同的配色方案。 我们可以通过在Google中搜索找到它们。 作为示例,以下github存储库提供了许多新的配色方案。

https://github.com/flazz/vim-colorschemes
3rd Pary Color Schemes
3rd Pary Color Schemes
第三杆配色方案
LEARN MORE  How To Move End of File and Line In Vi or Vim?
了解更多信息如何在Vi或Vim中移动文件结尾和行?

翻译自: https://www.poftut.com/set-configure-use-vim-color-scheme/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值