Conditional parameters in .vimrc for a schema

I want to switch parens color combinations in vim when I edit the / lisp schema file. How can I conditionally run something in my .vimrc?

Sort of:

if syntax == scheme: RainbowParenthesesToggle 

EDIT: I am currently activating it manually

 :RainbowParenthesesToggle 
+4
source share
2 answers

Use autocmd based on the scheme file type:

 autocmd FileType scheme RainbowParenthesesToggle 

Or based on the plugin documentation , RainbowParenthesesLoadRound , to initialize it for () in particular:

 autocmd FileType scheme RainbowParenthesesLoadRound 
+4
source

If you want to use automatic commands, you can follow @MichaelBerkowski's tips. However, if you prefer, you can also do the following:

 if (&ft == 'scheme') :RainbowParenthesesToggle " Toggle it on/off :RainbowParenthesesLoadRound " (), the default when toggling :RainbowParenthesesLoadSquare " [] :RainbowParenthesesLoadBraces " {} :RainbowParenthesesLoadChevrons " <> endif 

&ft means filetype, so you can access this variable to find out the current buffer file type. Check :h ft for more information.

Of course, you can also have various automatic commands inside this if statement if you want to refine it a bit more or more if you want, whatever you want.

Remember that brackets are optional, I just want to use them. :)

+3
source

All Articles