automation - How to run vimscript from bash, and get the output in a bash script? -



automation - How to run vimscript from bash, and get the output in a bash script? -

i'd run vimscript command line. check if command-t installed on vim instance (and if not, i'd install it).

i can run commands in vim observe presence of command-t, illustration exists("commandtflush") homecoming 0 if exists , 2 if doesn't.

how can phone call function bash script, , interpret result in bash?

i ended using next commands. since vim uses ncurses, can't echo can read homecoming code of vim process. if exit vim :cquit vim exit homecoming code 1, otherwise exit 0. can utilize determine success/failure of function.

add next file , save check-command-t.vim:

:let cmdt = exists("commandtflush") :if cmdt == 2 " it's not installed. :cquit :else :exit :endif

from bash want utilize vim -s check-command-t.vim tell vim run of commands in file.

if vim -s check-command-t.vim; # command exited homecoming code 0; command-t installed else # not installed fi

bash automation vim

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -