1

I installed Neovim on Windows 8.1 using Chocolatey. But the problem is I cannot see any color scheme as shown in the tutorials.

I have cloned a repo from GitHub to ~/.config/nvim/colors/ and it has all the colors including hybrid. But when I included it into init.vim file this is the error.

Nvim error

  • What repo? What is the structure of the directory ~/.vim/colors? – D. Ben Knoble Jun 4 '18 at 13:04
  • Neovim uses a different runtimepath than Vim. Are you sure you have the colorscheme in the runtimepath that Neovim uses? See :help xdg and the output of :set rtp? from within Neovim. – jamessan Jun 4 '18 at 13:53
  • its showing me ~/.config. – Sachin Bahukhandi Jun 4 '18 at 16:31
  • updated the question @D.BenKnoble – Sachin Bahukhandi Jun 4 '18 at 16:41
  • The answer is contained in the projects README. I will add a full answer later, but next time make sure to read the the README. – D. Ben Knoble Jun 4 '18 at 16:46
1

Colorschemes (in general)

When executing the :colorscheme {name} command, vim1 searches runtimepath2 for the file colors/{name}.vim. This is explained under :help :colorscheme.

Why We Care

If I wanted to install the molokai theme by itself, I could conceivably grab the file form GitHub and put it in my vim3 directory under colors. Then :color molokai would work just fine. But then my only recourse to update it would be copying the file again whenever I felt like doing so.

Things like vim packages, pathogen, and other plugin managers were born to help with this. They have the explicit goal of allowing an entire repository of code to become a part of the runtime path. Effectively, this means that a repo with colors, plugin, and after can become a mini vim directory, having it's files loaded as within my personal vim directory.

Why We Care (part 2)

flazz/vim-colorschemes is a repo. It's not one colorscheme, it's a whole bunch. So, either

  1. Clone it to $MYVIMDIRECTORY/colors3 ; or
  2. Put it in a package; or
  3. Use a plugin manager of your choice.

The key here is that the colors directory provided by flazz/vim-colorschemes must be on your runtimepath4. Again, packages, plugin managers, or simply the base colors directory are the options here, each with their merits and difficulties. I recommend packages, but to each his own.

Solving the OPs Problem

I suspect that the OP's main problem is where to put the directory colors from flazz/vim-colorschemes.

  • "Standard": Put the colors directory in your vim3 directory (such that vim/colors is the directory from the repo)
    • Benefits: extremely backwards compatible
    • Downsides: difficult to add new colorschemes to this directory, as it is now a git repository
  • Packages: Put the whole repo in your vim3 directory under pack/{your_package_name}/opt
    • Benefits: keep one plugin repo isolated from another, builtin to vim
    • Downsides: vim 8 required (not sure about nvim)
  • Plugin manager: Do what they tell you to do (e.g. with Pathogen it would be at vim/bundle/vim-colorschemes or similar)
    • Benefits: plugin manager does a lot of heavy-lifting for you (Pathogen is different--it was effectively packages before packages were created)
    • Downsides: Learn a new tool, more requirements to making your vim config portable

Then make sure color {name} is in your vimrc/init.vim.


Notes

  1. For this post, vim refers to both Vim and NeoVim
  2. Vim uses (effectively) ~/.vim, $VIMRUNTIME, ~/.vim/after (:help rtp). NeoVim uses the XDG standard, so it's something like ~/.config/nvim for Unix and ~/AppData/Local/nvim for Windows
  3. See #2: This is going to be one of ~/.vim, ~/_vim, ~/.config/nvim, ~/AppData/Local/nvim depending on your vim and OS.
  4. Note that this is pretty much explicitly covered in the README

Based on the screenshot in the OP, the AppData path is the right one for this Q&A. This can be verified with :echo &rtp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.