I don't know very well how to work with vimscript... Because of that, I'd like to find a way where I can easily test what I'm trying to accomplish on my vimrc file, with some prints like on other programming languages.
To demonstrate what I'd like to do, I'll give some examples with other programming languages...
In python
, if I want to execute it from the terminal, I just need to create a file with any name, put some python
code inside it, and run it from the terminal with the command python3 file
...
In node.js
, if I want to execute it from the terminal, I just need to create a file with any name, put some node.js
code inside it, and run it from the terminal with the command node file
...
In bash
, if I want to execute it from the terminal, I just need to create a file with any name, put some bash
code inside it, and run it from the terminal with the command bash file
...
So, I'm wondering if there's any similar way of executing and testing vimscript files like that as well... Is it possible? I know that vimscript works inside my vimrc file but I'm struggling to find a good way of testing it...
:p[rint]
to dump all of the buffer's lines to stdout. Here's an example of one way to do that...vim -e -c 'source script.vim' -c '%p' -c 'q!' /dev/stdin <targetfile
:source
it. Add some:echom
for debugging, etc.