Vim colour change issue - seems to default to default terminal 8 bit colours?

Hi guys, so I’m trying to learn to use vim (on the foot terminal emulator) and am running into a weird issue. When I open a file with syntax highlighting, it initially opens following my current terminal colour theme (top right terminal in the image below, you can see compared to fastfetch). Using the terminal colour theme like this is my desired behaviour. However, as soon as I press any key, the colour defaults to what I think might be standard 8 colour terminal colours (same file bottom right in the image below after pressing a random key). The only vim file I’ve modified from the defaults that come with the standard arch install is

/etc/vimrc

To which I’ve simply added:

xnoremap <C-C :w !wl-copy
:set number

Removing those does not seem to affect the behaviour, but I include them for completeness. Running vim -u NONE obviously does not show this issue but also does not then show syntax highlighting in the first place. I have not been able to puzzle out where in the config files this colour behaviour is kept. If anyone can offer me pointers, I would be very grateful.

Terminal: Foot (in sway)
Shell: Fish
Vim packages installed: vim vim-runtime

Example image:

Well, I’m an idiot, and/or got confused. I think what happened here is that vim doesn’t know foot supports true colour (it must not be in the list of known terminals and I cannot find a way to add it).

I first tried adding :set termguicolors to my vimrc, which made the colours permanently the more limited palette. Adding set: t_Co=256 also did not work. It took me ages to realise (with help from linode), that this meant what I actually needed to add was

:set notermguicolors

which forces vim to try and use full colour, which seems to work.
I also realised my binding for copying text to they wayland clipboard I’m using, wl-copy, was incorrect above, should be:

xnoremap <C-C> :w !wl-copy<CR><CR>

Leaving this stuff here in case anyone else gets into the same foot/vim confusion I got myself into.

PS: all of this is much compounded by the fact that as a brit, every time I type anything to do with colour into a terminal I add that u and cause myself and the terminal a great deal of confusion.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.