1

When I'm using Vim, I can execute bash or node.js files by using :%terminal bash or :%terminal node... I like to execute them like this inside Vim because it works in an interactive way, so I can see what's happening while the process is being executed. However, on NeoVim I didn't manage to make this same command work. If I try using these commands I receive the error E481: No range allowed...

On Neovim documentation I found a different syntax for using the terminal on NeoVim... I think the solution to my problem is something related to term:// but I didn't manage to make it work. What is the equivalent command to :% terminal bash on NeoVim?

1 Answer 1

2

After experimenting for a while I found out that it works fine on NeoVim when I use :terminal bash % or :terminal node % instead. The way it works on NeoVim differs from the way that :%terminal bash works on Vim though, it doesn't show any status if the code is still running or not, and after the file is executed it's necessary to go back to the text that was being edited with :b1.

Also, while :%terminal bash doesn't require saving the file to execute it, :terminal bash % requires to save the file each time before executing it... In my case, the workaround for NeoVim is to use the command :autocmd TextChanged,TextChangedI <buffer> silent write to autosave the file each time it's changed. I'm not completely sure if that's the best way to solve it... But it works for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.