136272Re: vim: map a key to "conditionally" override built-in behavior
- Feb 19, 2013On 2/19/2013 4:20 AM, Paul Isambert wrote:
> You can use <expr> to define a mapping with a function:thanks!
> function! <SID>Map()
> if line(".") == 1 && wincol(".") == 1
> return ":q\r"
> return "h"
> nnoremap <expr> h <SID>Map()
I still don't fully understand the theory of this <SID> thing (even read
: help <SID>)
but per my test this doesn't work well.
it's weird that echo wincol() starting from 7, instead of 1, when I move
my cursor to the leftmost column.
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@....
For more options, visit https://groups.google.com/groups/opt_out.
- << Previous post in topic Next post in topic >>