Vim error message E121: Undefined variable: s:visual_black with vim plugin

Viewed 853

Error terminal ubuntu:

Performed the configuration of vim using the plugin vim plugin performed the configurations based on the documentation provided by the plugin, but I'm not able to adjust the error, I'm having trouble using colorscheme onedark.

https://github.com/junegunn/vim-plug

https://vimawesome.com/plugin/vim-colorschemes-sweeter-than-fiction

when i try to access any file using vim i always return the error below:

userpc in ~ took 15s 
✦ ❯ vim ~/.vimrc

Error detected while processing /home/userpc/.vim/plugged/vim-colorschemes/colors/onedark.vim:
line  122:
E716: Key not present in Dictionary: visual_black " Black out selected text in 16-color visual mode
line  221:
E121: Undefined variable: s:visual_black
E116: Invalid arguments for function <SNR>17_h
Error detected while processing /home/userpc/.vimrc:
line   85:
E492: Not an editor command: syntaxe on
Press ENTER or type command to continue

.vimrc

 set tabstop=3
  2 set expandtab
  3 set number
  4 filetype indent on
  5 set autoindent
  6 set nocompatible
  7 set background=dark
  8 
  9 "Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
 10 "If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
 11 "(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
 12 if (empty($TMUX))
 13   if (has("nvim"))
 14     "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
 15     let $NVIM_TUI_ENABLE_TRUE_COLOR=1
 16   endif
 17   "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175    162 >
 18   "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1f    e65b25cd >
 19   " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
 20   if (has("termguicolors"))
 21     set termguicolors
 22   endif
 23 endif
 24 
 25 
 26 let g:airline_theme='onedark'
 27 let g:onedark_termcolors=256
 28 
 29 
 30 let g:onedark_termcolors=16
 31 let g:lightline = {
 32    \ 'colorschema': 'onedark',
 33    \}
 34 "----------------------------------------------
 35 
 36 
 37 
 38 
 39 call plug#begin('~/.vim/plugged')
 40 
 41 " Make sure you use single quotes
 42 
 43 " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
 44 Plug 'junegunn/vim-easy-align'
 45 
 46 " Any valid git URL is allowed
 47 Plug 'https://github.com/junegunn/vim-github-dashboard.git'
 48 
 49 " Multiple Plug commands can be written in a single line using | separators
 50 Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
 51 
 52 " On-demand loading
 53 Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
 54 Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
 55 
 56 " Using a non-default branch
 57 Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
 58 
 59 " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
 60 Plug 'fatih/vim-go', { 'tag': '*' }
 61 
 62 " Plugin options
 63 Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
 64 
 65 " Plugin outside ~/.vim/plugged with post-update hook
 66 Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
 67 
 68 " Unmanaged plugin (manually installed and updated)
 69 Plug '~/my-prototype-plugin'
 70 
 71 " Plugin Colorschemes thema
 72 Plug 'flazz/vim-colorschemes'
 73 
 74 " OneDarck schemes thema color
 75 Plug 'joshdick/onedark.vim'
 76 
 77 " Polyglot vim 
 78 Plug 'sheerun/vim-polyglot'
 79 Plug 'dracula/vim', { 'as': 'dracula' }
 80 
 81 " Initialize plugin system
 82 call plug#end()
 83 
 84 colorscheme onedark
 85 syntaxe on 
1 Answers

Well, you have several issues, here.

The most obvious one, and the easiest to fix, is the extra e in:

syntaxe on

Then you have the double install problem: you have two onedark.vim. One installed via Plug 'flazz/vim-colorschemes' and the other installed via Plug 'joshdick/onedark.vim', which makes no sense.

Then you have the "over-engineered colorscheme problem". onedark.vim is a relatively recent part of the sadly ever-growing trend of over-engineered/bloated colorschemes that try to be too clever for their—or their users'—own good.

Where to start?

  • onedark.vim, being the over-engineered mess it is, relies on an autoloaded script to define its colors.
  • The onedark.vim in flazz/vim-colorschemes is not correctly packaged. It lacks that autoloaded script so it simply can't work out of the box.
  • But you are lucky, in a way, because you have also installed the original onedark.vim, which comes with the necessary autoloaded script, so the onedark.vim from flazz/vim-colorschemes uses the autoloaded script from joshdick/onedark.vim.
  • But your luck stops there, because the onedark.vim packaged in flazz/vim-colorschemes is outdated: it assumes the presence of a visual_black key that was removed in a subsequent version of the original so the original's autoloaded script is not that useful after all.

Now, how do we get out of that mess?

It's simple: get rid of flazz/vim-colorschemes.

You will be left with the original onedark.vim, which, while still terribly over-engineered, seems to be properly maintained so it can be expected to work in a more controlled manner than a badly packaged "fork".

Related