Permalink
Browse files

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
  • Loading branch information...
1 parent b6d0aa5 commit f5b2eea0a627725e6daee5428f8e031804aad848 @xolox committed Jun 1, 2013
Showing with 221 additions and 194 deletions.
  1. +4 −2 README.md
  2. +2 −2 autoload/xolox/misc.vim
  3. +9 −3 autoload/xolox/misc/os.vim
  4. +206 −187 doc/misc.txt
View
@@ -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
@@ -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
View
@@ -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'
View
@@ -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
@@ -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)
@@ -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)
Oops, something went wrong.

0 comments on commit f5b2eea

Please sign in to comment.