Skip to content

Commit f5b2eea

Browse files
committed
Make xolox#misc#os#find_vim() configurable
xolox/vim-easytags#54 shows that it can be useful to override the default logic of xolox#misc#os#find_vim(), even if it is to work around other problems: xolox/vim-easytags#54
1 parent b6d0aa5 commit f5b2eea

File tree

4 files changed

+221
-194
lines changed

4 files changed

+221
-194
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ that I haven't published yet.
3939
<!-- Start of generated documentation -->
4040

4141
The documentation of the 42 functions below was extracted from
42-
11 Vim scripts on May 24, 2013 at 00:14.
42+
12 Vim scripts on June 1, 2013 at 14:57.
4343

4444
### Handling of special buffers
4545

@@ -259,7 +259,9 @@ Returns 1 (true) when on Microsoft Windows, 0 (false) otherwise.
259259
Returns the program name of Vim as a string. On Windows and UNIX this
260260
simply returns [v:progname] [progname] while on Mac OS X there is some
261261
special magic to find MacVim's executable even though it's usually not on
262-
the executable search path.
262+
the executable search path. If you want, you can override the value
263+
returned from this function by setting the global variable
264+
`g:xolox#misc#os#vim_progname`.
263265

264266
[progname]: http://vimdoc.sourceforge.net/htmldoc/eval.html#v:progname
265267

autoload/xolox/misc.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" The version of my miscellaneous scripts.
22
"
33
" Author: Peter Odding <[email protected]>
4-
" Last Change: May 25, 2013
4+
" Last Change: June 1, 2013
55
" URL: http://peterodding.com/code/vim/misc/
66

7-
let g:xolox#misc#version = '1.0'
7+
let g:xolox#misc#version = '1.1'

autoload/xolox/misc/os.vim

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Operating system interfaces.
22
"
33
" Author: Peter Odding <[email protected]>
4-
" Last Change: May 25, 2013
4+
" Last Change: June 1, 2013
55
" URL: http://peterodding.com/code/vim/misc/
66

77
function! xolox#misc#os#is_win() " {{{1
@@ -13,11 +13,16 @@ function! xolox#misc#os#find_vim() " {{{1
1313
" Returns the program name of Vim as a string. On Windows and UNIX this
1414
" simply returns [v:progname] [progname] while on Mac OS X there is some
1515
" special magic to find MacVim's executable even though it's usually not on
16-
" the executable search path.
16+
" the executable search path. If you want, you can override the value
17+
" returned from this function by setting the global variable
18+
" `g:xolox#misc#os#vim_progname`.
1719
"
1820
" [progname]: http://vimdoc.sourceforge.net/htmldoc/eval.html#v:progname
1921
let progname = ''
20-
if has('macunix')
22+
if exists('g:xolox#misc#os#vim_progname')
23+
let progname = g:xolox#misc#os#vim_progname
24+
endif
25+
if empty(progname) && has('macunix')
2126
" Special handling for Mac OS X where MacVim is usually not on the $PATH.
2227
call xolox#misc#msg#debug("vim-misc %s: Trying MacVim workaround to find Vim executable ..", g:xolox#misc#version)
2328
let segments = xolox#misc#path#split($VIMRUNTIME)
@@ -27,6 +32,7 @@ function! xolox#misc#os#find_vim() " {{{1
2732
endif
2833
endif
2934
if empty(progname)
35+
" Default logic.
3036
call xolox#misc#msg#debug("vim-misc %s: Looking for Vim executable named %s on search path ..", g:xolox#misc#version, string(v:progname))
3137
let candidates = xolox#misc#path#which(v:progname)
3238
if !empty(candidates)

0 commit comments

Comments
 (0)