Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support for Windows x64, improved error handling

Thanks to Stan Angeloff for getting me to build an x64 DLL
and helping me test the DLL and automatic bitness detection.
  • Loading branch information...
commit 669a9f2d5cce67b34599dc820abb471b2faeee2b 1 parent 281d77e
@xolox authored
Showing with 30 additions and 25 deletions.
  1. +4 −4 README.md
  2. +20 −15 autoload.vim
  3. +4 −4 dll/Makefile
  4. +2 −2 shell.vim
View
8 README.md
@@ -8,11 +8,11 @@ This plug-in aims to improve the integration between [Vim][vim] and its environm
* The `xolox#shell#execute()` function enables other Vim plug-ins (like my [easytags.vim] [easytags] plug-in) to execute external commands in the background (i.e. asynchronously) *without opening a command prompt window on Windows*.
-A [Windows DLL][dll] is included to perform these functions on Windows, while on UNIX external commands are used.
+Two [Windows DLL files][dll] are included to perform these functions on Windows, while on UNIX external commands are used.
## Usage
-The below paragraphs document the functionality in the `shell.vim` plug-in. I'd be very grateful if people would test the plug-in in different environments and report their results by contacting the [vim-dev](http://vimdoc.sourceforge.net/htmldoc/intro.html#vim-dev) mailing-list or e-mailing me directly at <peter@peterodding.com>. You can test the DLL by unpacking the [ZIP archive from www.vim.org][download] in the `%USERPROFILE%\vimfiles` directory (on Windows) or the `~/.vim/` directory (on UNIX), restarting Vim and testing the three functions described above and documented below.
+The below paragraphs document the functionality in the `shell.vim` plug-in. I'd be very grateful if people would test the plug-in in different environments and report their results by contacting the [vim-dev](http://vimdoc.sourceforge.net/htmldoc/intro.html#vim-dev) mailing-list or e-mailing me directly at <peter@peterodding.com>. You can test the plug-in by unpacking the [ZIP archive from www.vim.org][download] in the `%USERPROFILE%\vimfiles` directory (on Windows) or the `~/.vim/` directory (on UNIX), restarting Vim and checking whether the commands below work as documented.
### The `:Fullscreen` command
@@ -77,7 +77,7 @@ Vim has a limited ability to call external libraries using the Vim script functi
Since then I switched to Linux and didn't look back, which meant the DLL sat in my `~/.vim/etc/` waiting to be revived. Now that I've published my [easytags.vim][easytags] plug-in and put a lot of effort into making it Windows compatible, the `execute()` function from the DLL would be very useful to run [Exuberant Ctags][ctags] in the background without stealing Vim's focus by opening a command prompt window. This is why I've decided to release the DLL. Because I switched to Linux I've also added an autoload script that wraps the DLL on Windows and calls out to external programs such as `wmctrl`, `gnome-open`, `kde-open`, and others on UNIX.
-Before I go ahead and bundle the DLL with my [easytags.vim][easytags] plug-in I need to make sure that the DLL is compatible with as many Windows Vim installations out there as possible, e.g. XP/Vista/7, different service packs, 32/64 bits, etc. and I don't know where to start! I've uploaded a [ZIP archive including a compiled DLL][download] to the [Vim scripts page][vim_scripts_entry] for this plug-in (build using the latest Windows SDK but targeting Windows XP x86 DEBUG, should also work on Vista/7) and the source code is available in the [GitHub repository](http://github.com/xolox/vim-shell) (see the `NMAKE` [makefile](http://github.com/xolox/vim-shell/blob/master/dll/Makefile) for compile instructions).
+Before I go ahead and bundle the DLL files with my [easytags.vim][easytags] plug-in I need to make sure they're compatible with as many Windows Vim installations out there as possible, e.g. XP/Vista/7, different service packs, 32/64 bits, etc. I've uploaded a [ZIP archive including two compiled DLL files][download] to the [Vim scripts page][vim_scripts_entry] for this plug-in (build using the latest Windows SDK but targeting Windows XP x86/x64 DEBUG, should also work on Vista/7) and the source code is available in the [GitHub repository](http://github.com/xolox/vim-shell) (see the `NMAKE` [makefile](http://github.com/xolox/vim-shell/blob/master/dll/Makefile) for compile instructions).
## Other full-screen implementations
@@ -85,7 +85,7 @@ After publishing this plug-in I found that the Vim plug-ins [VimTweak](http://ww
## Contact
-If you have questions, bug reports, suggestions, etc. the author can be contacted at <peter@peterodding.com>. The latest version is available at <http://peterodding.com/code/vim/shell/> and <http://github.com/xolox/vim-shell>. If you like the plug-in please vote for it on [www.vim.org] [vim_scripts_entry].
+If you have questions, bug reports, suggestions, etc. the author can be contacted at <peter@peterodding.com>. The latest version is available at <http://peterodding.com/code/vim/shell/> and <http://github.com/xolox/vim-shell>. If you like the plug-in please vote for it on [Vim Online] [vim_scripts_entry].
## License
View
35 autoload.vim
@@ -1,6 +1,6 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: September 19, 2010
+" Last Change: December 4, 2010
" URL: http://peterodding.com/code/vim/shell/
if !exists('s:script')
@@ -11,21 +11,25 @@ if !exists('s:script')
endif
function! xolox#shell#open_cmd(arg) " -- implementation of the :Open command {{{1
- if a:arg !~ '\S'
- if !s:open_at_cursor()
- call xolox#open#file(expand('%:p:h'))
- endif
- elseif a:arg =~ g:shell_patt_url || a:arg =~ g:shell_patt_mail
- call xolox#open#url(a:arg)
- else
- let arg = fnamemodify(a:arg, ':p')
- if isdirectory(arg) || filereadable(arg)
- call xolox#open#file(arg)
+ try
+ if a:arg !~ '\S'
+ if !s:open_at_cursor()
+ call xolox#open#file(expand('%:p:h'))
+ endif
+ elseif a:arg =~ g:shell_patt_url || a:arg =~ g:shell_patt_mail
+ call xolox#open#url(a:arg)
else
- let msg = "%s: I don't know how to open %s!"
- echoerr printf(msg, s:script, string(a:arg))
+ let arg = fnamemodify(a:arg, ':p')
+ if isdirectory(arg) || filereadable(arg)
+ call xolox#open#file(arg)
+ else
+ let msg = "%s: I don't know how to open %s!"
+ echoerr printf(msg, s:script, string(a:arg))
+ endif
endif
- endif
+ catch
+ call xolox#warning("%s at %s", v:exception, v:throwpoint)
+ endtry
endfunction
function! s:open_at_cursor()
@@ -201,7 +205,8 @@ endfunction
if xolox#is_windows()
- let s:library = expand('<sfile>:p:h') . '\shell.dll'
+ let s:cpu_arch = has('win64') ? 'x64' : 'x86'
+ let s:library = printf('%s\shell-%s.dll', expand('<sfile>:p:h'), s:cpu_arch)
function! s:library_call(fn, arg) " {{{2
return libcall(s:library, a:fn, a:arg)
View
8 dll/Makefile
@@ -1,7 +1,7 @@
-# This is a makefile for NMAKE from the Windows SDK.
-
-install: shell.dll
- COPY shell.dll "%USERPROFILE%\vimfiles\autoload\xolox\shell.dll"
+# This makefile for NMAKE from the Windows SDK will compile the DLL based on
+# how you configured your Windows SDK build console using SetEnv. Make sure to
+# rename the compiled DLL to shell-x86.dll or shell-x64.dll when you copy it to
+# the %USERPROFILE\vimfiles\autoload\xolox directory.
shell.dll: shell.c
CL /nologo /LD shell.c shell32.lib user32.lib
View
4 shell.vim
@@ -1,9 +1,9 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: September 19, 2010
+" Last Change: December 1, 2010
" URL: http://peterodding.com/code/vim/shell/
" License: MIT
-" Version: 0.8.2
+" Version: 0.9
" Support for automatic update using the GLVS plug-in.
" GetLatestVimScripts: 3123 1 :AutoInstall: shell.zip

0 comments on commit 669a9f2

Please sign in to comment.
Something went wrong with that request. Please try again.