Molokai for Vim

I've mentioned in the past some of the color scheme scripts that I've used to make Vim nicer, and there are some really nice ones. However, I was growing tired of them lately. I looked around the Vim site trying to find something better but came up empty handed.

Around that time I ran into Hamish Macpherson's blog, and noticed he was using a really nice color scheme on his code screenshots, and then read in one of his comments that it was a slightly modified version of the monokai theme for TextMate.

I decided to try porting them to Vim, though it's a very loose port. I've been using and tweaking it for a few weeks now, but I'm pretty satisfied with it. I decided to post it here just in case anyone else is interested.

There are two variations to the theme; which one is used can be controlled by setting the g:molokai_original variable in your .vimrc file.

The default option (molokai_original == 0) uses the dark gray background variation similar to Hamish' version, and looks like this:

molokai normal

With molokai_original == 1, the script will use the original monokai colors, and looks like this:

molokai original

You can get the script from my dotfiles repository on github; where you'll find always the most recent version. Enjoy!

Technorati tags: ,

38 comments

  1. Thanks for this port! Probably the best editor theme ever (at least the original version).

  2. Kind of a VIM newb, so pardon if this is a question with an obvious answer, but…

    When I use your theme in GVIM, it looks exactly as it does in the screenshot. However, when I try to use VIM from the terminal (ie, “vim example.rb”, “:colors molokai”), the background color doesn’t change to that of the theme, and the colors are all a little bit different than the ones in the screenshot- for instance, “@something” is kind of aqua instead of orange, etc… This has held true for my tests on OSX, linux, and windows. Is there a setting I’m not aware of?

    Much appreciated!

  3. @Alex: Keeping the colors 100% the same on the console is impossible simply because the capabilities aren’t there. A couple of things that might help:

    - Make sure you’re using a console terminal capable of 256 colors; not all of them do (particularly on mac). You might need to explicitly force Vim to use that by doing “set t_Co=256″ on your .vimrc file.
    - The windows console is well… totally unsupported, that only does 16 colors so it’s a mess

  4. Looks great in gvim, but when I run vim in a terminal, it kills almost all the colors in ruby and java files.

    As gVim: http://i.imgur.com/jChTM.png
    In terminal: http://i.imgur.com/0QUrM.png
    In terminal, without molokai: http://i.imgur.com/uxLcX.png

    Perl filetypes seem to do alright even in terminal, haven’t checked any others.

    Any ideas why this is?

    Or, could you suggest to a non-vim wizard what conditional I can use to say “use molokai if it’s gvim, on a terminal don’t” in my .vimrc?

  5. It’s so great! It must to be the best I have seen!
    Well, I just find one place to improve. The normal background of your scheme is a bit different from the default of the VIM.It’s not so easy to distinguish.

  6. How would one go about making this theme have a transparent background? Thanks for the beautiful theme by the way.

  7. Never mind I figured it out. For anyone curious: To get terminal VIM to use your transparent background with this theme, change line 204′s ctermbg from 234 to none. Do the same for line 208 if you don’t want the line numbers to have a background.

  8. I love this colorscheme for most languages, except in perl, a majority of the text on the screen is colored orange, which is too disorienting.

  9. Thanks for sharing, I love the scheme. Your vimrc was also helpful – even for a long Vim user there’s always new stuff to learn. Thank you! :-)

  10. Thank you so much for taking the time and sharing your port! I was getting syntax highlighting envy from a coworker and he pointed me at you.

    Very nice work!

  11. It seems as if you’ve deleted the molokai from your repository. Any chance to upload it again?

  12. How can i apply after install gvim?
    I’m newbie…. please let me know how to install the plugins..(?)..
    Regards,

  13. I love Monokai! Unfortunately, I can’t find a Vim Monokai theme that works in Command Prompt. I’ve tried four different Monokai-likes, and I’ve tried adding “set t_Co=256″, to no avail. :(

  14. Finally I found a Monokai like theme, thanks for making it available. However, I am having troubles adding it to the my ~/.vimrc.

    I have tried the following and different version of the conf. below:
    set t_C0=256
    let g:molokai_original = 1

    which is the correct way of doing it?

  15. Please ignore my post… my mistake, i has a “set background=dark” in the .vimrc file :P

    Thanks for the scheme ;)

  16. Thanks for sharing the theme. Only a couple of points for improvement:

    1. Support for background=light: Otherwise, under light conditions, my computer’s screen looks more like a mirror instead of a computer’s screen. Specially on MacBooks.

    2. Support for Vim (not only MacVim or gVim).

    Thanks again :)

  17. Hi,
    I think that this color theme is really very nice. In my opinion it’s the best available. I would like also to say something about differences between LaTeX code in gVim 7.3 and in gVim 7.4. I have observed that in gVim 7.3 “lstlisting” and “verbatim” are both rendered in “green”. In gVim 7.4 “lstlisting” is “white” as a normal text and “verbatim” is “green” as in the previous version.

    Regards.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>