Skip to content

"auto-session ERROR: Error restoring session, disabling auto save." with "Error: E184: No such user-defined command: ShFoldIfDoFor" #358

Answered by cameronr
miguno asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, I got to the bottom of it. The vim syntax file for sh scripts has these lines that are clearing some commands just in case they exist:

https://github.com/neovim/neovim/blob/6af9ca4926e05ac698d828ab6aeef2f45ccccdf8/runtime/syntax/sh.vim#L109-L113

That doesn't generate an error (because of the sil!) but it does set v:errmsg. When we're restoring a session, we use silent! source <session>. the ! means it will keep restoring the session even if there's an error so we use v:errmsg to catch any errors that might be generated while restoring the session. This case highlights the problem with that approach, namely that there might be other benign "errors" that set v:errmsg but aren't really e…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@cameronr
Comment options

@cameronr
Comment options

Answer selected by miguno
@miguno
Comment options

@cameronr
Comment options

@miguno
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants