Spacevim: How to disable statusline via toml

Created on 9 May 2018  路  12Comments  路  Source: SpaceVim/SpaceVim

Expected behavior, english is required

There are various issues that describe how to replace the build in status line with airline via code. I would like to achieve the same via toml. Is that possible?

doc

Most helpful comment

After thinking about this a little more, I agree with @wsdjeg that scripting in configuration might not be a good idea as it could break SpaceVim bootstrapping.

I also agree with @wsdjeg that the following approach for advanced configuration is a bit ugly:

[[options]]
    bootstrap_after = "function-name"
    bootstrap_before = "function-name"

But, what if combine the two for some hybrid approach?
Example:

[[options]]
    bootstrap_after  = "path/to/after.vim"  (relative to `~/.SpaceVim.d/`)
    bootstrap_before = "path/to/before.vim" (relative to `~/.SpaceVim.d/`)

All 12 comments

After going through the code it seems there is no option to disable a layer via toml.

SpaceVim#custom#apply is iterating over the given layers and loads them when listed. SpaceVim#layers#load adds the layer to the list of enabled_layers. None of the methods contain code that would allow one to disable a layer.

Unfortunatley it is also not possible to have a .toml and .vim file in parallel, as the toml file is preferred.

Correct me if i am wrong but this leaves me with no option to disable a default layer via toml? Maybe thats a feature you could add?

The actual reason i want to disable the default statusline is because of custom theming that overrules everything. My intent is to use base16, which works for the editor itself but not for the tab- and statusline.

Enabling the usage of airline themes instead of SpaceVim custom theming would also solve my problem.

Relates to #1704

I may have found a workaround to go back to ~/.SpaceVim.d/init.vim, although it might be a temporary one depending on recommendations from @wsdjeg.

But, here is what I did:

  • I moved ~/.SpaceVim.d/init.toml to ~/.SpaceVim.d/init.toml.bak just to disable it.

  • Copied the ~/.SpaceVim.d/init.vim template from the wiki:

" Here are some basic customizations, please refer to the ~/.SpaceVim.d/init.vim
" file for all possible options:
let g:spacevim_default_indent = 3
let g:spacevim_max_column     = 80

" Change the default directory where all miscellaneous persistent files go.
" By default it is ~/.cache/vimfiles/.
let g:spacevim_plugin_bundle_dir = '~/.cache/vimfiles/'

" set SpaceVim colorscheme
let g:spacevim_colorscheme = 'jellybeans'

" Set plugin manager, you want to use, default is dein.vim
let g:spacevim_plugin_manager = 'dein'  " neobundle or dein or vim-plug

" use space as `<Leader>`
" let mapleader = "\<space>"

" Set windows shortcut leader [Window], default is `s`
let g:spacevim_windows_leader = 's'

" Set unite work flow shortcut leader [Unite], default is `f`
let g:spacevim_unite_leader = 'f'

" By default, language specific plugins are not loaded. This can be changed
" with the following, then the plugins for go development will be loaded.
call SpaceVim#layers#load('lang#go')

" loaded ui layer
call SpaceVim#layers#load('ui')

" If there is a particular plugin you don't like, you can define this
" variable to disable them entirely:
let g:spacevim_disabled_plugins=[
    \ ['junegunn/fzf.vim'],
    \ ]

" If you want to add some custom plugins, use these options:
let g:spacevim_custom_plugins = [
    \ ['plasticboy/vim-markdown', {'on_ft' : 'markdown'}],
    \ ['wsdjeg/GitHub.vim'],
    \ ]

" set the guifont
let g:spacevim_guifont = 'DejaVu\ Sans\ Mono\ for\ Powerline\ 11'
  • Opened nvim and I'm back to modifying neovim config via Vimscript.

Unfortunatley switching back to .vim config style completely is not a viable option for me. I am working on a programatic way to setup my dev machine and having a parsable config style makes this possible.

I am thinking about how to implement this feature.

The items in the layers list is a dictionary. Maybe we can add a key enable.

For example:

[[layers]]
name = "core#statusline"
enable = false

Sounds like an idea @wsdjeg. What do you think about the idea to always load the init.vim after init.toml for advanced configurations?

Use vim script as configuration is not a good idea. at least not a good idea for SpaceVim, because users can write any scripts call any function in config file, sometions It will breake SpaceVim bootstrap. Like general IDE or Text editors, use toml/json etc. as config file will be better.

SpaceVim support custom layer, Maybe use a custom layer, or an bootstrap hooks function will be better.

Other vim distributions (like Janus, spf13-vim ...etc) have the concept of .vim.after or .vim.before which allows users to write custom vim configuration that will be called after or before the bootstrap.

Have you considered a similar approach?
For some plugins, there is a legitimate need for configuration to happen before logic in bootstrapping takes place.

After thinking about this a little more, I agree with @wsdjeg that scripting in configuration might not be a good idea as it could break SpaceVim bootstrapping.

I also agree with @wsdjeg that the following approach for advanced configuration is a bit ugly:

[[options]]
    bootstrap_after = "function-name"
    bootstrap_before = "function-name"

But, what if combine the two for some hybrid approach?
Example:

[[options]]
    bootstrap_after  = "path/to/after.vim"  (relative to `~/.SpaceVim.d/`)
    bootstrap_before = "path/to/before.vim" (relative to `~/.SpaceVim.d/`)

@wsdjeg Thank you for implementing this, do we have to wait for a new SpaceVim release or is this directly available? 鉂わ笍

this feature has already been pushed to master branch.

Was this page helpful?
0 / 5 - 0 ratings