vim-plugin-autosess
vim-plugin-autosess copied to clipboard
Readonly stdin not working
With autosess enabled, starting vim in readonly from stdin does not work as expected.
echo "abc" | vim -R -
The content of stdin was discarded / replaced with session loading.
However, without readonly options including -R or set nomod, the content of stdin was preserved.
A possible solution is to have
autocmd StdinReadPre * let g:is_stdin = 1
and check for !exists("g:is_stdin") in VimEnter
Ref: http://stackoverflow.com/a/26673306/6383147