Context-specific remap
- by dotancohen
I have the following handy VIM map:
inoremap ( ()<Left>
However, sometimes I will enter Insert mode to add a function call around a variable, like so:
Was: $sql = "SELECT * FROM " . $someTable;
To: $sql = "SELECT * FROM " . mysql_real_escape_string($someTable);
The mapping makes a redundant ) after mysql_real_escape_string(. Is there any way to refactor the mapping so that if there exists a character after the cursor, and the character after the cursor is not whitespace, then )<left> is not appended to (?
Thanks.