Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lost colorscheme after recovering swap file

Tags:

vim

colors

swap

I've searched for some time now and nobody seems to have the problem I do. I've got vim set up to use the colorscheme I like and it was all working perfectly until I opened a file that had a swap. I got the usual message asking if I wanted to delete it, read only or recover it. I selected recover and after doing so I've been unable to get that one file to display the colors I want.

I've tried the usual syntax:on, reloaded .vimrc and just about every normal step required to get the highlights. The strange thing is that the problem is only present for this one file when it's in the directory I recovered the swap from. Any other file I open has the colors working as usual, and if I rename the troublesome file or put it in another directory it loads the colors fine.

I figure vim must be storing its path somewhere but I have no idea where. I tried deleting .viminfo but that did nothing. Any input is greatly appreciated.

like image 291
jonthalpy Avatar asked Dec 06 '12 18:12

jonthalpy


People also ask

Where are SWP files stored in Linux?

swp is a swap file, containing the unsaved changes. While editing a file, you can see which swap file is being used by entering :sw . The location of this file is set with directory option. The default value is .,~/tmp,/var/tmp,/tmp .

What is a swap file Vim?

The reason this message comes up is that every time you edit a file, vim creates something called a "swapfile". A swapfile is a bit like an autosave file -- it keeps track of the current state of your document -- but it also stores additional information about your editing session (such as your undo/redo history).


1 Answers

Sorry, I'm new to Stackoverflow. I think this is more useful as an answer to my own question than a comment:

:colo outputs "torte" and se ft? outputs "filetype=" I tried the same commands on other files and se ft? outputs "filetype=cpp". I searched for how to set the filetype and set filetype=cpp fixed the issue. Thanks Balthamos for pointing me in the right direction!

like image 118
jonthalpy Avatar answered Oct 04 '22 10:10

jonthalpy