3

I'm using Mac Lion 10.7.1, MacVim Snapshot 61, Vim version 7.3

I want to save the session on quit and restore the last session on Vim start without any arguments. So I added this code in my .vimrc file:

autocmd VimEnter * call LoadSession()
autocmd VimLeave * call SaveSession()
function! SaveSession()
  execute 'mksession! $HOME/.vim/sessions/session.vim'
endfunction
function! LoadSession()
  if argc() == 0
    execute 'source $HOME/.vim/sessions/session.vim'
  endif
endfunction

this works great with MacVim, but when I open Vim in terminal syntax highlighting is not working. How do I get this to work?

You can take a look at my .vimrc file at https://github.com/MaxSt/dotvim/blob/master/vimrc.

ib.
  • 27,830
  • 11
  • 80
  • 100
w1ng
  • 324
  • 1
  • 2
  • 11
  • Does this answer your question? [syntax highlighting doesn't work after restore a previous vim session](https://stackoverflow.com/questions/9281438/syntax-highlighting-doesnt-work-after-restore-a-previous-vim-session) – Big McLargeHuge Jul 09 '21 at 16:26

1 Answers1

2

I have the same question here. You need add these settings on your .vimrc

filetype on

filetype plugin on

filetype indent on

syntax on

To enable your highlight color.

I was using my .vimrc which does not have these but works in linux and old mac version. For lion you need add them.

Sammi Song
  • 36
  • 7