Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

xolox#misc#open#file(): Improve documentation & variable names

  • Loading branch information...
commit 3d519834e1e0af6733b967c992998f4af057f214 1 parent cf92d5a
@xolox authored
Showing with 20 additions and 20 deletions.
  1. +5 −5 README.md
  2. +10 −10 autoload/xolox/misc/open.vim
  3. +5 −5 doc/misc.txt
View
10 README.md
@@ -38,7 +38,7 @@ from the source code of the miscellaneous scripts using the Python module
<!-- Start of generated documentation -->
The documentation of the 67 functions below was extracted from
-15 Vim scripts on June 19, 2013 at 20:20.
+15 Vim scripts on June 19, 2013 at 20:59.
### Handling of special buffers
@@ -201,10 +201,10 @@ only converted to strings when the user has enabled increased verbosity.
#### The `xolox#misc#open#file()` function
-Given a pathname as the first argument, this opens the file with the
-program associated with the file type. So for example a text file might
-open in Vim, an `*.html` file would probably open in your web browser and
-a media file would open in a media player.
+Given a pathname or URL as the first argument, this opens the file with
+the program associated with the file type. So for example a text file
+might open in Vim, an `*.html` file would probably open in your web
+browser and a media file would open in a media player.
This should work on Windows, Mac OS X and most Linux distributions. If
this fails to find a file association, you can pass one or more external
View
20 autoload/xolox/misc/open.vim
@@ -7,11 +7,11 @@
let s:enoimpl = "vim-misc %s: %s() hasn't been implemented for your platform! If you have suggestions, please get in touch at https://github.com/xolox/vim-misc/issues"
let s:handlers = ['gnome-open', 'kde-open', 'exo-open', 'xdg-open']
-function! xolox#misc#open#file(path, ...) " {{{1
- " Given a pathname as the first argument, this opens the file with the
- " program associated with the file type. So for example a text file might
- " open in Vim, an `*.html` file would probably open in your web browser and
- " a media file would open in a media player.
+function! xolox#misc#open#file(location, ...) " {{{1
+ " Given a pathname or URL as the first argument, this opens the file with
+ " the program associated with the file type. So for example a text file
+ " might open in Vim, an `*.html` file would probably open in your web
+ " browser and a media file would open in a media player.
"
" This should work on Windows, Mac OS X and most Linux distributions. If
" this fails to find a file association, you can pass one or more external
@@ -23,21 +23,21 @@ function! xolox#misc#open#file(path, ...) " {{{1
" then.
if xolox#misc#os#is_win()
try
- call xolox#shell#open_with_windows_shell(a:path)
+ call xolox#shell#open_with_windows_shell(a:location)
catch /^Vim\%((\a\+)\)\=:E117/
let command = '!start CMD /C START "" %s'
- silent execute printf(command, xolox#misc#escape#shell(a:path))
+ silent execute printf(command, xolox#misc#escape#shell(a:location))
endtry
return
elseif has('macunix')
- let cmd = 'open ' . shellescape(a:path) . ' 2>&1'
+ let cmd = 'open ' . shellescape(a:location) . ' 2>&1'
call s:handle_error(cmd, system(cmd))
return
else
for handler in s:handlers + a:000
if executable(handler)
- call xolox#misc#msg#debug("vim-misc %s: Using '%s' to open '%s'.", g:xolox#misc#version, handler, a:path)
- let cmd = shellescape(handler) . ' ' . shellescape(a:path) . ' 2>&1'
+ call xolox#misc#msg#debug("vim-misc %s: Using '%s' to open '%s'.", g:xolox#misc#version, handler, a:location)
+ let cmd = shellescape(handler) . ' ' . shellescape(a:location) . ' 2>&1'
call s:handle_error(cmd, system(cmd))
return
endif
View
10 doc/misc.txt
@@ -137,7 +137,7 @@ from the source code of the miscellaneous scripts using the Python module
'vimdoctool.py' included in vim-tools [5].
The documentation of the 67 functions below was extracted from 15 Vim scripts
-on June 19, 2013 at 20:20.
+on June 19, 2013 at 20:59.
-------------------------------------------------------------------------------
*misc-handling-of-special-buffers*
@@ -307,10 +307,10 @@ Integration between Vim and its environment ~
-------------------------------------------------------------------------------
The *xolox#misc#open#file()* function
-Given a pathname as the first argument, this opens the file with the program
-associated with the file type. So for example a text file might open in Vim, an
-'*.html' file would probably open in your web browser and a media file would
-open in a media player.
+Given a pathname or URL as the first argument, this opens the file with the
+program associated with the file type. So for example a text file might open in
+Vim, an '*.html' file would probably open in your web browser and a media file
+would open in a media player.
This should work on Windows, Mac OS X and most Linux distributions. If this
fails to find a file association, you can pass one or more external commands to
Please sign in to comment.
Something went wrong with that request. Please try again.