Reputation: 31985
I use Vim mostly through OS X's MacVim application, but I also use it from within Terminal. However, since I use the following vim code in order to make use of session to keep previous files always open in next session:
In ~/.vimrc:
function! RestoreSession()
if argc() == 0 "vim called without arguments
execute 'source ~/.vim/Session.vim'
end
endfunction
autocmd VimEnter * call RestoreSession()
when I use MacVim, there are no issues there, but when I use Vim from within Terminal, whenever I type in commands (vim
) and start to use it, I first got a lot of error messages like Error detected while processing /Users/myUserName/.vim/Session.vim:
line 265:
"path/to/my/file.js" 19L, 626C
So I wonder what is the best way to cope with the above issue:
Always use Vim only on MacVim (which I don't like...)
Modify the above code snippet a bit to make it valid only through MacVim if it is feasible
Stand those error messages (I can use Vim after seeing those errors - I just don't like seeing it and typing "ENTER" a lot whenever I use it in Terminal)
I'd like to take the second solution if it is feasible, but how can I do it? And are there other solutions that you know are better in this situation?
Thanks.
Upvotes: 0
Views: 112
Reputation: 20630
Put any settings that you only want to use in the GUI version into a .gvimrc file instead.
Upvotes: 0
Reputation: 172648
Unless you can figure out what's the root cause of the errors (and as you're apparently content with the restore even with those errors), you can suppress them via:
silent! execute 'source ~/.vim/Session.vim'
Upvotes: 1