1

I want something similar to what I get when I enter debug mode and type "step", then enter and up, enter and up, ten thousand times... But without having to do all that work, allows it to be done programmatically and ideally with a cleaner output.

e.g. given this file, named example.vim:

function! F()
  echo 1
  echo 2
endf

Today the best I can do is this:

$ nvim --noplugin -u example.vim -E +'debug call F()'
Entering Debug mode.  Type "cont" to continue.
command line
cmd: call F()
>step
function F
line 1: echo 1
>step
1
function F
line 2: echo 2
>step
2
function F
line 2: End of function
>step
Entering Ex mode.  Type "visual" to go to Normal mode.
:q

I wish I had this (or something at least close to it):

$ nvim_stepthrough example.vim 'call F()'
call F()
  line 1: echo 1
  1
  line 2: echo 2
  2

(or a StepThrough call F() vimscript command that gave similar output)

I've been trying to be clever with the shell to achieve something like this with piping and fifos and redirection but so far the only thing I've accomplished was crashing my computer*.

I have a few ideas on how I could do this, but before I delve deep into it I wanted to know if there is anything that already exists that can accomplish something similar.


*tip: don't yes step to nvim -D &

  • 2
    I think nvim "+set verbose=10|redir @x|call F()|redir END|echo @x" or something similar could work but I'm not sure – rbernabe Mar 11 '17 at 2:23
  • 1
    'verbose' is worth a look as @rbernabe mentioned. But also, "enter and up" is not necessary. Just press "enter" to repeat the last :debug-mode command. – Justin M. Keyes Mar 29 '17 at 22:19
  • @JustinM.Keyes Yeah, I found out about that a little while after posting this, what a sweet revelation! I tried playing with verbose before but couldn't get it to enter functions, but that's maybe one step closer to the solution. I have this huge queue of things to take care of before I can tackle this and the parentheses problem, but hopefully I will eventually get to it and figure something out. Thanks for your comments so far! :) – phicr Mar 31 '17 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.