Gabirel/Hack-SpaceVim

[Question] How to change layer options using init.vim

ViiEx opened this issue · 2 comments

ViiEx commented

I'm trying to configure my spacevim using init.vim instead of init.toml. I was wondering tho how can I set the layers options tho.

For example I wanted to change the shell position to be at the bottom instead at the top. With a little bit of digging into the source code of SpaceVim I tried the following:

call SpaceVim#layers#shell#set_variable(['terminal', 'bottom', 30, 1])

The above function is located at .SpaceVim/autoload/SpaceVim/layers/shell.vim at the line 138

That only resulted on opening the shell at the right side instead of the bottom.

Any ideas on how to change the my shell to open the way I intend it to and how can I set layer options on init.vim ?

Sorry for the late reply.

Here is the solution

Main idea: overwrite the default option manually.

call SpaceVim#layers#load('shell')

" this call function MUST STAY BELOW
" Otherwise, it will get overwritten by `call SpaceVim#layers#load('shell')`
call SpaceVim#layers#load('shell',
    \ {
    \  'default_position' : 'bottom',
    \  'default_height' : 100,
    \ }
    \ )
Check demo

image

I hope this would solve your problem. This solution works for each layer as long as SpaceVim provides that option.

Reference

SpaceVim/SpaceVim#4545 (comment)

Other

I will update your question to Hack-SpaceVim documentation. Thank you for your question.

ViiEx commented

Works perfectly thank you a lot for the quick reply!!!!