lundi 24 février 2020

Using if statement to execute different command based on a global variable value

I want to execute :set winminheight=1<cr>^W=^W_ if the value of variable winminheight is 0. else I want to run :set winminheight=0<cr>^W_

I tried below mapping script to accomplish this but it doesn't work. I get no error either.

nnoremap <silent>  <leader>0 
\ : if (&g:winminheight ==0) <BAR>
\   execute "normal! :set winminheight=1""\<lt>cr>^W=^W_" <BAR>
\ else <BAR>
\   execute "normal! :set winminheight=0""\<lt>cr>^W_" <BAR>
\ endif <CR>

When I call the mapping, it doesn't respond at all. Please help me to fix this.

Aucun commentaire:

Enregistrer un commentaire