Use this page to discuss script 1457 CycleColor: cycle through available colorschemes

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on
  • This page may be out of date: check the script's page above, and its release notes.

Fix for WindowsEdit

The CycleColor.vim script didn't work for me on Windows until I made the following change to escape those pesky backslashes before using the name in the regex:

--- a/plugin/cyclecolor.vim
+++ b/plugin/cyclecolor.vim
@@ -74,17 +74,18 @@ function! s:CycleColor(direction)

+       let escaped = substitute(s:currentfile, '\\', '\\\\', 'g')
        if a:direction >= 0
                " Find the current file name, and select the next one.
                " No substitution will take place if the current file is not
                "   found or is the last in the list.
-               let nextfile = substitute(s:schemes, '.*\n'.s:currentfile.'\n\([^\x0A]\+\)\n.*', '\1', '')
+               let nextfile = substitute(s:schemes, '.*\n'.escaped.'\n\([^\x0A]\+\)\n.*', '\1', '')
                " If the above worked, there will be no control chars in
                "   nextfile, so this will not substitute; otherwise, this will
                "   choose the first file in the list.
                let nextfile = substitute(nextfile, '\n\+\([^\x0A]\+\)\n.*', '\1', '')
-               let nextfile = substitute(s:schemes, '.*\n\([^\x0A]\+\)\n'.s:currentfile.'\n.*', '\1', '')
+               let nextfile = substitute(s:schemes, '.*\n\([^\x0A]\+\)\n'.escaped.'\n.*', '\1', '')
                let nextfile = substitute(nextfile, '.*\n\([^\x0A]\+\)\n\+', '\1', '')

-- April 1, 2015


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.