问题描述
我正在使用Mac Lion 10.7.1,MacVim Snapshot 61,Vim版本7.3
I'm using Mac Lion 10.7.1, MacVim Snapshot 61, Vim version 7.3
我想在退出时保存会话,并在Vim start上恢复最后一个没有任何参数的会话.因此,我将此代码添加到了.vimrc
文件中:
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
这在MacVim上很好用,但是当我在终端中打开Vim时,语法突出显示不起作用.我如何使它工作?
this works great with MacVim, but when I open Vim in terminal syntax highlighting is not working. How do I get this to work?
您可以在 https://github上查看我的.vimrc
文件. com/MaxSt/dotvim/blob/master/vimrc .
You can take a look at my .vimrc
file at https://github.com/MaxSt/dotvim/blob/master/vimrc.
推荐答案
我在这里有同样的问题.您需要在.vimrc中添加这些设置
I have the same question here. You need add these settings on your .vimrc
filetype on
filetype plugin on
filetype indent on
syntax on
启用突出显示颜色.
我使用的.vimrc没有这些文件,但可以在linux和旧的mac版本中使用.对于狮子,您需要添加它们.
I was using my .vimrc which does not have these but works in linux and old mac version. For lion you need add them.
这篇关于终端中的会话还原后,没有语法突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!