Sunday, November 3, 2013

Re: how to set a map for toggle _ and =?

Am 14.08.2013 11:43, schrieb Leonardo Barbosa:
> Hello all,
>
> 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>=?
>
> Thanks

~/.vim/plugin/equalmaxmap.vim

nnoremap <script> _ <SID>(store-win-height)<C-W>_<SID>(win-max-or-equal)

nnoremap <expr> <SID>(store-win-height) <sid>StoreWinHeight()
nnoremap <expr> <SID>(win-max-or-equal) <sid>LastWinHeight()==winheight(0) ? "<C-W>=" : "<C-W>_"

func! <sid>StoreWinHeight()
let s:winheight = winheight(0)
return ""
endfunc

func! <sid>LastWinHeight()
return s:winheight
endfunc

--
Andy

--
--
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: