Skip to content

Commit

Permalink
Add FAQ section
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Sep 5, 2022
1 parent d0bb582 commit 7f5d35a
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,56 @@ autocmd! User GoyoLeave nested call <SID>goyo_leave()
More examples can be found here:
[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
-----------

Expand Down

0 comments on commit 7f5d35a

Please sign in to comment.