Add FAQ section

This commit is contained in:
Junegunn Choi
2022-09-05 14:11:56 +09:00
parent d0bb582dd4
commit 7f5d35a655

View File

@@ -107,6 +107,56 @@ autocmd! User GoyoLeave nested call <SID>goyo_leave()
More examples can be found here: More examples can be found here:
[Customization](https://github.com/junegunn/goyo.vim/wiki/Customization) [Customization](https://github.com/junegunn/goyo.vim/wiki/Customization)
FAQ
---
> _"My custom colors are lost when I exit Goyo!"_
That's because Goyo restores the base color scheme using `:colorscheme
CURRENT_COLOR_SCHEME` command on exit, and it resets your tweaks. Goyo can try
to remember all your customizations and restore them on exit, but it doesn't,
because there is a better, more robust way to address the issue.
The real problem here is that you will lose all your changes when you switch
between color schemes, even when you're not using Goyo.
```vim
" In your Vim configuration file
" - Base color scheme
colorscheme molokai
" - Your color customizations
hi LineNr ctermfg=red guifg=red
```
It works, only when you stick to a single color scheme. When you switch
between color schemes,
```vim
" Switch to another color scheme
colorscheme Tomorrow-Night
" Switch back to the original one
colorscheme molokai
```
And all the customizations you have made are lost.
What you should to do is to customize the colors on `autocmd ColorScheme`,
which is automatically triggered whenever you change color schemes.
```vim
function! s:tweak_molokai_colors()
" Your molokai customizations
hi LineNr ...
hi FoldColumn ...
endfunction
autocmd! ColorScheme molokai call s:tweak_molokai_colors()
colorscheme molokai
```
Inspiration Inspiration
----------- -----------