SpaceVim
SpaceVim copied to clipboard
How about exposing some internal toggle functions?
I'm trying to enable some features by default when I open vim such as "highlight long lines" or "show trailing whitespaces", etc. But it is a bit painful to make it work nicely with Spacevim. For instance if I want to enable trailing whitespaces I have to call these three functions:
-
EnableWhitespace
-
SpaceVim#layers#core#statusline#toggle_section('whitespace')
-
SpaceVim#layers#core#statusline#toggle_mode('whitespace')
But that that's not enough to make it work nicely with SPC-t-8 as I cannot set the s:whitespace_enable
flag correctly.
It would be very convenient to be able to call Spacevim#layers#ui#toggle_whitespace
directly as this function wraps up the three calls mentioned above and sets the boolean flag correctly.
But if I understand correctly, the s:
prefix in the definition of toggle_whitespace
hides the function from outside the file.
So my questions are:
- is there already a way to enable Spacevim trailling whitespaces/highlight-long-lines/spell-checking programmatically (with all the status bar icons and stuff)?
- would you be okay to expose these functions so that we can call e.g.
Spacevim#layers#ui#toggle_whitespaces
from scripts?
we are going to implement cache major mode, but this is wip https://github.com/SpaceVim/SpaceVim/pull/3076
wsdjeg
I'm trying to enable some features by default when I open vim such as "highlight long lines" or "show trailing whitespaces", etc. But it is a bit painful to make it work nicely with Spacevim. For instance if I want to enable trailing whitespaces I have to call these three functions:
EnableWhitespace
SpaceVim#layers#core#statusline#toggle_section('whitespace')
SpaceVim#layers#core#statusline#toggle_mode('whitespace')
But that that's not enough to make it work nicely with SPC-t-8 as I cannot set the
s:whitespace_enable
flag correctly.It would be very convenient to be able to call
Spacevim#layers#ui#toggle_whitespace
directly as this function wraps up the three calls mentioned above and sets the boolean flag correctly. But if I understand correctly, thes:
prefix in the definition oftoggle_whitespace
hides the function from outside the file.So my questions are:
- is there already a way to enable Spacevim trailling whitespaces/highlight-long-lines/spell-checking programmatically (with all the status bar icons and stuff)?
- would you be okay to expose these functions so that we can call e.g.
Spacevim#layers#ui#toggle_whitespaces
from scripts?-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/SpaceVim/SpaceVim/issues/3555
I'd really like to be able to say the following in init.toml
:
default_whitespace_toggle = true
default_column_indicator_toggle = true
default_toggle_wrap_long_lines = true
and have all of these toggles enabled by default, instead of needing to do SPC t f
, SPC t w
and SPC t W
manually each time I open vim. Is there a workaround for this already?
edit: This is related to https://github.com/SpaceVim/SpaceVim/issues/2316 and https://github.com/SpaceVim/SpaceVim/issues/2316
@mironnn if you would like a hacky workaround, this should work - put your defaults into a macro in ~/.SpaceVim/vimrc and then call the macro. for example:
let @i=' tw tf'
:normal @i
@mironnn if you would like a hacky workaround, this should work - put your defaults into a macro in ~/.SpaceVim/vimrc and then call the macro. for example:
let @i=' tw tf' :normal @i
@lippirk thank you for your proposal. It is a workaround, but maybe there is another solution how to define toggle values in the config
#3076 add the cache feature for cache the result of SpaceVim#layers#core#statusline#toggle_mode
, but currently it does not support SpaceVim#layers#core#statusline#toggle_section
, so SPC t w
does not work, but SPC t s
SPC t p
etc should work.