How to restart vim from a bash script? -
i want restart vim bash script vim picks out-of-band changes. have working stuck trying determine utilize launch vim.
here's have:
#!/usr/bin/env bash local servername=$(vim --serverlist) [ -n "$servername" ] && { vim --servername "$servername" --remote-send '<c-\><c-n>:mks! _session.vim<cr>:wqa<cr>' vim -s _session.vim sleep 1 rm _session.vim }
the problem vim
called script obsolete scheme vim @ /usr/bin/vim
, not "my" vim alias mvim -v
(where mvim
launch script comes macvim).
this has 2 unfortunate consequences: (1) scheme vim doesn't recognise --serverlist
; (2) if did script subsequently launch wrong vim.
what's best way invoke vim on path?
the default vim never built +clientserver
portability afraid loose never there begin with.
aliases not expanded in bash scripts script won't see mvim -v
if don't tell explicitly utilize that. furthermore, vim
alias not in path
.
you define environment variable somewhere near top of script , utilize instead of vim
:
#!/usr/bin/env bash vim='/path/to/mvim' "$vim" -v whatever
or turn alias proper script.
or, maybe, place mvim
before in path
, phone call mvim -v
explicitly.
bash vim
No comments:
Post a Comment