How to set default vim colorscheme

前端 未结 10 1101
南笙
南笙 2020-12-22 20:33

The latest upgrade of Ubuntu made my vim colorscheme unusable. I know how to set it manually (:colo evening, for example), but I want to set the default for all

相关标签:
10条回答
  • 2020-12-22 21:09

    Copy downloaded color schemes to ~/.vim/colors/Your_Color_Scheme.

    Then write

    colo Your_Color_Scheme
    

    or

    colorscheme Your_Color_Scheme
    

    into your ~/.vimrc.

    See this link for holokai

    0 讨论(0)
  • 2020-12-22 21:12

    You can just use the one-liner

    echo colorscheme koehler >> ~/.vimrc
    

    and replace koehler with any other available colorscheme. Imho, all of them are better than default.

    0 讨论(0)
  • 2020-12-22 21:14

    OS: Redhat enterprise edition

    colo schema_name works fine if you are facing problems with colorscheme.

    0 讨论(0)
  • 2020-12-22 21:15

    What was asked for was to set:

    • the 'default', not some other color profile, and

    • 'for all vim sessions', not simply for the current user.

    The default colorscheme, "for all vim sessions", is not set simply by adding a line to your ~/.vimrc, as all of the other answers here say, nor is the default set without the word 'default' being there.

    So all of the other answers here, so far, get both of these wrong. (lol, how did that happen?)


    The correct answer is:

    Add a line to your system vim setup file in /etc/vim/ that says

    colorscheme default
    

    or using the abbreviation

    colo default
    

    but not capitalized as

    colo Default
    

    (I suggest using the full, un-abbreviated term 'colorscheme', so that when you look at this years later you'll be able to more easily figure out what that darn thing does. I would also put a comment above it like "Use default colors for vim".)


    To append that correctly, first look at your /etc/vim/vimrc file.

    At the bottom of mine, I see these lines which include /etc/vim/vimrc.local:

    " Source a global configuration file if available
    if filereadable("/etc/vim/vimrc.local")
      source /etc/vim/vimrc.local
    endif
    

    So you can append this line to either of these two files.

    I think the best solution is to append your line to /etc/vim/vimrc.local like this:

    colorscheme default


    You can easily do that in bash with this line:

    $ echo -e "\"Use default colors for vim:\ncolorscheme default"  \
       |  sudo tee -a /etc/vim/vimrc.local
    
    # 
    #     NOTE:  This doesn't work:
    #
    #       $ sudo echo 'colorscheme default'  >> /etc/vim/vimrc.local
    #
    #     It's the same general idea, and simpler, but because sudo doesn't
    #     know how to handle pipes, it fails with a `Permission denied` error.
    

    Also check that you have permission to globally read this file:

    sudo chmod 644 /etc/vim/vimrc.local
    

    With $ tail /etc/vim/vimrc.local you should now see these lines:

    "Use default colors for vim:
    colorscheme default
    
    0 讨论(0)
  • 2020-12-22 21:17

    Once you’ve decided to change vim color scheme that you like, you’ll need to configure vim configuration file ~/.vimrc.

    For e.g. to use the elflord color scheme just add these lines to your ~/.vimrc file:

    colo elflord

    For other names of color schemes you can look in /usr/share/vim/vimNN/colors where NN - version of VIM.

    0 讨论(0)
  • 2020-12-22 21:20

    You can try too to put this into your ~/.vimrc file:

    colorscheme Solarized
    
    0 讨论(0)
提交回复
热议问题