0

Perl and C/C++ have perl-support.vim and c.vim by Fritz Mehner http://www.vim.org/account/profile.php?user_id=169

that support a very convenient auto completion shortcut in visual mode (e.g \aw for While construct or \ai for if else construct).

Does anybody know if such a comprehensive scripts also exist for Python?

python.vim doesn't seem to suppor this kind of auto completion.

0

1 Answer 1

1

Autocompletion is automatic: it happens without you doing anything.

What you want is not "autocompletion" but it can be achieved with varying levels of usefulness in a multitude of ways: insert mode mappings, abbreviations or full blown snippet expansion plugins like snipmate (abandoned original, maintained fork) or ultisnips.

I recommend the later option. This is a snipmate snippet:

# For
snippet for
    for ${1:item} in ${2:items}:
        ${3:code...}

When you type for<Tab>, the snippet is expanded to:

for [item] in items:
    code...

item is highlighted, ready to be changed to whatever you want and further <Tab>s jump you to items and code...:

for foo in [items]:
    code...

for foo in bar:
    [code...]

for foo in bar:
    print foo

This is by far the most flexible option.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.