Wednesday, May 7, 2014

Re: When is map useful (as apposed to noremap)

On 2014-05-07, James Wood wrote:
> If I understand correctly, map commands (nmap, imap...) allow the
> resulting action to be affected by any other key bindings that
> happen to have been made. On the other hand, their noremap
> counterparts act as if no other mappings have been made. I can't
> think of any situations where one would want the result to be
> affected by other bindings, since this would be very hard to
> maintain. Are plain maps used much? Why?

I don't know whether plain maps are used much, but here is one
example of their use from my ~/.vimrc.


" For the changelog.vim filetype plugin:
"
" Don't source it right away, but do so upon the Changelog
" opening mapping. This will also source our customizations
" ahead of it.
"
nmap <silent> <Leader>o :runtime! ftplugin/changelog.vim<CR><Leader>o


I wanted to have the <Leader>o mapping from the changelog.vim plugin
open a changelog file as it does after the plugin is sourced, but I
didn't want to source the plugin every time I opened Vim, partly as
a matter of principle and partly because of the time required by my
~/.vim/ftplugin/changelog.vim to find the appropriate changelog file.

Regards,
Gary

--
--
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/d/optout.

No comments:

Post a Comment