1

I'm new to vim and I'm trying to figure out the key mapping. I've defined the following key map:

imap \i INSERT INTO <??> VALUES <??> ( <??> ); <??>
imap \j <Esc>/<??> <CR> ciw
map \j <Esc>/<??> <CR> ciw

when I hit \j vim is not able to find the <??> pattern after the semicolon in:

imap \i INSERT INTO <??> VALUES <??> ( <??> ); <??>

I get the following error:

E486: Pattern not found: <??> 

help will be appreciated :).

closed as off-topic by Herb Wolfe, Martin Tournoij May 6 '18 at 18:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers." – Herb Wolfe, Martin Tournoij
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Sorry newbie mistake. There were trailing spaces at the end of <??> I feel stupid now. – Claw May 6 '18 at 6:33
  • Just out of curiosity, what does this mapping do? How does it work? – Avi Mehenwal May 6 '18 at 13:06
  • 1
    Glad you asked. These mappings are for MySQL statements. when I perform the command \i while in insert mode (imap - insert mode mapping) it autofills with INSERT INTO <??> VALUES <??> ( <??> ); <??> and I've made the <??> so as to work like a bookmark. When I perform \j it searches for the pattern <??> and jumps me to the position and deletes the tags(ciw - change in word) so I can type in the values I want. – Claw May 7 '18 at 11:05
  • interesting use-case. Nice question. Hope somebody might be able to help here. I have been using crude vim abbreviations to put the SQL query construct on editor. Not very stylish and useful though, just makes sure you dont mess us with query syntax – Avi Mehenwal May 7 '18 at 14:36

Browse other questions tagged or ask your own question.