Skip to content

Commit

Permalink
Make xolox#misc#os#find_vim() configurable
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xolox committed Jun 1, 2013
1 parent b6d0aa5 commit f5b2eea
Show file tree
Hide file tree
Showing 4 changed files with 221 additions and 194 deletions.
6 changes: 4 additions & 2 deletions README.md
Expand Up @@ -39,7 +39,7 @@ that I haven't published yet.
<!-- Start of generated documentation -->

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

### Handling of special buffers

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

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

Expand Down
4 changes: 2 additions & 2 deletions autoload/xolox/misc.vim
@@ -1,7 +1,7 @@
" The version of my miscellaneous scripts.
"
" Author: Peter Odding <peter@peterodding.com>
" Last Change: May 25, 2013
" Last Change: June 1, 2013
" URL: http://peterodding.com/code/vim/misc/

let g:xolox#misc#version = '1.0'
let g:xolox#misc#version = '1.1'
12 changes: 9 additions & 3 deletions autoload/xolox/misc/os.vim
@@ -1,7 +1,7 @@
" Operating system interfaces.
"
" Author: Peter Odding <peter@peterodding.com>
" Last Change: May 25, 2013
" Last Change: June 1, 2013
" URL: http://peterodding.com/code/vim/misc/

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

0 comments on commit f5b2eea

Please sign in to comment.