当前位置:网站首页>Configuring vim(12) from scratch - theme configuration

Configuring vim(12) from scratch - theme configuration

2022-08-11 11:00:00 aluluka

In our further enhancementvim的功能之前,我们先为vimPrepare a beautiful theme,After all, programming with an ugly, primitive interface is somewhat of a grind.Facing the ugly interface for a long time will more or less produce depression.Below are some of the theme plugins that I recommend

tokyonight

官方仓库
在使用 packer It can be used as a plugin manager

use 'folke/tokyonight.nvim'

来安装该插件

我们在 init.luaAdd the code to enable the theme in

vim.cmd[[colorscheme tokyonight]]

我们发现 It's gotten a little better now

in order to configure the theme,我们在 luaCreate a new one in the directory plugin-config 目录,A configuration file dedicated to placing various plugins.For example config for this theme should be placed in lua/plugin-config/tokyonight.lua 中.我们在 init.lua 中引用它

require("plugin-config/tokyonight")

我们在 tokyonight Put the following configuration in

-- Configure theme color mode as  storm
vim.g.tokyonight_style = "storm"
-- 允许neovimUse this theme color for the terminal in 
vim.g.tokyonight_terminal_colors = true
-- Use italics for comments
vim.g.tokyonight_italic_comments = true

The final effect is roughly as shown
在这里插入图片描述

vscode

Here's another theme that I like more——vscode.nvim

这是一个使用lua实现的vscode的配色主题,Both dark and light modes are supported.在 packer 的配置中,We can add the following code

use 'Mofiqul/vscode.nvim'

同样的可以使用 vim.cmd[[colorscheme vscode]] to enable the theme

我们可以在 plugin-config 中创建一个 vscode.lua file to configure the theme

-- 使用 dark 主题 1 vim.o.background = 'dark'

local c = require('vscode.colors')
require('vscode').setup({
    
    -- Transparent backgrounds are allowed
    transparent = true,
    -- Use italics for comments
    italic_comments = true,
    -- 禁止使用 nvim-tree 背景色
    disable_nvimtree_bg = true,
    -- Override the color of some elements
    color_overrides = {
    
        vscLineNumber = '#FFFFFF',
    },
})

Finally we also need to be in init.lua 中加载它

require('plugin-config/vscode')

最后的效果如下所示
在这里插入图片描述
I prefer it by comparison tokyonight 主题,If you have a favorite theme or color scheme, you can also give it in the comment area

原网站

版权声明
本文为[aluluka]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/223/202208111047099187.html