Spacevim: Changing init.vim to init.toml

Created on 20 Jun 2018  路  14Comments  路  Source: SpaceVim/SpaceVim

I am trying to turn my .SpaceVim.d/init.vim into a .SpaceVim/init.toml but I don't know how to:

1 - set custom maps in toml:
nnoremap e ea

2 - set booleans
set nonumber

I tried:

[options]
   nonumber = false

But that doesn't seem to be the right way to do it (i.e. it doesn't work). Can someone give me a help on how to do this ?

Thanks

discussion doc usage

Most helpful comment

You should use following configuration:
~/.SpaceVim.d/init.toml

[options]
relativenumber = false
bootstrap_after = "myconfig#after"

~/.SpaceVim.d/autoload/myconfig.vim

nnoremap e ea
set nonumber

Also, you can read this: https://spacevim.org/documentation/#bootstrap-functions

All 14 comments

You should use following configuration:
~/.SpaceVim.d/init.toml

[options]
relativenumber = false
bootstrap_after = "myconfig#after"

~/.SpaceVim.d/autoload/myconfig.vim

nnoremap e ea
set nonumber

Also, you can read this: https://spacevim.org/documentation/#bootstrap-functions

This line number = false is incorrect. Should be the relativenumber = false

Thanks.

Yes, like you mentioned, removing the line number column (set nonu) just works on the bootstrap function not on the TOML file.

Thanks, all working great!

@rezende yeah, you can use bootstrap function for writting vim script in it. in ther bootstrap function, you can set vim options, defind custom key bindings, add autocmds etc.

any other qustions about using toml? or should we improve the documentation on the website?

I have a pretty complex init.vim and i am not able to directly switch to toml without a lot for dive deep into it. More documentation on how all the standard spacevim options are translated to toml would help me a lot.

The other option is to put more or less evereything in the custom bootstrap function, which I'd rather avoid.

@crisidev hello, in toml file, we can defind spacevim options, custom layer list and custom plugins list, but we can not include vim script. so If you want to defind function, key bindings, autocmd etc. you need bootstrap function. no need to put all this content into function. you can just put the script into that file, as the file is loaded before the bootstarp function is called. so the script looks like:

function! s:foo() abort

endfunction

augroup mycustomautocmd
    autocmd!
    autocmd WinEnter * call s:foo()
augroup END


function! myconfig#init()



endfunction

Thanks for the explanation. Is there any documentation with the full list of options settable inside toml?

Hum, I found them. They are in the layers docs. Thanks for the help, I will try to move to toml and bootstrap functions soon.

I am updatting the layer page in #1860 , and all available option can be find in :h spacevim you can check the toc of help file. it looks like:

CONTENTS                                                   *SpaceVim-contents*
  1. Introduction.............................................|SpaceVim-intro|
  2. Options................................................|SpaceVim-options|
      1. checkinstall..........................|SpaceVim-options-checkinstall|
      2. default_indent......................|SpaceVim-options-default_indent|
      3. enable_ale..............................|SpaceVim-options-enable_ale|
      4. enable_googlesuggest..........|SpaceVim-options-enable_googlesuggest|
      5. enable_guicolors..................|SpaceVim-options-enable_guicolors|
      6. enable_insert_leader..........|SpaceVim-options-enable_insert_leader|
      7. enable_neomake......................|SpaceVim-options-enable_neomake|
      8. enable_statusline_mode......|SpaceVim-options-enable_statusline_mode|
      9. enable_ycm..............................|SpaceVim-options-enable_ycm|
      10. error_symbol.........................|SpaceVim-options-error_symbol|
      11. guifont...................................|SpaceVim-options-guifont|
      12. lint_on_the_fly...................|SpaceVim-options-lint_on_the_fly|
      13. max_column.............................|SpaceVim-options-max_column|
      14. plugin_bundle_dir...............|SpaceVim-options-plugin_bundle_dir|
      15. plugin_manager_processes.|SpaceVim-options-plugin_manager_processes|
      16. realtime_leader_guide.......|SpaceVim-options-realtime_leader_guide|
      17. relativenumber.....................|SpaceVim-options-relativenumber|
      18. sidebar_width.......................|SpaceVim-options-sidebar_width|
      19. snippet_engine.....................|SpaceVim-options-snippet_engine|
      20. windows_leader.....................|SpaceVim-options-windows_leader|

I have a couple of other questions:

  • What is the toml directive for let g:spacevim_disabled_plugins?
  • What is the toml directive for let g:spacevim_custom_plugins?

@wsdjeg Gotcha. My issues were solved. My former vimrc were mostly plugins which SpaceVim completely solves. I have other questions but they're not related to this topic. Thanks!

@crisidev ok, two section should be added into the doc page,

  1. how to add custom plugins
  2. how to disable existing plugins

Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zeroasterisk picture zeroasterisk  路  4Comments

fmind picture fmind  路  3Comments

dzintars picture dzintars  路  3Comments

zeroasterisk picture zeroasterisk  路  5Comments

wsdjeg picture wsdjeg  路  3Comments