Hello,

> I have the following map in my .vimrc
> 
> map _ <C-W>_
> 
> How can i make it so the map toggles <C-W>_  and <C-W>=?

In this particular case, the easier way to proceed is the following.

First, you need the actual mapping:
    :nnoremap <expr> _ (g:maximize_or_equalize ? ":wincmd_\<cr>" : 
":wincmd=\<cr>")

Then, some way to toggle the variable g:maximize_or_equalize:
    :let g:maximize_or_equalize=0
    :nnoremap <leader>_ :let g:maximize_or_equalize=1-g:maximize_or_equalize<cr>




However, as I always use gvim, I tend to prefer relying on a more 
"standardized" (as in: "every thing works this way on my systems) way to toggle 
g:maximize_or_equalize:
    :call lh#menu#def_toggle_item({
       \ "variable": "maximize_or_equalize", 
       \ "values": [0,1], 
       \ "menu":{"priority":"70.900", "name": "Window.Reorganize"}, 
       \ "texts": ["maximize", "equalize"]})

Which automatically provides the command:
    :Toggle WindowReorganize
and updates the menus to display the current option.

NB: this is a shameless advertisement of a vim librayry I'm maintaining: 
http://code.google.com/p/lh-vim/wiki/lhVimLib

HTH,


-- 
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to