Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 942f58a

Browse files
committed
Updated miscellaneous scripts
2 parents dab5a33 + 8b60a41 commit 942f58a

File tree

5 files changed

+46
-16
lines changed

5 files changed

+46
-16
lines changed

‎autoload/xolox/luainspect.vim‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
" Last Change: May 20, 2013
44
" URL: http://peterodding.com/code/vim/lua-inspect/
55

6-
let g:xolox#luainspect#version = '0.4.23'
6+
let g:xolox#luainspect#version = '0.4.24'
77

8-
call xolox#misc#compat#check('luainspect.vim', g:xolox#luainspect#version, 7)
8+
call xolox#misc#compat#check('luainspect.vim', g:xolox#luainspect#version, 9)
99

1010
function! xolox#luainspect#toggle_cmd() " {{{1
1111
if !(exists('b:luainspect_disabled') && b:luainspect_disabled)

‎autoload/xolox/misc/compat.vim‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
" scripts breaks backwards compatibility. This enables my Vim plug-ins to fail
1313
" early when they detect an incompatible version, instead of breaking at the
1414
" worst possible moments :-).
15-
let g:xolox#misc#compat#version = 7
15+
let g:xolox#misc#compat#version = 9
1616

1717
" Remember the directory where the miscellaneous scripts are loaded from
1818
" so the user knows which plug-in to update if incompatibilities arise.

‎autoload/xolox/misc/msg.vim‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Functions to interact with the user.
22
"
33
" Author: Peter Odding <peter@peterodding.com>
4-
" Last Change: May 19, 2013
4+
" Last Change: May 20, 2013
55
" URL: http://peterodding.com/code/vim/misc/
66

77
if !exists('g:xolox_message_buffer')
@@ -32,8 +32,6 @@ function! xolox#misc#msg#debug(...) " {{{1
3232
" increased verbosity by setting Vim's ['verbose'] [verbose] option to one
3333
" (1) or higher. This function has the same argument handling as Vim's
3434
" [printf()] [printf] function.
35-
"
36-
" [verbose]: http://vimdoc.sourceforge.net/htmldoc/options.html#'verbose'
3735
if &vbs >= 1
3836
call s:show_message('question', a:000)
3937
endif

‎autoload/xolox/misc/os.vim‎

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,45 @@
11
" Operating system interfaces.
22
"
33
" Author: Peter Odding <peter@peterodding.com>
4-
" Last Change: May 19, 2013
4+
" Last Change: May 20, 2013
55
" URL: http://peterodding.com/code/vim/misc/
66

7-
let g:xolox#misc#os#version = '0.3'
7+
let g:xolox#misc#os#version = '0.4'
88

99
function! xolox#misc#os#is_win() " {{{1
1010
" Returns 1 (true) when on Microsoft Windows, 0 (false) otherwise.
1111
return has('win16') || has('win32') || has('win64')
1212
endfunction
1313

14+
function! xolox#misc#os#find_vim() " {{{1
15+
" Returns the program name of Vim as a string. On Windows and UNIX this
16+
" simply returns [v:progname] [progname] while on Mac OS X there is some
17+
" special magic to find MacVim's executable even though it's usually not on
18+
" the executable search path.
19+
"
20+
" [progname]: http://vimdoc.sourceforge.net/htmldoc/eval.html#v:progname
21+
let progname = ''
22+
if has('macunix')
23+
" Special handling for Mac OS X where MacVim is usually not on the $PATH.
24+
call xolox#misc#msg#debug("os.vim %s: Trying MacVim workaround to find Vim executable ..", g:xolox#misc#os#version)
25+
let segments = xolox#misc#path#split($VIMRUNTIME)
26+
if segments[-3:] == ['Resources', 'vim', 'runtime']
27+
let progname = xolox#misc#path#join(segments[0:-4] + ['MacOS', 'Vim'])
28+
call xolox#misc#msg#debug("os.vim %s: The MacVim workaround resulted in the Vim executable %s.", g:xolox#misc#os#version, string(progname))
29+
endif
30+
endif
31+
if empty(progname)
32+
call xolox#misc#msg#debug("os.vim %s: Looking for Vim executable named %s on search path ..", g:xolox#misc#os#version, string(v:progname))
33+
let candidates = xolox#misc#path#which(v:progname)
34+
if !empty(candidates)
35+
call xolox#misc#msg#debug("os.vim %s: Found %i candidate(s) on search path: %s.", g:xolox#misc#os#version, len(candidates), string(candidates))
36+
let progname = candidates[0]
37+
endif
38+
endif
39+
call xolox#misc#msg#debug("os.vim %s: Reporting Vim executable %s.", g:xolox#misc#os#version, string(progname))
40+
return progname
41+
endfunction
42+
1443
function! xolox#misc#os#exec(options) " {{{1
1544
" Execute an external command (hiding the console on Microsoft Windows when
1645
" my [vim-shell plug-in] [vim-shell] is installed).
@@ -63,9 +92,7 @@ function! xolox#misc#os#exec(options) " {{{1
6392
if !async
6493
let tempout = tempname()
6594
let temperr = tempname()
66-
let cmd = printf('(%s) 1>%s 2>%s', cmd,
67-
\ xolox#misc#escape#shell(tempout),
68-
\ xolox#misc#escape#shell(temperr))
95+
let cmd = printf('(%s) 1>%s 2>%s', cmd, xolox#misc#escape#shell(tempout), xolox#misc#escape#shell(temperr))
6996
endif
7097

7198
" If A) we're on Windows, B) the vim-shell plug-in is installed and C) the

‎autoload/xolox/misc/timer.vim‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Timing of long during operations.
22
"
33
" Author: Peter Odding <peter@peterodding.com>
4-
" Last Change: May 19, 2013
4+
" Last Change: May 20, 2013
55
" URL: http://peterodding.com/code/vim/misc/
66

77
if !exists('g:timer_enabled')
@@ -17,10 +17,7 @@ let s:has_reltime = has('reltime')
1717
function! xolox#misc#timer#start() " {{{1
1818
" Start a timer. This returns a list which can later be passed to
1919
" `xolox#misc#timer#stop()`.
20-
if g:timer_enabled || &verbose >= g:timer_verbosity
21-
return s:has_reltime ? reltime() : [localtime()]
22-
endif
23-
return []
20+
return s:has_reltime ? reltime() : [localtime()]
2421
endfunction
2522

2623
function! xolox#misc#timer#stop(...) " {{{1
@@ -40,6 +37,14 @@ function! xolox#misc#timer#stop(...) " {{{1
4037
endif
4138
endfunction
4239

40+
function! xolox#misc#timer#force(...) " {{{1
41+
" Show a formatted message to the user. This function has the same argument
42+
" handling as Vim's [printf()] [printf] function with one difference: At the
43+
" point where you want the elapsed time to be embedded, you write `%s` and
44+
" you pass the list returned by `xolox#misc#timer#start()` as an argument.
45+
call call('xolox#misc#msg#info', map(copy(a:000), 's:convert_value(v:val)'))
46+
endfunction
47+
4348
function! s:convert_value(value) " {{{1
4449
if type(a:value) != type([])
4550
return a:value

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /