Permalink
Browse files

Don't use backticks

Closes #6.  I don't really understand why this would supposedly break on
Windows, but backticks have other issues (such as with 'wildignore') so
we'll ditch them anyways.
  • Loading branch information...
1 parent 241785f commit 209c15ec0c83fe32b46488895484093a36fe4c16 @tpope committed Dec 31, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 plugin/unimpaired.vim
View
@@ -72,8 +72,16 @@ function! s:FileByOffset(num)
return file
endfunction
-nnoremap <silent> <Plug>unimpairedONext :<C-U>edit `=<SID>FileByOffset(v:count1)`<CR>
-nnoremap <silent> <Plug>unimpairedOPrevious :<C-U>edit `=<SID>FileByOffset(-v:count1)`<CR>
+function! s:fnameescape(file) abort
+ if exists('*fnameescape')
+ return fnameescape(a:file)
+ else
+ return escape(a:file," \t\n*?[{`$\\%#'\"|!<")
+ endif
+endfunction
+
+nnoremap <silent> <Plug>unimpairedONext :<C-U>edit <C-R>=<SID>fnameescape(<SID>FileByOffset(v:count1))<CR><CR>
+nnoremap <silent> <Plug>unimpairedOPrevious :<C-U>edit <C-R>=<SID>fnameescape(<SID>FileByOffset(-v:count1))<CR><CR>
nmap ]o <Plug>unimpairedONext
nmap [o <Plug>unimpairedOPrevious

0 comments on commit 209c15e

Please sign in to comment.