Permalink
Browse files

- Updated vital.

  • Loading branch information...
1 parent 619a161 commit 8f659c76abc4b5a153213f1f6d42f4e07674921c @Shougo committed Apr 23, 2012
View
@@ -4,9 +4,9 @@ function! vital#of(name)
if empty(file)
throw 'vital: version file not found: ' . a:name
endif
- let ver = readfile(file[0])
+ let ver = readfile(file[0], 'b')
if empty(ver)
throw 'vital: invalid version file: ' . a:name
endif
- return vital#_{ver[0]}#new()
+ return vital#_{substitute(ver[0], '\W', '', 'g')}#new()
endfunction
@@ -93,7 +93,7 @@ endfunction
if filereadable(expand('<sfile>:r') . '.VIM')
function! s:_unify_path(path)
- return tolower(resolve(fnamemodify(a:path, ':p:gs?[\\/]\+?/?')))
+ return tolower(resolve(fnamemodify(a:path, ':p:8:gs?[\\/]\+?/?')))
endfunction
else
function! s:_unify_path(path)
@@ -68,6 +68,25 @@ function! s:sort_by(list, expr)
\ 'a:a[1] ==# a:b[1] ? 0 : a:a[1] ># a:b[1] ? 1 : -1'), 'v:val[0]')
endfunction
+" Returns a maximum value in {list} through given {expr}.
+" Returns 0 if {list} is empty.
+" v:val is used in {expr}
+function! s:max(list, expr)
+ if empty(a:list)
+ return 0
+ endif
+ let list = map(copy(a:list), a:expr)
+ return a:list[index(list, max(list))]
+endfunction
+
+" Returns a minimum value in {list} through given {expr}.
+" Returns 0 if {list} is empty.
+" v:val is used in {expr}
+" FIXME: -0x80000000 == 0x80000000
+function! s:min(list, expr)
+ return s:max(a:list, '-(' . a:expr . ')')
+endfunction
+
" Returns List of character sequence between [a:from, a:to]
" e.g.: s:char_range('a', 'c') returns ['a', 'b', 'c']
function! s:char_range(from, to)
@@ -5,7 +5,8 @@ set cpo&vim
let s:is_windows = has('win16') || has('win32') || has('win64')
let s:is_cygwin = has('win32unix')
-let s:is_mac = !s:is_windows && (has('mac') || has('macunix') || has('gui_macvim') || system('uname') =~? '^darwin')
+let s:is_mac = !s:is_windows && (has('mac') || has('macunix')
+ \ || has('gui_macvim') || system('uname') =~? '^darwin')
" Open a file.
function! s:open(filename) "{{{
@@ -18,22 +19,28 @@ function! s:open(filename) "{{{
silent execute '!start rundll32 url.dll,FileProtocolHandler' filename
elseif s:is_cygwin
" Cygwin.
- call system(printf('%s ''%s''', 'cygstart', filename))
+ call system(printf('%s %s', 'cygstart',
+ \ shellescape(filename)))
elseif executable('xdg-open')
" Linux.
- call system(printf('%s ''%s'' &', 'xdg-open', filename))
+ call system(printf('%s %s &', 'xdg-open',
+ \ shellescape(filename)))
elseif exists('$KDE_FULL_SESSION') && $KDE_FULL_SESSION ==# 'true'
" KDE.
- call system(printf('%s ''%s'' &', 'kioclien exec', filename))
+ call system(printf('%s %s &', 'kioclien exec',
+ \ shellescape(filename)))
elseif exists('$GNOME_DESKTOP_SESSION_ID')
" GNOME.
- call system(printf('%s ''%s'' &', 'gnome-open', filename))
+ call system(printf('%s %s &', 'gnome-open',
+ \ shellescape(filename)))
elseif executable('exo-open')
" Xfce.
- call system(printf('%s ''%s'' &', 'exo-open', filename))
+ call system(printf('%s %s &', 'exo-open',
+ \ shellescape(filename)))
elseif s:is_mac && executable('open')
" Mac OS.
- call system(printf('%s ''%s'' &', 'open', filename))
+ call system(printf('%s %s &', 'open',
+ \ shellescape(filename)))
else
" Give up.
throw 'Not supported.'
@@ -1,2 +1,2 @@
-3bb4cee
+f6bcb24
View
@@ -1283,6 +1283,9 @@ ability of vimshell will spread by creating plugin by yourself.
==============================================================================
CHANGELOG *vimshell-changelog*
+2012-04-24
+- Updated vital.
+
2012-04-22
- Fixed for colorscheme.

0 comments on commit 8f659c7

Please sign in to comment.