mattboehm / vim-unstack

Vim plugin for parsing stack traces and opening the files
286 stars 15 forks source link

Idea: UnstackFromCommand #39

Open jdsutherland opened 3 years ago

jdsutherland commented 3 years ago

As a tmux user, my workflow for using unstack is usually:

  1. run a failing build or test (using vim-test)
  2. copy (either tmux copy mode or piping 1. to xclip)
  3. :UnstackFromClipboard

It seems like this could be turned into a single command (UnstackFromCommand) that would streamline this.

Do you think this could be useful? I imagine that in many contexts, the trace might be too messy to send the entire output, so I'm not sure.

mattboehm commented 3 years ago

Thanks for the suggestion! I'm a little worried about false positives or multiple stack traces being an issue, but will leave this ticket open and think it over for a while.

Using vim's :terminal would allow you to highlight the stack trace and trigger unstack via the mapping (default `s'), potentially saving you a step. I totally understand if you prefer using tmux panes, though.

In theory, if you can customize vim-test to automatically pipe stdout to xclip, you could probably write a custom command that runs your test then calls UnstackFromClipboard (or in cases where a vim function runs the test and returns stdout, you can do :UnstackFromText(RunTests())), but I'm still thinking if there's a clean way to generalize this to warrant its inclusion to the plugin.