首页 > 解决方案 > macVim Dracula 配色方案与 Sublime Dracula 主题不相似

问题描述

在 macOS Catalina (10.15.4) 上安装了以下编辑器:


在两者中都安装了 Dracula 颜色主题(对最初创建此颜色方案/主题的人大喊大叫 - 它摇滚!)。

问题是它们看起来不太相似(macVim 上的那个 Java 包导入和注释语法颜色很糟糕)。

macVim_dracula_theme.png

看看包导入和注释的颜色有多糟糕?


Sublime 3 的 Dracula 主题摇滚:

Sublime3Dracula.png


有人可以帮助我编辑里面的特定颜色,.vimrc/autoload/dracula.vim以便它可以匹配 Sublime 3 的 Dracula 主题的颜色吗?

如果没有,我自己在哪里可以编辑(什么文件和条目)以手动尝试不同的颜色,用于 Java 相关的包导入和注释?

有没有办法让 macVim 的 Dracula 主题与 Sublime 3 的相同(在颜色方面)?

此处列出了 Dracula Sublime 的颜色代码:

https://github.com/dracula/sublime/blob/b7e8961afa4c11d620ad26abe28d76929c7ff90b/Dracula.tmTheme

尝试编辑.vimrc/autoload/dracula.vim,没有任何改变。:(


更多详细信息:尝试通过 Vim-Plug 加载/安装 Dracula,但没有任何反应,所以我手动将 Dracula Vim 的 Github 中的文件插入(这是唯一可行的方法):

~.vimrc/autoload/dracula.vim
~.vimrc/colors/dracula.vim

.vimrc:

set nu
set ruler
" set rulerformat=%l\:%c  
set autoindent
syntax on
set showmatch " Shows matching brackets
set nocompatible 
set t_Co=256
set tabstop=4
set laststatus=2
set encoding=utf-8     
set smarttab " Autotabs for certain code
set shiftwidth=4

if has("gui_running")
  if has("gui_gtk2")
    set guifont=Inconsolata\ 12
  elseif has("gui_macvim")
    set guifont=JetBrains\ Mono\ Regular:h14
  elseif has("gui_win32")
    set guifont=Consolas:h11:cANSI
  endif
endif

" colorscheme pencil
colorscheme dracula

set background=light
let g:airline_theme = 'pencil'

call plug#begin('~/.vim/plugged')
Plug 'itchyny/lightline.vim'
Plug 'preservim/nerdtree'
Plug 'dracula/vim', { 'as': 'dracula' }
call plug#end()

map <C-t> :NERDTreeToggle<CR>

.gvimrc

set nu
set ruler
set rulerformat=%l\:%c  
set autoindent
syntax on
set nocompatible 
set t_Co=256
set tabstop=4
set laststatus=2
set encoding=utf-8     

if has("gui_running")
  if has("gui_gtk2")
    set guifont=Inconsolata\ 12
  elseif has("gui_macvim")
    set guifont=JetBrains\ Mono\ Regular:h14
  elseif has("gui_win32")
    set guifont=Consolas:h11:cANSI
  endif
endif

" colorscheme pencil
colorscheme dracula

set background=light
let g:airline_theme = 'pencil'

call plug#begin('~/.vim/plugged')
Plug 'itchyny/lightline.vim'
Plug 'preservim/nerdtree'
Plug 'dracula/vim', { 'as': 'dracula' }
call plug#end()

map <C-t> :NERDTreeToggle<CR>

~/.vimrc的顶级文件夹结构:

~/.vim$ ls
autoload    colors      plugged

里面~/.vim/plugged dir

├── dracula
│   ├── INSTALL.md
│   ├── LICENSE
│   ├── README.md
│   ├── after
│   │   ├── plugin
│   │   │   └── dracula.vim
│   │   └── syntax
│   │       ├── css.vim
│   │       ├── gitcommit.vim
│   │       ├── html.vim
│   │       ├── javascript.vim
│   │       ├── json.vim
│   │       ├── markdown.vim
│   │       ├── ocaml.vim
│   │       ├── perl.vim
│   │       ├── php.vim
│   │       ├── plantuml.vim
│   │       ├── python.vim
│   │       ├── ruby.vim
│   │       ├── rust.vim
│   │       ├── sass.vim
│   │       ├── sh.vim
│   │       ├── tex.vim
│   │       ├── typescript.vim
│   │       ├── typescriptreact.vim
│   │       ├── vim.vim
│   │       ├── xml.vim
│   │       └── yaml.vim
│   ├── autoload
│   │   ├── airline
│   │   │   └── themes
│   │   │       └── dracula.vim
│   │   ├── dracula.vim
│   │   └── lightline
│   │       └── colorscheme
│   │           └── dracula.vim
│   ├── colors
│   │   └── dracula.vim
│   ├── doc
│   │   ├── dracula.txt
│   │   └── tags
│   └── screenshot.png

标签: vimcolorssublimetext3macvimcolor-scheme

解决方案


通过将颜色方案放置在 .vimrc 和 .gvimrc 中的 call plug# 部分之后使其工作:

set nu
set ruler
" set rulerformat=%l\:%c  
set autoindent
syntax on
set showmatch " Shows matching brackets
set nocompatible 
set t_Co=256
set tabstop=4
set laststatus=2
set encoding=utf-8     
set smarttab " Autotabs for certain code
set shiftwidth=4

if has("gui_running")
  if has("gui_gtk2")
    set guifont=Inconsolata\ 12
  elseif has("gui_macvim")
    set guifont=JetBrains\ Mono\ Regular:h14
  elseif has("gui_win32")
    set guifont=Consolas:h11:cANSI
  endif
endif

set background=light
let g:airline_theme = 'pencil'

call plug#begin('~/.vim/plugged')
Plug 'itchyny/lightline.vim'
Plug 'preservim/nerdtree'
Plug 'dracula/vim', { 'as': 'dracula' }
call plug#end()

" colorscheme pencil
colorscheme dracula

map <C-t> :NERDTreeToggle<CR>

在此处输入图像描述


不过请注意,如果您使用 vim-plug,您仍然必须手动将特定的 dracula.vim 文件手动放入 autoload 和 colors 目录中。根据 Vim 的 Github 页面的 Dracula,这些说明是不正确的。


推荐阅读