Skip to content
This repository has been archived by the owner on Jun 20, 2021. It is now read-only.

Commit

Permalink
Cygwin changes by Helmut Stiegler.
Browse files Browse the repository at this point in the history
  • Loading branch information
lpenz committed Jul 14, 2013
1 parent 6d95561 commit 143635f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions vimcommander.vim
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
" Zoltan Dezso <dezso.zoltan@gmail.co>, windows fix for parent
" directory traversal, add total commander-like C-PageUp
" Denis <woofterrier@gmail.com>, for windows fixes.
" Helmut Stiegler <helmut@stiegler.biz>, for cygwin fixes.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Section: Documentation
Expand Down Expand Up @@ -117,6 +118,10 @@ fu! <SID>CommanderMappings()
noremap <silent> <buffer> <C-PageDown> :cal <SID>OnDoubleClick()<CR>
endf

fu! <SID>ShallUseUnixCmds()
return has("unix") || exists('+shellslash') && &shellslash
endf

fu! <SID>MsDos(filename)
return substitute(shellescape(a:filename),'/','\\','g')
endf
Expand All @@ -134,7 +139,7 @@ fu! VimCommanderToggle()
endf

fu!<SID>First()
if has("unix")
if <SID>ShallUseUnixCmds()
let s:slash_char = "/"
else
let s:slash_char = "\\"
Expand Down Expand Up @@ -374,7 +379,7 @@ fu! <SID>FileView()
let opt=""
while strlen(name)>0
if filereadable(filename)
if has("unix")
if <SID>ShallUseUnixCmds()
cal system("(see ".shellescape(filename).") &")
else
exec "silent ! start \"\" \"".substitute(filename, "/", "\\", "g")."\""
Expand Down Expand Up @@ -608,7 +613,7 @@ fu! <SID>FileCopy(samedir)

if (do_copy)
" copy file
if has("unix")
if <SID>ShallUseUnixCmds()
cal system("cp -Rf ".shellescape(filename)." ".shellescape(newfilename))
else
cal system("copy ".<SID>MsDos(filename)." ".<SID>MsDos(newfilename))
Expand Down Expand Up @@ -686,7 +691,7 @@ fu! <SID>FileMove(rename)

if (do_move)
" move file
if has("unix")
if <SID>ShallUseUnixCmds()
cal system('mv '.shellescape(filename).' '.shellescape(newfilename))
else
cal system('move '.<SID>MsDos(filename).' '.<SID>MsDos(newfilename))
Expand Down Expand Up @@ -727,7 +732,7 @@ fu! <SID>FileDelete()
end
end
if opt=~"^[yYAa]$"
if has("unix")
if <SID>ShallUseUnixCmds()
cal system("rm -rf ".shellescape(filename))
else
if isdirectory(filename)
Expand Down Expand Up @@ -1038,7 +1043,7 @@ fu! <SID>FileSee()
endf

fu! <SID>BuildParentTree()
if has("unix")
if <SID>ShallUseUnixCmds()
norm! gg$F/
else
norm! gg$F\
Expand Down Expand Up @@ -1104,7 +1109,7 @@ fu! <SID>OnDoubleClick()
" we're on line 1 here! getting new base path now...
" advance to next slash
if getline(1)[xpos]!=s:slash_char
if has("unix")
if <SID>ShallUseUnixCmds()
norm! f/
else
norm! f\
Expand All @@ -1128,7 +1133,7 @@ fu! <SID>ChangeDir()
if l:path == ""
let l:path = l:oldpath
endif
if !has("unix")
if !<SID>ShallUseUnixCmds()
let l:path = substitute(l:path,'\\','/','g')
endif
cal <SID>BuildTree(l:path)
Expand Down

0 comments on commit 143635f

Please sign in to comment.