views:

76

answers:

2

Usually when I code in Python, I have to create a dictionary, and I press " 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?

+1  A: 

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.

Randy Morris
Thanks for your suggestion Randy, but michaelmichael solution is simpler an delimitMate is a GREAT plugin.
Somebody still uses you MS-DOS
+1  A: 

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.

michaelmichael
This is great... Someone told me about this plugin, it solves my problem in an elegant way. Thanks!
Somebody still uses you MS-DOS
@michaelmichael: I've updated to the last version in it's git repository, and now this functionality is broken (it only works when I open a file without any extension). Do you know what can be?
Somebody still uses you MS-DOS
i'm afraid i don't. i'd recommend contacting the developer directly.
michaelmichael