SpaceVim / SpaceVim

A modular Vim/Neovim configuration
https://spacevim.org/
GNU General Public License v3.0
20.28k stars 1.42k forks source link

Use base16-shell + base16-vim to set colorscheme #1610

Closed neverfox closed 6 years ago

neverfox commented 6 years ago

Expected behavior, english is recommend

Changing terminal colors with base16-shell and base16-vim plugin installed should change spacevim colorsheme.

Environment Information

On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

The reproduce ways from Vim starting (Required!)

  1. Follow these instructions except add chriskempson/base16-vim the spacevim way. i.e. g:spacevim_custom_plugins = [['chriskempson/base16-vim']]
  2. Start spacevim (plugin will install)
  3. Colorscheme is still default gruvbox and doesn't match shell colors
  4. Try again with colorscheme layer loaded. No change.

Now, I didn't expect this to work because spacevim doesn't (I believe?) use .vimrc or if it does, it overrides the colorscheme by default. So really I'm asking if there's a way to configure spacevim to use the .vimrc_background file that base16-shell produces dynamically to set the colorscheme using those provided by base16-vim.

Output of the :SPDebugInfo!

SpaceVim Options :

g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'syntax checking', 'minor mode lighters']
g:spacevim_enable_statusline_display_mode = 0
g:spacevim_enable_os_fileformat_icon = 1
g:spacevim_leader_guide_position = 'botright'
g:spacevim_version = '0.8.0-dev'
g:spacevim_force_global_config = 0
g:spacevim_smartcloseignoreft = ['tagbar', 'vimfiler', 'SpaceVimRunner', 'SpaceVimREPL', 'SpaceVimQuickFix', 'HelpDescribe', 'VebuggerShell', 'VebuggerTerminal']
g:spacevim_default_indent = 2
g:spacevim_enable_javacomplete2_py = 0
g:spacevim_enable_powerline_fonts = 1
g:spacevim_statusline_separator = 'arrow'
g:spacevim_enable_language_specific_leader = 1
g:spacevim_warning_symbol = '⚠'
g:spacevim_simple_mode = 0
g:spacevim_colorscheme = 'gruvbox'
g:spacevim_expand_tab = 1
g:spacevim_enable_guicolors = 1
g:spacevim_custom_plugins = [['chriskempson/base16-vim']]
g:spacevim_leader_guide_submode_mappings = {'<C-C>': 'win_close'}
g:spacevim_buffer_index_type = 1
g:spacevim_hiddenfileinfo = 1
g:spacevim_statusline_inactive_separator = 'arrow'
g:spacevim_gitcommit_pr_icon = ''
g:spacevim_plugin_manager = 'dein'
g:spacevim_error_symbol = '✖'
g:spacevim_vim_plug_installed = 0
g:spacevim_windows_smartclose = 'q'
g:spacevim_windows_leader = 's'
g:spacevim_wildignore = '*/tmp/*,*.so,*.swp,*.zip,*.class,tags,*.jpg,*.ttf,*.TTF,*.png,*/target/*,.git,.svn,.hg,.DS_Store,*.svg'
g:spacevim_enable_ale = 0
g:spacevim_enable_cursorcolumn = 0
g:spacevim_colorscheme_bg = 'dark'
g:spacevim_enable_neocomplcache = 0
g:spacevim_leader_guide_sort_horizontal = 0
g:spacevim_enable_vimfiler_welcome = 1
g:spacevim_max_column = 120
g:spacevim_enable_debug = 1
g:spacevim_enable_insert_leader = 1
g:spacevim_enable_key_frequency = 0
g:spacevim_auto_disable_touchpad = 1
g:spacevim_vim_help_language = 'en'
g:spacevim_gitcommit_issue_icon = ''
g:spacevim_lint_on_save = 1
g:spacevim_search_tools = ['rg', 'ag', 'pt', 'ack', 'grep']
g:spacevim_dein_installed = 1
g:spacevim_autocomplete_method = 'deoplete'
g:spacevim_enable_vimfiler_filetypeicon = 0
g:spacevim_plugin_manager_max_processes = 16
g:spacevim_statusline_unicode_symbols = 1
g:spacevim_statusline_right_sections = ['fileformat', 'cursorpos', 'percentage']
g:spacevim_unite_leader = '\f'
g:spacevim_enable_ycm = 0
g:spacevim_enable_tabline_filetype_icon = 1
g:spacevim_colorscheme_default = 'desert'
g:spacevim_project_rooter_automatically = 1
g:spacevim_neobundle_installed = 0
g:spacevim_disabled_plugins = []
g:spacevim_leader_guide_max_size = 0
g:spacevim_guifont = ''
g:spacevim_info_symbol = 'ⓘ'
g:spacevim_leader_guide_flatten = 1
g:spacevim_sidebar_width = 30
g:spacevim_enable_googlesuggest = 0
g:spacevim_enable_neomake = 1
g:spacevim_plugin_bundle_dir = '/Users/neverfox/.cache/vimfiles/'
g:spacevim_leader_guide_run_map_on_popup = 1
g:spacevim_relativenumber = 1
g:spacevim_leader_guide_default_group_name = ''
g:spacevim_smartcloseignorewin = ['__Tagbar__', 'vimfiler:default']
g:spacevim_realtime_leader_guide = 1
g:spacevim_terminal_cursor_shape = 2
g:spacevim_altmoveignoreft = ['Tagbar', 'vimfiler']
g:spacevim_keep_server_alive = 1
g:spacevim_snippet_engine = 'neosnippet'
g:spacevim_project_rooter_patterns = ['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/', '.clang', 'pom.xml', 'package.json']
g:spacevim_github_username = ''
g:spacevim_leader_guide_hspace = 5
g:spacevim_denite_leader = 'F'
g:spacevim_leader_guide_vertical = 0
g:spacevim_checkinstall = 1
g:spacevim_windows_index_type = 0
g:spacevim_filetype_icons = {}
g:spacevim_plugin_name = 'denite-gtags'
g:spacevim_enable_cursorline = 1
g:spacevim_custom_color_palette = []
g:spacevim_lint_on_the_fly = 0
g:spacevim_debug_level = 1
g:spacevim_hosts_url = 'https://raw.githubusercontent.com/racaljk/hosts/master/hosts'
g:spacevim_language = ''
g:spacevim_filemanager = 'vimfiler'
g:spacevim_src_root = 'E:\sources\'
g:spacevim_enable_vimfiler_gitstatus = 0

SpaceVim Health checking :

SpaceVim clipboard support check report: Checking +clipboard: SUCCEED! SpaceVim environment check report: Current progpath: nvim(/usr/local/Cellar/neovim/0.2.2_1/bin/nvim) version: 800 OS: OSX [shell, shellcmdflag, shellslash]: ['zsh', '-c', 0] SpaceVim lua support check report: Checking +lua: Failed : Known issue, neovim do not support lua now. SpaceVim python support check report: Checking +python3: SUCCEED! Checking +python: SUCCEED!

SpaceVim runtime log :

[ SpaceVim ] : logger file  does not exists, only log for current process will be shown!
[ SpaceVim ] [15:17:05] [ Info ] Skip glob configuration of SpaceVim
[ SpaceVim ] [15:17:05] [ Info ] SpaceVim server startup at:/tmp/spacevim_nvim_server

Screenshots

If you have any screenshots for this issue please upload here. BTW you can use https://asciinema.org/ for recording video in terminal.

wsdjeg commented 6 years ago

please read :h g:spacevim_colorscheme

neverfox commented 6 years ago

I did. I know I can hardcode the value (say, base16-nord) and it works (except for the powerline bar), but what I'm asking is if there's a way to set the value dynamically. If this were not spacevim, I would do the following:

  1. Run a base16-shell command in terminal, e.g base16_darktooth. base16-shell produces the file ~/.vimrc_background:
    if !exists('g:colors_name') || g:colors_name != 'base16-darktooth'
    colorscheme base16-darktooth
    endif
  2. Add the following to ~/.vimrc:
    if filereadable(expand("~/.vimrc_background"))
    let base16colorspace=256
    source ~/.vimrc_background
    endif
  3. Profit. Shell and vim have matched colorscheme, based on whatever base16-shell theme was selected.

I'm wondering if there is a way to leverage the .vimrc_background file to set g:spacevim_colorscheme. I was hoping against hope that it would just work but that was based on a bad assumption that Spacevim might respect a .vimrc file and furthermore set g:spacevim_colorscheme based on mere colorscheme.

The solution might be to use the fact that base16-shell also sets the environment variable BASE16_THEME. Is there a way to reference that when setting g:spacevim_colorscheme?

neverfox commented 6 years ago

Figured it out.

let g:spacevim_colorscheme = 'base16-' . $BASE16_THEME

wsdjeg commented 6 years ago

nice!

hyperion-git commented 5 years ago

How would one do this in the new .toml based settings file?