Code Monkey home page Code Monkey logo

vim-dispatch's Introduction

dispatch.vim

Leverage the power of Vim's compiler plugins without being bound by synchronicity. Kick off builds and test suites using one of several asynchronous adapters (including tmux, screen, iTerm, Windows, and a headless mode), and when the job completes, errors will be loaded and parsed automatically.

If that doesn't excite you, then perhaps this video will change your mind.

Installation

Install using your favorite package manager, or use Vim's built-in package support:

mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/dispatch.git
vim -u NONE -c "helptags dispatch/doc" -c q

Usage

The core of Vim's compiler system is :make, a command similar to :grep that runs a build tool and parses the resulting errors. The default build tool is of course make, but you can switch it (and the associated error parser) with :compiler. There are lots of built-in compilers, and they do more than just compile things. Plus you can make your own.

We'll start by looking at dispatch.vim's :make wrapper :Make, and then move on to higher abstractions.

Foreground builds

Kick off quick tasks with :Make. What happens next depends on which adapter takes charge.

  • If you're in tmux, a small split will be opened at the bottom.
  • On Windows, a minimized cmd.exe window is spawned.
  • Otherwise, you get a plain old :make invocation.

When the task completes, the window closes, the errors are loaded and parsed, and the quickfix window automatically opens. At no point will your focus be stolen.

Background builds

Use :Make! for longer running tasks, like "run the entire test suite".

  • If you're in tmux or GNU screen, a new window is created in the background.
  • Windows still spawns a minimized cmd.exe window.
  • Otherwise, you get a headless invocation. You can't see it, but it's running in the background.

You won't be interrupted with a quickfix window for a background build. Instead, open it at your leisure with :Copen.

You can also use :Copen on a build that's still running to retrieve and parse any errors that have already happened.

Compiler switching

As hinted earlier, it's easy to switch compilers.

:compiler rubyunit
:make test/models/user_test.rb

Wait, that's still twice as many commands as it needs to be. Plus, it requires you to make the leap from testrb (the executable) to rubyunit (the compiler plugin). The :Dispatch command looks for a compiler for an executable and sets it up automatically.

:Dispatch testrb test/models/user_test.rb

If no compiler plugin is found, :Dispatch simply captures all output.

:Dispatch bundle install

As with :make, you can use % expansions for the current filename.

:Dispatch rspec %

The :Dispatch command switches the compiler back afterwards, so you can pick a primary compiler for :Make, and use :Dispatch for secondary concerns.

Default dispatch

With no arguments, :Dispatch looks for a b:dispatch variable. You can set it interactively, or in an autocommand:

autocmd FileType java let b:dispatch = 'javac %'

If no b:dispatch is found, it falls back to :Make.

:Dispatch makes a great map. By default dispatch.vim provides `<CR> for :Dispatch<CR>. You can find all default maps under :h dispatch-maps.

Focusing

Use :FocusDispatch (or just :Focus) to temporarily, globally override the default dispatch:

:Focus rake spec:models

Now every bare call to :Dispatch will call :Dispatch rake spec:models. You'll be getting a lot of mileage out of that :Dispatch map.

Use :Focus! to reset back to the default.

Spawning interactive processes

Sometimes you just want to kick off a process without any output capturing or error parsing. That's what :Start is for:

:Start lein repl

Unlike :Make, the new window will be in focus, since the idea is that you want to interact with it. Use :Start! to launch it in the background.

Plugin support

Using dispatch.vim from a plugin is a simple matter of checking for and using :Make and :Start if they're available instead of :make and :!. Your favorite plugin already supports it, assuming your favorite plugin is rails.vim.

FAQ

How can I have :Dispatch! or :Make! open the quickfix window on completion?

Use :Dispatch or :Make. The entire point of the ! is to run in the background without interrupting you.

But that blocks Vim.

Then the adapter in use doesn't support foreground builds. Adjust your setup.

Self-Promotion

Like dispatch.vim? Follow the repository on GitHub and vote for it on vim.org. And if you're feeling especially charitable, follow tpope on Twitter and GitHub.

License

Copyright © Tim Pope. Distributed under the same terms as Vim itself. See :help license.

vim-dispatch's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-dispatch's Issues

Specify line for b:dispatch

Is there some way to specify line for b:dispatch?

I would like to do this, but have line('.') evaluated at the execution. Is there any way to do it without having a custom mapping?

autocmd FileType ruby let b:dispatch = 'rspec %:' . line('.')

Only open quickfix window on error

It would be nice if there were an option only to open the quickfix window if the dispatched command returns a non-zero value; otherwise leave it in the background to be opened with :Copen if necessary.

I'm using dispatch to compile C/C++ files, and since I have warnings set to errors I am rarely interested in the output unless there was an error. I could use "Make!", but it is nice to see the progress of the build as it's going on; I'd just like it to disappear at the end if there were no problems.

I can have a go at writing it myself, but I'm not sure what sort of interface you'd want since I notice there are currently no configuration parameters.

Directories with spaces

There is a bug when calling :Dispatch in a directory whose name contains spaces. In s:cgetfile(), the "exe cd dir" line fails, because the cd (or lcd) command believes it receives 2 arguments.

A simple work-around would be to escape the spaces in the "dir" variable.

Dispatch is not working on screen (vagrant)

Hi @tpope ❤️

I'm trying to use the Dispatch and Dispatch! commands inside a screen session on a vagrant machine but seems like it's not working.

The Dispatch command just run the rspec like !, blocking my session until the rspec finishes.

The Dispatch! command says it's running on screen but it don't, I got the message:

:!rspec spec/support/turnip/sign_in_and_sign_out_steps.rb (screen)                                                        69,7          77%

But checking on ps, it's not there.

What information do you need to trace the problem?

I'm using my own vimfiles, Ubuntu Precise 64 and Vi IMproved 7.3 (2010 Aug 15, compiled May 4 2012 04:25:35) running on vagrant.

Support running in window rather than pane

For my workflow where many of my tests run pretty quick, I'd rather have tests run in a separate window rather than a temporary pane beneath my pane. It would be nice if this was configurable.

Compilers with hyphenated makeprg value not detected

Hi,

I've got the following compiler that's not being picked up by dispatch.vim's compiler detection:

" Language: jasmine-node

if exists("current_compiler")
  finish
endif
let current_compiler = "jasmine-node"

if exists(":CompilerSet") != 2      " older Vim always used :setlocal
  command -nargs=* CompilerSet setlocal <args>
endif

let s:cpo_save = &cpo
set cpo-=C

CompilerSet makeprg=jasmine-node

CompilerSet errorformat=
      \%-Z,
      \%Z\ \ \ \ at\ %.%#\ (%f:%l:%c),
      \%E\ \ %\\d%\\+)\ %m,
      \%C\ \ \ Message:,
      \%C\ \ \ \ \ %m,
      \%C%>\ \ \ Stacktrace:,
      \%C\ \ \ \ \ %.%#,
      \%-G%.%#

let &cpo = s:cpo_save
unlet s:cpo_save

" vim: nowrap sw=2 sts=2 ts=8:

It seems to be because the compiler detection doesn't allow hyphens in the makeprg value; adding this to the regex has worked for me, but since I have basically no idea what else I might be breaking, I thought I'd raise an issue rather than sending a patch.

Cheers,
Simon

p.s. Thank you very much for this plugin; it's utterly brilliant. I finally have the testing workflow I've always wanted.

:Make! doesn't work with file name modifiers

I have a build scenario where the source is located in one directory and the build is located on a scratch disk. So in my makeprg definition I substitute the current source directory for the build directory using the various % modifiers. However, the expansion of the modified file name doesn't seem to work when using :Make!

Here's the makeprg I use to swap out the source path for the build path:
set makeprg=make\ --no-print-directory\ install\ -C\ %:p:h:gs?.*/product/?${PROJECT_BUILD}/?

When I run a :Make! I see % getting expanded, but it's not doing any of the file name modifications:
!make --no-print-directory install -C /home/steveb:gs?.*/product/?/home/steveb/projects/foo/build/linux32/?

Steve

I am getting the following when running :Make or :Dispatch bash

/bin/bash: mc: line 1: syntax error: unexpected end of file
/bin/bash: error importing function definition for `mc'
bash: mc: line 1: syntax error: unexpected end of file
bash: error importing function definition for `mc'

Then everything works as expected. I am running on linux with tmux. I tried looking through the bundle for any mention to 'mc' but couldn't find anything. Could this be something in my environment. However, I don't see these errors on any of my scripts or in my shell.

Dispatch with iTerm gets stranded

I haven't found the exact reason yet but these are 2 behaviors that happens to me frequently:

1.- I run dispatch once and it gets stranded, the I run it for a second time and it works on the first stranded terminal (the second gets stranded after this)

2.- Other times it doesn't matter how many times I try to run it, it will not work and all terminal will be stranded.

This happens both with dispatch or start commands on iTerm2 version 1.0.0.20130624.

EDIT:

it happens when the last focused terminal is split, that's why when I run it twice it works properly.

windows.vim escape not wrapping entire function in quotes or brackets

windows.vim dispatch#windows#escape escapes individual quote marks, but does not wrap command in quote marks.

Found this while attempting to debug launching of OmniSharp with spaces in the path.

Example:

"notepad.exe" "sample_file.txt"

will be escaped to

^"notepad.exe^" ^"sample_file.txt^"

but then fail to launch.

Line 9 checks the value of shellxquote, but then line 13 to 15 attempt to wrap the command after checking the value of shellquote. On this system at least, shellxquote is populated with "(" where shellquote is null. Documentation supports that one may be populated, but rarely both. I suspect these calls to shellquote should be to shellxquote.

Have tested this locally, and ended up with:

("^notepad.exe^" ^"sample_file.txt^")

which then executes as expected.

Watching the build as it builds

I sometimes build big project that take a relatively long time to build (maybe ~5min). Sometimes is important for me to see the output of the build as it is generated so I guess opening the cmd.exe window unminimized and without redirecting the output would do it. Do you think this is something that could be done? I could help you if necessary.

Running `:Dispatch rspec %` in iTerm2 behaves as if shelling out with `:!`

This worked like a charm if I was running Vim from Tmux, but not in iTerm2 sans Tmux.

Steps to reproduce:

  • open iTerm2
  • vim some_spec.rb
  • :Dispatch rspec %

Result: Vim temporarily goes away. I see my spec running in the shell. This happens in the same tab. After the spec runs, I am returned to Vim, with the results in the quickfix window.

Running Vim 7.3 and iTerm2 Build 1.0.0.20130319.

Start on a new split pane

It would be great to :Start a process in a split pane. I'm currently using the following function:

" Start a process in a new, focused split pane.
function! s:StartSplit()
  let directory = expand('%:p:h')
  let command = exists('b:start') ? b:start : &shell
  exec printf('Tmux splitw -c %s %s', directory, command)
endfunction
command! -nargs=0 StartSplit call s:StartSplit()

" Dispatch
nnoremap <leader>r :StartSplit<CR>

You could provide an option like b:start_split or something similar. That's really useful If you want to start a console on the same window.

difference in pipe escaping between :make and :Make

I'm trying to do this:

autocmd BufNewFile,BufRead *_spec.rb compiler rspec | set makeprg=`([\ -e\ .zeus.sock\ ]&&echo\ zeus)\ \\\|\\\|\ ([\ -e\ Gemfile\ ]&&echo\ bundle\ exec)`\ rspec

This works fine w/ :make but :Make I end up with

/bin/bash: command substitution: line 0: syntax error near unexpected token `\|\|'
/bin/bash: command substitution: line 0: `([ -e .zeus.sock ]&&echo zeus) \|\| ([ -e Gemfile ]&&echo bundle exec)'

Errors when using inside screen on SunOs

Hi,

I am trying your plugin by using it inside a screen session in sunos. (I cannot compile tmux in this plattform).

I do
:set makeprg=dmake
:Make!

and the I do
:Copen

I get the error:

Error detected while processing function dispatch#copen..60_cgetfile:
line 16:
E40: Can't open errorfile /tmp/v473134/0

however if I type
:Make

if compiles successfully.

Any ideas?

Thanks!

Seeing 'No targets specified and no makefile found. Stop.'

I'm using the latest rbenv with Ruby 1.9.3p374, tmux 1.8, Vim 7.3.875 compiled with system ruby (1.8.7p358):

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Mar 28 2013 23:00:12)
MacOS X (unix) version
Included patches: 1-875
Compiled by [email protected]
Huge version without GUI.  Features included (+) or not (-):
+arabic          +cmdline_hist    +digraphs        +float           +langmap         +mouse           +multi_byte      +python          +startuptime     +textobjects     +wildignore
+autocmd         +cmdline_info    -dnd             +folding         +libcall         -mouseshape      +multi_lang      -python3         +statusline      +title           +wildmenu
-balloon_eval    +comments        -ebcdic          -footer          +linebreak       +mouse_dec       -mzscheme        +quickfix        -sun_workshop    -toolbar         +windows
-browse          +conceal         +emacs_tags      +fork()          +lispindent      -mouse_gpm       +netbeans_intg   +reltime         +syntax          +user_commands   +writebackup
++builtin_terms  +cryptv          +eval            -gettext         +listcmds        -mouse_jsbterm   +path_extra      +rightleft       +tag_binary      +vertsplit       -X11
+byte_offset     +cscope          +ex_extra        -hangul_input    +localmap        +mouse_netterm   -perl            +ruby            +tag_old_static  +virtualedit     -xfontset
+cindent         +cursorbind      +extra_search    +iconv           -lua             +mouse_sgr       +persistent_undo +scrollbind      -tag_any_white   +visual          -xim
-clientserver    +cursorshape     +farsi           +insert_expand   +menu            -mouse_sysmouse  +postscript      +signs           -tcl             +visualextra     -xsmp
+clipboard       +dialog_con      +file_in_path    +jumplist        +mksession       +mouse_urxvt     +printer         +smartindent     +terminfo        +viminfo         -xterm_clipboard
+cmdline_compl   +diff            +find_in_path    +keymap          +modify_fname    +mouse_xterm     +profile         -sniff           +termresponse    +vreplace        -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX -no-cpp-precomp  -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang   -L.    -L/usr/local/lib -o vim        -lm  -lncurses -liconv -framework Cocoa    -framework Python   -lruby -lobjc

I'm running latest vim-rails and vim-dispatch.

The spec I'm running lives in spec/lib/namespace/file_spec.rb. Vim "flickers" for a second, and then I see the tmux pane pop up on the bottom, but it is immediately hidden. Finally, the output || make: *** No targets specified and no makefile found. Stop. is displayed in Vim's Quickfix List. Any ideas of where to look? Thank you sir!

Not working as expected

When I use :Rake (from vim-rake), it opens the tmux split and opens the quickfix list on completion but complains that gems are missing.

I also tried :Dispatch rake but it also complains of missing gems on requires. This is the output of :Dispatch rake --trace

|| rake aborted!
|| cannot load such file -- rspec/core/rake_task
/home/dhruvasagar/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb|36| in `require'
/home/dhruvasagar/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb|36| in `require'
Rakefile|2| in `<top (required)>'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/gems/rake-10.0.3/lib/rake/rake_module.rb|25| in `load'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/gems/rake-10.0.3/lib/rake/rake_module.rb|25| in `load_rakefile'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/gems/rake-10.0.3/lib/rake/application.rb|583| in `raw_load_rakefile'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/gems/rake-10.0.3/lib/rake/application.rb|89| in `block in load_rakefile'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/gems/rake-10.0.3/lib/rake/application.rb|160| in `standard_exception_handling'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/gems/rake-10.0.3/lib/rake/application.rb|88| in `load_rakefile'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/gems/rake-10.0.3/lib/rake/application.rb|72| in `block in run'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/gems/rake-10.0.3/lib/rake/application.rb|160| in `standard_exception_handling'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/gems/rake-10.0.3/lib/rake/application.rb|70| in `run'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/gems/rake-10.0.3/bin/rake|33| in `<top (required)>'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/bin/rake|19| in `load'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/bin/rake|19| in `<main>'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/bin/ruby_noexec_wrapper|14| in `eval'
/home/dhruvasagar/.rvm/gems/ruby-1.9.3-p385@global/bin/ruby_noexec_wrapper|14| in `<main>'

I am also facing similar issues with :Make, it just doesn't report errors that it should.

Uggly output with Dispatch

Hello, I'm trying to do :Dispatch bin/rspec % as in the doc but I have this output :

1 ||                                                                                 ^M 0/11 |>                                                       |  ETA: ??:??:?? ^M 1/11 |====>                                                       |  ETA: 00:00:00 ^M^[[0m 2/11 |== 18 ===>                                              |  ETA: 00:00:00 ^M^[[0m 3/11 |===== 27 =====>                                         |  ETA: 00:0    0:00 ^M^[[0m 4/11 |======= 36 ========>                                    |  ETA: 00:00:00 ^M^[[0m 5/11 |========== 45 ==========>                               |  ETA: 00:00:00 ^M^[[0m 6/11 |============ 54     =============>                          |  ETA: 00:00:00 ^M^[[0m 7/11 |=============== 63 ===============>                     |  ETA: 00:00:00 ^M^[[0m 8/11 |================= 72 ==================>                    |  ETA: 00:00:00 ^M^[[0m 9/11 |==================== 81 ====================>           |  ETA: 00:00:00 ^M^[[0m 10/11 |====================== 90 ======================>      |  ETA: 00:00:00 ^M^[[0m 11    /11 |=                                                                                                                                                                                                          
  2 || ======================= 100 =========================>| Time: 00:00:00
3 || ^[[0m
  4 || Finished in 0.7535 seconds
  5 || 11 examples, 0 failures

There is a very long line. I'm using fuubar. There is no color too. Is there something to do?

Thanks?

iTerm new tab without closing

This is a feature request, not an issue.

As a python programmer I tend to use the python debugger a lot (pdb), when running my tests with dispatch it opens an iTerm tab and executes my command but there is nothing been printed in it and I cannot interact with the code been tested a all.

if an option like iterm_keep_open could be added that would mean a lot.

:lmake support

Is it possible to add async version of a :lmake? I'm looking for an opportunities of making Syntastic asynchronous. Since it uses a :lmake for running syntax checkers and heavily bound to location list, sadly simple switch to :Make doesnt work. I guess i can hack into this, but my vimscript-foo does not stand a change against yours :)

iTerm strategy behaviour different from docs

Hi,

I am using GUI MacVim without tmux. When I type :Make, sometimes I get plain old :make and sometimes a new iTerm tab opens. However, the behaviour is not the one advertised and a bit odd:

  • if iTerm is closed, it is started with two tabs, the default shell in background and the make command in foreground;
  • if iTerm is open but there are no open windows, I get plain old :make;
  • if iTerm is open with an open window, a new tab opens to run the make job.

if possible, I would prefer dispatch to always choose iTerm as this is much better than the standard :make.

Dispatch does not work with ruby interpreter, works for rspec

:Dispatch python % works well with python files. Also :Dispatch rspec % works.

When i try to use :Dispatch ruby % it splits the tmux window and abruptly closes it, :Copen does not show any output too. But if if there is any error with ruby file, the split window shows up with proper error message. What am i doing wrong?

Dispatch works in iTerm, but not in tmux

Hi there

I'm having trouble getting dispatch to work under tmux (tmux 1.8, inside iTerm2 Build 1.0.0.20131116, on a Mac running OSX Mavericks).

If I use iTerm without tmux, and launch vim, then ":Start irb" opens a new iTerm tab with irb running in it.

But, if I start tmux (within the iterm window), and launch vim, then ":Start irb" doesn't seem to work. The status line shows ":!irb (tmux)" but the process is not running, according to ps, and no new tmux split or window is opened.

Can anyone give me an idea of how to try and debug this?

Debugger prompt missing

When using a debugger while running rspec tests with dispatch, the prompt is missing but the debugger session is still functional.

Permision denied

After command: :Dispatch % within an active window containg a spec file I get the quickfix window with:
|| /var/folders/3s/tzxq0k016mbdt7g8jxpp5pmm0000gn/T/vs7QWBy/59: line 50: spec/spec_helper.rb: Permission denied

I use a console vim (home brew) on the MacOSX (tmux @ ITerm2).

Dispatch in Background Mode

So far I'm really liking vim-dispatch as I'm integrating it into my workflow.

I'm a bit confused about the equivalent of :Make! when calling :Dispatch.

I have two commands that I frequently run. One is my basic Make command which deploys my current file. This works perfectly with both :Make and :Make!. I have another command that I would like to use to execute any tests. It works just fine when using :Dispatch runmytests, but it only runs in the foreground. It also seems that :Dispatch! doesn't mean the same as :Make! but instead runs the default Dispatch.

Is there any way to run :Dispatch in the background like with :Make!?

Request: Custom callback function

In some cases it would be useful to be able to notify other plugins when the build is finished. It would be great if you could set a custom callback function along with the arguments passed to start()

Identify correct compiler for `bundle exec`-prefixed commands

If the command is prefixed with bundle exec it won't find the correct compiler. E.g. :Dispatch bundle exec rspec %.

I know I can use rails.vim for rails projects and it will work fine. But would be nice to use dispatch in the same way for non-rails projects.

Python Unit-tests

In theory, would it be somehow possible to run Python unit-tests from Vim and see output in quick-fix split?

gvim: Asynchronuous compilation with callback

Hi,

I'm using dispatch with gvim on a Linux machine. As far as I can tell, the only way to get asynchronuous compilation is to use :Make! or :Dispatch!, which sets request.background = 1. In this case, the callback that opens the error window is disabled (line 409 of dispatch.vim), which also disables the QuickFixCmdPost cgetfile autocommand group. If I understand #40 corretly, the reason is that dispatch#complete(...) is not called when dispatch uses tmux in background mode, and so the API becomes nonconsistent.

This means that at the moment, there is no way to get a good asynchronuous compilation in gvim (or macvim, I guess?) that also has a callback (either custom or with the quickfix window).

We are currently investigating whether or not to use vim-dispatch for Latex compilation in LaTeX-Box, see LaTeX-Box#106. It seems like this particular issue is the only thing that is stopping us.

Is there a way to add custom callbacks that also work when request.background = 1, that would also work with tmux (and iterm and in windows)?

Weird quickfix / errorformat / unimpaired interaction.

Similar in some level to Issue #23. I'm a big user of another great tpope plugin vim-unimpaired. My make job uses CMake which outputs some extra info, the errorformat is setup properly so when I run :make [q ]q moves between the errors in the quickfix list, and if there was no compile error [q ]q just return with a status of "No more items".

With dispatch's :Make if I get an error [q and ]q work just fine. If there are no errors however [q and ]q seem to just scroll through the cmake stylized makefile output instead of just returning "No more items".

Dispatch! doesn't redraw screen

Running commands in the background via Dispatch! causes the screen to goes blank. If I execute :redraw!, everything appears as it should. Similarly, executing :COpen partially redraws the screen but some sections such as line numbers aren't redrawn.

I'm running vim within tmux from iTerm2.

For reference, here are my dotfiles.

:cnext not usable with rspec errors

image

The hash marks preceding the file name in the quickfix window are breaking :cnext for me - a new empty file with the name '# ./app/models/subscription.rb' is created.

This seems to be caused by the output of rspec's documentation and progress formatters, so I don't even known if this is something that Dispatch can or should solve.

quickfix errorformat doesn't work for dispatch

:Dispatch populates quickfix but doesn't seem to apply the errorformat in the same way as simply using :cgetfile

Fake steps to reproduce

Given the following file at /tmp/fake_errors

file_one.rb:1: Fake error one
file_two.rb:2: Fake error two
file_three.rb:3: Fake error three

In Vim:

:let &errorformat = '%[ #]%#%f:%l:%m'
:Dispatch cat /tmp/fake_errors

Doesn't work.

:let &errorformat = '%[ #]%#%f:%l:%m'
:cgetfile /tmp/fake_errors

Does.

My actual problem

What I'm trying to do here is apply a custom formatter to rspec and display the errors nicely in quickfix style.

A gif demonstrating my issue

quickfix_issue

I ran the same test with only NeoBundle and vim-dispatch enabled and without any extra vimrc stuff beyond the default and I get the same results.

The rspec formatter I'm using can be found: https://github.com/lengarvey/vimrc/blob/master/config/ruby/vim_rspec2_formatter.rb it's not working yet since I can't figure out how to get this errorformat stuff applying correctly.

Steps to reproduce:

:Dispatch bundle exec rspec -r $HOME/.vim/config/ruby/vim_rspec2_formatter.rb -f VimFormatter

Observe that the quickfix window doesn't appear to have the errors linked as expected.

Expected results

:!bundle exec rspec -r $HOME/.vim/config/ruby/vim_rspec2_formatter.rb -f VimFormatter > /tmp/tmpfile
:cgetfile /tmp/tmpfile

Am I doing something obviously wrong?

RVM + tmux: Using wrong Ruby version

When I run :Dispatch rspec in MacVim or vim outside of tmux, there are no problems. However, when running the same command in tmux inside of vim, the command fails, and the backtrace shows whichever version of Ruby I first started any other tmux session in (i.e. not the correct one if I have any previously opened sessions), but still displays syntax errors on Ruby 1.9-style hashes, as if it's really using Ruby 1.8.

The vim-dispatch plugin with gradle compiler doesn't work

I have a vim-android plugin (hsanson/vim-android) that uses gradle to build Android projects withn vim. This plugin has a function to build the project that does something like this:

let &makeprg = "gradle --no-color assembleDebug"
let &shellpipe='2>'
silent! make

When there are build errors the quickfix window opens and shows the error like below and I can easily jump to the problematic file and line:

prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:compileDebug
/home/hsanson/Projects/GeoLuis/geoalert-android/src/jp/co/suj/android/geoalert/LoginActivity.java:47: エラー: <identifier>がありません
  rivate final static String TAG = LoginActivity.class.getSimpleName();
        ^
エラー1個
:compileDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebug'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Now I am trying to make the build process async using vim-dispatch and for that I am using the following:

let &makeprg = "gradle --no-color assembleDebug"
let &shellpipe='2>'
silent! exe 'Make'

Unfortunately for some reason the contents in the quickfix window is all mangled and looks like:

| > Building > :compileDebugAidl^[[20D^[[0K^[[10D^[[0K:compileDebugAidl·
|| > Building^[[10D^[[0K^[[1A^[[18CUP-TO-DATE
|| > Building^[[10D^[[0K^[[1A^[[28C
|| > Building > :compileDebugRenderscript^[[28D^[[0K^[[10D^[[0K:compileDebugRenderscript·
|| > Building^[[10D^[[0K^[[1A^[[26CUP-TO-DATE
|| > Building^[[10D^[[0K^[[1A^[[36C
|| > Building > :generateDebugBuildConfig^[[28D^[[0K^[[10D^[[0K:generateDebugBuildConfig·
|| > Building^[[10D^[[0K^[[1A^[[26CUP-TO-DATE
|| > Building^[[10D^[[0K^[[1A^[[36C
|| > Building > :mergeDebugAssets^[[20D^[[0K^[[10D^[[0K:mergeDebugAssets·
|| > Building^[[10D^[[0K^[[1A^[[18CUP-TO-DATE
|| > Building^[[10D^[[0K^[[1A^[[28C
|| > Building > :mergeDebugResources^[[23D^[[0K^[[10D^[[0K:mergeDebugResources·
|| > Building^[[10D^[[0K^[[1A^[[21CUP-TO-DATE
|| > Building^[[10D^[[0K^[[1A^[[31C
|| > Building > :processDebugManifest^[[24D^[[0K^[[10D^[[0K:processDebugManifest·
|| > Building^[[10D^[[0K^[[1A^[[22CUP-TO-DATE
|| > Building^[[10D^[[0K^[[1A^[[32C
|| > Building > :processDebugResources^[[25D^[[0K^[[10D^[[0K:processDebugResources
|| > Building > :generateDebugSources^[[24D^[[0K^[[10D^[[0K:generateDebugSources
|| > Building > :compileDebug^[[26D^[[0K:compileDebug
> Building > :compileDebug^[[26D^[[0K/home/hsanson/Projects/GeoLuis/geoalert-android/src/jp/co/suj/android/geoalert/LoginActivity.java|47| error: <identifier> expected                                                                         
|| > Building > :compileDebug^[[26D^[[0K  rivate final static String TAG = LoginActivity.class.getSimpleName();
|| > Building > :compileDebug^[[26D^[[0K        ^   
|| > Building > :compileDebug^[[26D^[[0K1 error
|| > Building > :compileDebug^[[16D^[[0K^[[10D^[[0K:compileDebug·
|| > Building^[[10D^[[0K^[[1A^[[14CFAILED
|| > Building^[[10D^[[0K^[[1A^[[20C
|| > Building^[[10D^[[0K
|| > Building^[[10D^[[0KFAILURE:·
|| > Building^[[10D^[[0K^[[1A^[[9CBuild failed with an exception.
|| > Building^[[10D^[[0K^[[1A^[[40C
|| > Building^[[10D^[[0K
|| > Building^[[10D^[[0K* What went wrong:
|| > Building^[[10D^[[0KExecution failed for task ':compileDebug'.
|| > Building^[[10D^[[0K>·
|| > Building^[[10D^[[0

The output has some escape codes and the stderr and stdout are mixed together making it difficult to match the problematic file and line number. I tried a lot of different shellpipe variations with no luck.

Any idea on how to make this work with vim-dispatch? Maybe add an option to vim-dispatch to redirect either stderr or stdout to the resulting makeef file instead of both?

How would I intercept the output of a :Dispatch so I can parse and display it in a more usable fashion in the quickfix window?

Sorry if this is not exactly an issue. I wish Github would add a discussion section for repos.

There's no plugin for linting Clojure projects yet, and the only tool so far is eastwood. It takes a long time to run, so Dispatch would be great for it.

But doing :Dispatch lein eastwood just takes the whole output of the command and places it in quickfix window. I'd like to parse this output, and show proper message with line numbers and make them navigable.

Where/how would I go about doing that?

tmux/gvim session doesn't update quickfix list in real time properly

When I launch a test with :Rake command from vim-rails there is only two updates of quickfix list.

First one contains:

|| Please install RDoc 2.4.2+ to generate documentation.
|| DEPRECATION WARNING: require "activerecord" is deprecated and will be removed in Rails 3. Use require "active_record" instead. (called from /Users/bogdan/.rvm/gems/ruby-1.8.7-p371@curebit/gems/activerecord-2.3.17/lib/activerecord.rb:2)

Second one contains

|| /Users/bogdan/.rvm/rubies/ruby-1.8.7-p371/bin/ruby -I"lib:test" "/Users/bogdan/.rvm/gems/ruby-1.8.7-p371@curebit/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/site_test.rb" 
|| (in /Users/bogdan/makabu/allan/curebit-marketing)
|| NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
|| Gem.source_index called from /Users/bogdan/.rvm/gems/ruby-1.8.7-p371@curebit/gems/rails-2.3.17/lib/rails/gem_dependency.rb:21.
|| Loaded suite /Users/bogdan/.rvm/gems/ruby-1.8.7-p371@curebit/gems/rake-0.8.7/lib/rake/rake_test_loader
|| Started
|| .............................................
|| Finished in 14.816231 seconds.
|| 
|| 45 tests, 85 assertions, 0 failures, 0 errors

So dots don't appear in real time.

The problem doesn't exist when using tmux/vim instead.
I can reproduce this on both macos and linux.

I believe it somehow connected with running a shell command from main ruby process.

:Dispatch with echo (sanity check)

If I run a command like

:Dispatch! echo blah | tee /tmp/blarg

the quickfix list shown by :Copen! stays empty, though the command ran because /tmp/blarg is created with the expected contents.

Is the output getting parsed away somehow, or is it not being captured? If this approach shouldn't work, any suggestions on how to make a similar kind of "echo test" to populate the quickfix list?

(Sorry if this question is dumb! I'm trying to set up vim-dispatch for testing but I'm confused.)

Quickfix split should occupy full width?

I've got vertical splits. When I :Dispatch in tmux, the lower tmux pane occupies the full width of the terminal. However when that tmux pane is closed and quickfix is opened, that window occupies only half the width in Vim.

dispatch splits

I feel that you tried to replace the tmux pane with quickfix window in a way that there's an illusion they're the same split. If so, this definitely breaks that illusion.

Feature: Ability to cancel / abort a dispatched command

Not sure how many would find this useful, but I would like to be able to abort a dispatched task and most importantly ignore it's output and not have it loaded into quickfix list.

Perhaps I should :Start such a command rather than :Dispatch, but in either case currently there's no support for being able to abort it from within vim and as of now I am not even sure if it is feasible, so just putting it out there, and I can see this to be useful in both cases with :Start and :Dispatch.

Cannot get Dispatch/Quickfix to work

Running 'Dispatch rspec %' does not open a new pane but seems to run rspec in vim. I see this message in the output: can't find pane: 1

Afterwards, the output of rspec is loaded into the quickfix window, however, I cannot get ':cc' to work. Calling `:Copen' switches to the quickfix window without changing anything. Calling ':cc' doesn't do anything.

I am kind of lost here, any help appreciated. I use tmux 1.6, vim 7.3 on ubuntu 12.04.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.