No syntax highlighting after session restore in terminal

风流意气都作罢 提交于 2019-12-08 02:09:42

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/7398872/no-syntax-highlighting-after-session-restore-in-terminal

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!