Skip to content

Commit

Permalink
System.Filepath: Refactor to use existing s:is_windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ujihisa committed Jun 11, 2018
1 parent d005552 commit 7e54598
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions autoload/vital/__vital__/System/Filepath.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
let s:save_cpo = &cpo
set cpo&vim

if has('win32') || has('win64')
let s:path_sep_pattern = (exists('+shellslash') ? '[\\/]' : '/') . '\+'
let s:is_windows = has('win16') || has('win32') || has('win64') || has('win95')
let s:is_cygwin = has('win32unix')
let s:is_mac = !s:is_windows && !s:is_cygwin
\ && (has('mac') || has('macunix') || has('gui_macvim') ||
\ (!isdirectory('/proc') && executable('sw_vers')))
let s:is_case_tolerant = filereadable(expand('<sfile>:r') . '.VIM')

if s:is_windows
function! s:to_slash(path) abort
return tr(a:path, '\', '/')
endfunction
Expand All @@ -16,7 +24,7 @@ else
endfunction
endif

if has('win32') || has('win64')
if s:is_windows
function! s:from_slash(path) abort
return tr(a:path, '/', '\')
endfunction
Expand All @@ -26,13 +34,6 @@ else
endfunction
endif

let s:path_sep_pattern = (exists('+shellslash') ? '[\\/]' : '/') . '\+'
let s:is_windows = has('win16') || has('win32') || has('win64') || has('win95')
let s:is_cygwin = has('win32unix')
let s:is_mac = !s:is_windows && !s:is_cygwin
\ && (has('mac') || has('macunix') || has('gui_macvim') ||
\ (!isdirectory('/proc') && executable('sw_vers')))
let s:is_case_tolerant = filereadable(expand('<sfile>:r') . '.VIM')

" Get the directory separator.
function! s:separator() abort
Expand Down

0 comments on commit 7e54598

Please sign in to comment.