Skip to content

Escape single backslashes for Windows & periods for kicks #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugin/cyclecolor.vim
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ function! s:CycleColor(direction)
" 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'.escape(s:currentfile, '\.').'\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', '')
else
let nextfile = substitute(s:schemes, '.*\n\([^\x0A]\+\)\n'.s:currentfile.'\n.*', '\1', '')
let nextfile = substitute(s:schemes, '.*\n\([^\x0A]\+\)\n'.escape(s:currentfile, '\.').'\n.*', '\1', '')
let nextfile = substitute(nextfile, '.*\n\([^\x0A]\+\)\n\+', '\1', '')
endif

Expand Down