Custom Functions in Vim

I am trying to define a user function in vim to change the current color scheme, and then override some theme options so that it works better with my transparent terminal configuration. I can't seem to find information on how to call set strings inside a function.

This conveys what I would like to accomplish:

 function SetColorscheme (colorscheme) set colorscheme a:colorscheme hi Normal ctermbg=NONE hi LineNr ctermbg=NONE endfunction 

And now I call it this way:

 :call SetColorscheme ('wombat256') 

Currently, vim complaining about missing parentheses.

What is the correct syntax for what I'm trying to do here?

+4
source share
1 answer

colorscheme is not an option that you use with the set command, it is its own command. So try this for the colorscheme line:

 execute 'colorscheme ' . a:colorscheme 
+7
source

Source: https://habr.com/ru/post/1388872/


All Articles