dracula / vim

🧛🏻‍♂️ Dark theme for Vim
https://draculatheme.com/vim
MIT License
1.34k stars 455 forks source link

Doesn't source properly under minpac or using manual package management #143

Closed dmhenry closed 5 years ago

dmhenry commented 5 years ago

I recently switched from vim-plug to minpac as my plugin manager because minpac is purportedly using the Vim8/Neovim standard directories to manage packages. I get the errors below upon loading $HOME/.config/nvim/init.vim (I'm using Neovim 0.3.7). If I directly source ${DRACULA_ROOT}/autoload/dracula.vim everything works fine. Based on the errors below, I tried swapping the locations of autoload/dracula.vim with colors/dracula.vim and everything works perfectly upon loading Neovim. It seems colors/dracula.vim is referring to variables that have yet to be defined because of the source ordering. The errors also happen when I manually install the plugin. I realize it's possible that this is a bug in Neovim if the directories are getting sourced out of order. Assuming that's not the case (I have not tried under Vim 8) then perhaps the plugin doesn't conform to Vim 8's built-in package management? I'm a Vim script newbie, so please forgive the error if I've misdiagnosed the issue.

Error detected while processing /Users/dave/.config/nvim/pack/minpac/start/vim-dracula/colors/dracula.vim:
line   34:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.fg
line   36:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.bglighter
line   37:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.bglight
line   38:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.bg
line   39:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.bgdark
line   40:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.bgdarker
line   42:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.comment
line   43:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.selection
line   44:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.subtle
line   46:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.cyan
line   47:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.green
line   48:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.orange
line   49:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.pink
line   50:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.purple
line   51:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.red
line   52:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.yellow
line   58:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette['color_' . s:i]
line  136:
E121: Undefined variable: s:bglight
E116: Invalid arguments for function <SNR>3_h
line  137:
E121: Undefined variable: s:bglighter
E116: Invalid arguments for function <SNR>3_h
line  138:
E121: Undefined variable: s:bgdark
E116: Invalid arguments for function <SNR>3_h
line  139:
E121: Undefined variable: s:bgdarker
E116: Invalid arguments for function <SNR>3_h
line  141:
E121: Undefined variable: s:fg
E116: Invalid arguments for function <SNR>3_h
line  142:
E121: Undefined variable: s:fg
E116: Invalid arguments for function <SNR>3_h
line  143:
E121: Undefined variable: s:fg
E116: Invalid arguments for function <SNR>3_h
line  145:
E121: Undefined variable: s:comment
E116: Invalid arguments for function <SNR>3_h
line  146:
E121: Undefined variable: s:comment
E116: Invalid arguments for function <SNR>3_h
line  148:
E121: Undefined variable: s:selection
E116: Invalid arguments for function <SNR>3_h
line  150:
E121: Undefined variable: s:subtle
E116: Invalid arguments for function <SNR>3_h
line  152:
E121: Undefined variable: s:cyan
E116: Invalid arguments for function <SNR>3_h
line  153:
E121: Undefined variable: s:cyan
E116: Invalid arguments for function <SNR>3_h
line  155:
E121: Undefined variable: s:green
E116: Invalid arguments for function <SNR>3_h
line  156:
E121: Undefined variable: s:green
E116: Invalid arguments for function <SNR>3_h
line  157:
E121: Undefined variable: s:green
E116: Invalid arguments for function <SNR>3_h
line  158:
E121: Undefined variable: s:green
E116: Invalid arguments for function <SNR>3_h
line  160:
E121: Undefined variable: s:orange
E116: Invalid arguments for function <SNR>3_h
line  161:
E121: Undefined variable: s:orange
E116: Invalid arguments for function <SNR>3_h
line  162:
E121: Undefined variable: s:orange
E116: Invalid arguments for function <SNR>3_h
line  163:
E121: Undefined variable: s:orange
E116: Invalid arguments for function <SNR>3_h
line  164:
E121: Undefined variable: s:bg
E116: Invalid arguments for function <SNR>3_h
line  166:
E121: Undefined variable: s:pink
E116: Invalid arguments for function <SNR>3_h
line  167:
E121: Undefined variable: s:pink
E116: Invalid arguments for function <SNR>3_h
line  169:
E121: Undefined variable: s:purple
E116: Invalid arguments for function <SNR>3_h
line  170:
E121: Undefined variable: s:purple
E116: Invalid arguments for function <SNR>3_h
line  171:
E121: Undefined variable: s:purple
E116: Invalid arguments for function <SNR>3_h
line  173:
E121: Undefined variable: s:red
E116: Invalid arguments for function <SNR>3_h
line  174:
E121: Undefined variable: s:fg
E116: Invalid arguments for function <SNR>3_h
line  176:
E121: Undefined variable: s:yellow
E116: Invalid arguments for function <SNR>3_h
line  177:
E121: Undefined variable: s:yellow
E116: Invalid arguments for function <SNR>3_h
line  179:
E121: Undefined variable: s:red
E116: Invalid arguments for function <SNR>3_h
line  181:
E121: Undefined variable: s:red
E116: Invalid arguments for function <SNR>3_h
line  182:
E121: Undefined variable: s:orange
E116: Invalid arguments for function <SNR>3_h
line  183:
E121: Undefined variable: s:cyan
E116: Invalid arguments for function <SNR>3_h
line  185:
E121: Undefined variable: s:cyan
E116: Invalid arguments for function <SNR>3_h
line  186:
E121: Undefined variable: s:green
E116: Invalid arguments for function <SNR>3_h
line  187:
E121: Undefined variable: s:comment
E116: Invalid arguments for function <SNR>3_h
line  188:
E121: Undefined variable: s:cyan
E116: Invalid arguments for function <SNR>3_h
line  190:
E121: Undefined variable: s:orange
E116: Invalid arguments for function <SNR>3_h
line  191:
E121: Undefined variable: s:bg
E116: Invalid arguments for function <SNR>3_h
line  192:
E121: Undefined variable: s:red
E116: Invalid arguments for function <SNR>3_h
line  202:
E121: Undefined variable: s:fg
E116: Invalid arguments for function <SNR>3_h
line  203:
E121: Undefined variable: s:bglighter
E116: Invalid arguments for function <SNR>3_h
line  204:
E121: Undefined variable: s:bglight
E116: Invalid arguments for function <SNR>3_h
line  205:
E121: Undefined variable: s:bglighter
E116: Invalid arguments for function <SNR>3_h
line  206:
E121: Undefined variable: s:bglight
E116: Invalid arguments for function <SNR>3_h
line  207:
E121: Undefined variable: s:bg
E116: Invalid arguments for function <SNR>3_h
line  208:
E121: Undefined variable: s:subtle
E116: Invalid arguments for function <SNR>3_h
line  247:
E121: Undefined variable: s:green
E116: Invalid arguments for function <SNR>3_h
line  248:
E121: Undefined variable: s:comment
E116: Invalid arguments for function <SNR>3_h
line   34:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.fg
line   36:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.bglighter
line   37:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.bglight
line   38:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.bg
line   39:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.bgdark
line   40:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.bgdarker
line   42:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.comment
line   43:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.selection
line   44:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.subtle
line   46:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.cyan
line   47:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.green
line   48:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.orange
line   49:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.pink
line   50:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.purple
line   51:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.red
line   52:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette.yellow
line   58:
E121: Undefined variable: g:dracula#palette
E15: Invalid expression: g:dracula#palette['color_' . s:i]
line  136:
E121: Undefined variable: s:bglight
E116: Invalid arguments for function <SNR>3_h
line  137:
E121: Undefined variable: s:bglighter
E116: Invalid arguments for function <SNR>3_h
line  138:
E121: Undefined variable: s:bgdark
E116: Invalid arguments for function <SNR>3_h
line  139:
E121: Undefined variable: s:bgdarker
E116: Invalid arguments for function <SNR>3_h
line  141:
E121: Undefined variable: s:fg
E116: Invalid arguments for function <SNR>3_h
line  142:
E121: Undefined variable: s:fg
E116: Invalid arguments for function <SNR>3_h
line  143:
E121: Undefined variable: s:fg
E116: Invalid arguments for function <SNR>3_h
line  145:
E121: Undefined variable: s:comment
E116: Invalid arguments for function <SNR>3_h
line  146:
E121: Undefined variable: s:comment
E116: Invalid arguments for function <SNR>3_h
line  148:
E121: Undefined variable: s:selection
E116: Invalid arguments for function <SNR>3_h
line  150:
E121: Undefined variable: s:subtle
E116: Invalid arguments for function <SNR>3_h
line  152:
E121: Undefined variable: s:cyan
E116: Invalid arguments for function <SNR>3_h
line  153:
E121: Undefined variable: s:cyan
E116: Invalid arguments for function <SNR>3_h
line  155:
E121: Undefined variable: s:green
E116: Invalid arguments for function <SNR>3_h
line  156:
E121: Undefined variable: s:green
E116: Invalid arguments for function <SNR>3_h
line  157:
E121: Undefined variable: s:green
E116: Invalid arguments for function <SNR>3_h
line  158:
E121: Undefined variable: s:green
E116: Invalid arguments for function <SNR>3_h
line  160:
E121: Undefined variable: s:orange
E116: Invalid arguments for function <SNR>3_h
line  161:
E121: Undefined variable: s:orange
E116: Invalid arguments for function <SNR>3_h
line  162:
E121: Undefined variable: s:orange
E116: Invalid arguments for function <SNR>3_h
line  163:
E121: Undefined variable: s:orange
E116: Invalid arguments for function <SNR>3_h
line  164:
E121: Undefined variable: s:bg
E116: Invalid arguments for function <SNR>3_h
line  166:
E121: Undefined variable: s:pink
E116: Invalid arguments for function <SNR>3_h
line  167:
E121: Undefined variable: s:pink
E116: Invalid arguments for function <SNR>3_h
line  169:
E121: Undefined variable: s:purple
E116: Invalid arguments for function <SNR>3_h
line  170:
E121: Undefined variable: s:purple
E116: Invalid arguments for function <SNR>3_h
line  171:
E121: Undefined variable: s:purple
E116: Invalid arguments for function <SNR>3_h
line  173:
E121: Undefined variable: s:red
E116: Invalid arguments for function <SNR>3_h
line  174:
line  174:
E121: Undefined variable: s:fg
E116: Invalid arguments for function <SNR>3_h
line  176:
E121: Undefined variable: s:yellow
E116: Invalid arguments for function <SNR>3_h
line  177:
E121: Undefined variable: s:yellow
E116: Invalid arguments for function <SNR>3_h
line  179:
E121: Undefined variable: s:red
E116: Invalid arguments for function <SNR>3_h
line  181:
E121: Undefined variable: s:red
E116: Invalid arguments for function <SNR>3_h
line  182:
E121: Undefined variable: s:orange
E116: Invalid arguments for function <SNR>3_h
line  183:
E121: Undefined variable: s:cyan
E116: Invalid arguments for function <SNR>3_h
line  185:
E121: Undefined variable: s:cyan
E116: Invalid arguments for function <SNR>3_h
line  186:
E121: Undefined variable: s:green
E116: Invalid arguments for function <SNR>3_h
line  187:
E121: Undefined variable: s:comment
E116: Invalid arguments for function <SNR>3_h
line  188:
E121: Undefined variable: s:cyan
E116: Invalid arguments for function <SNR>3_h
line  190:
E121: Undefined variable: s:orange
E116: Invalid arguments for function <SNR>3_h
line  191:
E121: Undefined variable: s:bg
E116: Invalid arguments for function <SNR>3_h
line  192:
E121: Undefined variable: s:red
E116: Invalid arguments for function <SNR>3_h
line  202:
E121: Undefined variable: s:fg
E116: Invalid arguments for function <SNR>3_h
line  203:
E121: Undefined variable: s:bglighter
E116: Invalid arguments for function <SNR>3_h
line  204:
E121: Undefined variable: s:bglight
E116: Invalid arguments for function <SNR>3_h
line  205:
E121: Undefined variable: s:bglighter
E116: Invalid arguments for function <SNR>3_h
line  206:
E121: Undefined variable: s:bglight
E116: Invalid arguments for function <SNR>3_h
line  207:
E121: Undefined variable: s:bg
E116: Invalid arguments for function <SNR>3_h
line  208:
E121: Undefined variable: s:subtle
E116: Invalid arguments for function <SNR>3_h
line  247:
E121: Undefined variable: s:green
E116: Invalid arguments for function <SNR>3_h
line  248:
E121: Undefined variable: s:comment
E116: Invalid arguments for function <SNR>3_h
Press ENTER or type command to continue
benknoble commented 5 years ago

This looks remarkably like #140. Can you try the updated installation instructions (see the Readme, vim doc, or website) and let us know if that works for you?

Closing as dupe in the meantime. Please re-open if the new instructions don’t solve your problem.

dmhenry commented 5 years ago

@benknoble Proposed solution 1 from https://github.com/dracula/vim/issues/140#issuecomment-496707448 has no effect:

packadd! dracula
colorscheme dracula

Proposed solution 2 from https://github.com/dracula/vim/issues/140#issuecomment-496707448 does apply the theme, but the very verbose errors are still outputted upon starting Neovim:

au VimEnter * colorscheme dracula

Manually sourcing the autoload file works:

source $HOME/.config/nvim/pack/minpac/start/vim-dracula/autoload/dracula.vim
colorscheme dracula

Alternatively, users of minpac can check out the prior commit alluded to in https://github.com/dracula/vim/issues/140 by adding the following to your init.vim or .vimrc:

call minpac#add('dracula/vim', {'name': 'vim-dracula', 'rev': 'bfbc3cadbd142e74d3b92e63f1de8711261015a4', 'frozen': 1})

The 'rev' entry chooses the commit and the 'frozen' entry will prevent minpac from automatically updating the plugin upon calling minpac#update() Obviously this isn't a great long-term solution, but it's the solution I have chosen for now.

dmhenry commented 5 years ago

I copied my previous comment to https://github.com/dracula/vim/issues/140 because I agree this is a duplicate.

benknoble commented 5 years ago

Aha! Like vim-plug, you want 'name': 'dracula'—the autoload discovery mechanism is sensitive to path names.

dsifford commented 5 years ago

If that works I'd be surprised. Autoload is sensitive to path names only after the first level of the autoload directory. So, technically, you should be able to have the plugin in this shape...

├── any-name-i-want
│   ├── autoload
│   │   ├── airline
│   │   │   └── themes
│   │   │       └── dracula.vim
│   │   └── dracula.vim

Because when calling an autoloaded function or variable (say, for example dracula#pallete), it doesn't care where the autoload is located, only that it is located somewhere in an autoload directory in your runtimepath in a file named dracula.vim.

So some shenanigans are going on with minpac I think.

dmhenry commented 5 years ago

I reinstalled the plugin with 'name': 'dracula' using the master branch and the errors persist:

call minpac#add('dracula/vim', {'name': 'dracula'})
benknoble commented 5 years ago

Hm never mind then... I seemed to recall something about that from vim-plug issues but I am clearly wrong.

dmhenry commented 5 years ago

It was worth a shot.

benknoble commented 5 years ago

I'm surprised packadd! dracula doesn't work: you've made sure it's after the minpac code? Can you check the value of runtimepath and packpath before/after the packadd! call?

dmhenry commented 5 years ago

Okay, so in process of checking the runtimepath I stumbled onto another solution. The combination of call minpac#add('dracula/vim', {'name': 'dracula'}) and packadd! dracula works. When I tried earlier I hadn't manually supplied a name for the plugin, so it defaulted to vim. Playing around I noticed that any name works so long as the minpac 'name' matches the packadd! argument. I think this was what you were suggesting previously, but we hadn't discussed the naming issue at that point.

benknoble commented 5 years ago

Continuing the discussion here (no need to clutter 140).

@dmhenry

any name works so long as the minpac 'name' matches the packadd! argument

Doy! This is what I was suggesting, but I didn't realize it. I may have to go check those installation instructions again... glad you found a solution.

dmhenry commented 5 years ago

@benknoble Well, the packadd shouldn’t really be necessary, according to minpac’s instructions, unless you install a package as optional, which I did not. In any case, I opted to simply packloadall after the minpac initialization. I do see from Dracula’s installation instructions that, under vim-plug you suggest installing ’as’: ‘dracula’, which translates under minpac to ’name’: ‘dracula’, but I took it to be only cosmetic, i.e., a preference in the directory naming. I didn’t realize the importance because, in my personal experience, the name never mattered with either minpac or vim-plug up to this point. Live and learn. Anyway, thanks for your help.

rfletchr commented 4 years ago

to make this work i had to do the following

call minpac#add('dracula/vim',{'name': 'dracula'})
packadd! dracula
colorscheme dracula
benknoble commented 4 years ago

@rfletchr overall, there is a runtimepath issue (dracula needs to be fully on the rtp prior to colorscheme dracula). It turns out this is a non-issue for packages users if you put colorscheme dracula in a plugin/ file :)

rfletchr commented 4 years ago

@benknoble I don't really have an opinion on this, I just wanted anyone who found this thread to find a clearly stated work around :)