6

I want to select a color scheme in gVim such that it's used always (i. e. if I select color scheme X, close gVim, and start it again, it should start with X as the color scheme, not the default one).

Screenshot

How can I do it?

Just selecting the color scheme (see menu in the screenshot above) doesn't help.

1
  • 1
    I had the same question and the answers are surprising. Is it just me, or is it bizarre that a gui program doesn't allow saving settings via the gui? And the gui file menu doesn't even have an item that opens the user's vimrc (at least not one that is easily visible). May 20, 2022 at 7:34

4 Answers 4

9

In Vim, settings are saved across sessions by writing them in an init script called vimrc.

On Windows, that vimrc is supposed to be at:

$HOME\_vimrc

or (if HOME is not defined):

C:\Users\yourlogin\_vimrc

On Unix at:

$HOME/.vimrc

The installer may or may not have created that file for you, so you'll have to create if it doesn't exist. Do :echo $HOME in Vim to know where to create that directory and that file.

To save your colorscheme choice, add this line to your vimrc:

colorscheme slate

See this document.

0
1

If you use gVim, go to Edit -> click on Startup Settings -> add in the file "colorscheme slate" -> save

1
  • 2
    Welcome to Vim :-) It looks to me that your solution is a duplicate of the one of @romain. Although it brings that the vimrc file can edited from the gVim menu. Maybe could you make that more explicit. Jul 13, 2022 at 23:47
-1

In Linux, the vimrc file at home directory, so if you want to edit:

$ cd ~
$ vi .vimrc

and then please, add or edit colorscheme line like:
colorscheme torte

7
  • 1
    Welcome to Vi and Vim! cd doesn’t mean edit, it means change directory; and this doesn’t make sense on files. Also the vimrc can be located in other places (I prefer ~/.vim/vimrc).
    – D. Ben Knoble
    Apr 1, 2021 at 0:02
  • @D.BenKnoble thanks. I fixed it.
    – Cloud Cho
    Apr 1, 2021 at 0:08
  • 1
    Welcome to this site. While this shows how to edit one's vimrc (in some cases) that doesn't answer the question about changing the colorscheme setting.
    – statox
    Apr 1, 2021 at 10:15
  • I'm inclined to agree with @statox ; perhaps you meant to suggest an edit on the other answer to include the location for linux?
    – D. Ben Knoble
    Apr 1, 2021 at 13:50
  • @statox thanks for the suggestion. I added the information for setting.
    – Cloud Cho
    Apr 1, 2021 at 15:30
-2

In Windows 10 nowadays you have to edit (with admin privileges) the file _vimrc located in %ProgramFiles(x86)%\Vim\_vimrc And add the line: colorscheme <colorscheme>

Font where i found the way to solve this: http://vim.wikia.com/wiki/Change_the_color_scheme

1
  • 2
    There's no reason to edit the _vimrc in the program files directory. :e $HOME/_vimrc and put the colorscheme command there.
    – jamessan
    Nov 24, 2018 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.