Usually when I code in Python, I have to create a dictionary, and I pres开发者_JS百科s "
once and it creates "|"
, being |
my cursor.
I'm using TAB
key in the snipMate plugin to use snippets. I would like to press tab, when inside quotes after writing a string, that "exits" the quotes, but mantain snipMate. Example:
"name|"
, and, pressing TAB, to become "name"|
. So, mainly, when in before a "
in closing quotes, after pressing tab (or other combination possibly, since tab would conflict with a plugin or something), put cursor one side at right. How should I do it?
delimitMate allows you to use shift-tab
to exit quotes (or any other delimiters).
To exit a delimiter I'll usually just use ctrl-o
, which puts me into normal mode for one action, then A
to append text after the delimiter.
This is likely not to be compatible with other plugins, but you can try the following:
~/.vimrc:
inoremap " "<c-r>=TriggerSnippet()<cr>
Wherever your snippets are defined for python add a snippit like this:
snippet "
"${1}"${2}
(the whitespace is a tab character, important when defining snippits)
This also may have probably has other side effects, I didn't test it too much.
精彩评论