Add rules for r'...' and other string literals in Python #35

kana opened this Issue Mar 29, 2012 · 3 comments


None yet
2 participants

kana commented Mar 29, 2012

  • Details of string literals in Python
  • There is nothing to do for r"..." and others.
  • Add rules only for r'...' and others. Because a rule to input English words such as Let's conflicts with r'...'.

sampsyo commented Apr 5, 2012

Here's what I added to my .vimrc for Python:

call smartinput#define_rule({
    \ 'at': '[ubr]\%#', 'char': '"', 'input': '""<Left>',
    \ 'filetype': ['python'] })
call smartinput#define_rule({
    \ 'at': '[ubr]\%#', 'char': "'", 'input': "''<Left>",
    \ 'filetype': ['python'] })

Literals of the form u"""x""" and r'''x''' are also valid, but they already work without any additional tweaking.

It would be awesome if these rules could be disabled if I'm inserting into a string literal or comment (so I can still type, for example, "you're" when I'm writing a comment), but I realize that might be out of scope for this plugin. (Great work, by the way -- I'm loving smartinput so far.)


kana commented Apr 6, 2012

Thank you for the rules and the idea! I'll include it later.

@kana kana closed this in 4099569 Apr 6, 2012

sampsyo commented Apr 6, 2012


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment