Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim - indent and syntax highlight broken after recover file

I was editing a file with vim. I started another vim to edit the same file, it said that the /tmp/file.swp exits, press "R" to recover it. I chose to recover. But after that, syntax highlight didn't work on that file (other files still ok). I tried :syntax on and some commands but not worked.

like image 398
Trantor Liu Avatar asked May 01 '12 15:05

Trantor Liu


2 Answers

You may try to use the following command to specify the type type. For example for c file:

:set filetype=c
like image 51
David.Chu.ca Avatar answered Sep 26 '22 15:09

David.Chu.ca


I just solve it, in a simple way.

I find the folder which ~/.vim/view/ and remove the record about the py file which i just recovered...

cd ~/.vim/view && ls -alh | grep filename_1 | awk '{print $9}' | xargs rm

You can change that as you like ... just a demo.

:)

like image 23
symons1992 Avatar answered Sep 25 '22 15:09

symons1992