On Dec 7, 10:41 am, Dotan Cohen <[email protected]> wrote: > Dalker on StackOverflow [1] recently helped me concoct this terrific > exe for navigating xdebug traces: > :exe '/^.\{'.(col(".")-1).'\}-'. Before I use it, I must 0f- to ensure > that I am on the first dash of the line. I would like to map this all > to the ` key (I use ' for marks) but I seem to have trouble combining > the regular commands with the exe: > nmap 0f-:exe '/^.\{'.(col(".")-1).'\}-' > > Obviously I am missing something, but all my googling turns up > nothing. What keywords should I be googling, or what part of the fine > manual should I be reading? Thanks. >
First, your mapping command is missing a left-hand-side. You need to tell Vim what you want to press to trigger your mapping. E.g. nmap <F5> :echo 'foo'<CR> if you want to press the <F5> key to echo the text "foo" on your screen. Second, since you're starting from normal mode, you need to finish off your ex command with a <CR> or the equivalent <Enter>. Remember mappings are telling Vim to execute each character basically as if you typed them in yourself. You need to press <Enter> to finish executing a search manually, so your mapping needs to do this as well. Two suggestions, however: 1. Use nnoremap instead of nmap to avoid accidentially triggering any mappings while executing your mapping. 2. Use an expression mapping, which would allow you to eliminate the exe altogether. See :help :map-<expr>. -- 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
