<p>Surprisingly as you get good at vim, you can code even faster than standard IDEs such as Eclipse. But one thing I really miss is code completion, especially for long variable names and functions.</p>

<p>Is there any way to enable code completion for Perl in vim?</p>

[{'answer_id': 54108, 'author': 'Kris Erickson', 'author_id': 3798, 'author_profile': 'https://Stackoverflow.com/users/3798', 'pm_score': 6, 'selected': True, 'text': "<p><kbd>Ctrl</kbd>-<kbd>P</kbd> (Get Previous Match) and <kbd>Ctrl</kbd>-<kbd>N</kbd> (Get Next Match) are kind of pseudo code completion.  They basically search the file (Backwards for <kbd>Ctrl</kbd>-<kbd>P</kbd>, Forwards for <kbd>Ctrl</kbd>-<kbd>N</kbd>) you are editing (and any open buffers, and if you are using TAGS anything in your TAG file) for words that start with what you are typing and add a drop down list.  It works surprisingly well for variables and function names, even if it isn't intellisense.  Generally I use <kbd>Ctrl</kbd>-<kbd>P</kbd> as the variable or function I am looking for is usually behind in the code.  Also if you keep the same copy of Vim open, it will search the files you have previously opened.</p>\n"}, {'answer_id': 54111, 'author': 'Christian Oudard', 'author_id': 3757, 'author_profile': 'https://Stackoverflow.com/users/3757', 'pm_score': 3, 'selected': False, 'text': '<p>Well, Vim\'s generic completion mechanism is surprisingly good, just using <kbd>Ctrl</kbd>-<kbd>N</kbd> in insert mode. Also, line completion is very handy, using C-x C-l.</p>\n<p>Also check out this <a href="http://www.vim.org/scripts/script.php?script_id=556" rel="nofollow noreferrer">vim script for perl</a>.</p>\n'}, {'answer_id': 54116, 'author': 'Mark Biek', 'author_id': 305, 'author_profile': 'https://Stackoverflow.com/users/305', 'pm_score': 3, 'selected': False, 'text': '<p>Vim 7 supports omni completion.</p>\n<p>For example, I have this in my vimrc</p>\n<pre><code>autocmd FileType php set omnifunc=phpcomplete#CompletePHP\n</code></pre>\n<p>and then, when I press <kbd>Ctrl</kbd>-<kbd>X</kbd> <kbd>Ctrl</kbd>-<kbd>O</kbd> in Insert mode, I get a dropdown list of autocomplete possibilities.</p>\n<p>Here\'s an omnicfunc <a href="http://www.vim.org/scripts/script.php?script_id=1924" rel="nofollow noreferrer">for perl</a>.  No idea how well it works though.</p>\n'}, {'answer_id': 54117, 'author': 'Matthew Watson', 'author_id': 3839, 'author_profile': 'https://Stackoverflow.com/users/3839', 'pm_score': 2, 'selected': False, 'text': '<p><kbd>Ctrl</kbd>+<kbd>N</kbd></p>\n\n<p>This is explained in the Perl Hacks book, along with how to do Package completion. Highly recommended.</p>\n'}, {'answer_id': 63516, 'author': 'indentation', 'author_id': 7706, 'author_profile': 'https://Stackoverflow.com/users/7706', 'pm_score': 2, 'selected': False, 'text': '<p>You should look at the SuperTab plugin:\n<a href="http://www.vim.org/scripts/script.php?script_id=1643" rel="nofollow noreferrer">http://www.vim.org/scripts/script.php?script_id=1643</a>\nIt let\'s you do completion (either the OmniCompletion or the regular completion) using tab and shift-tab instead of ^N and ^P.</p>\n'}, {'answer_id': 72727, 'author': 'Matt Siegman', 'author_id': 12299, 'author_profile': 'https://Stackoverflow.com/users/12299', 'pm_score': 2, 'selected': False, 'text': '<p>The .vimrc clip in one of the other answers is slightly wrong. To turn your tab key into an auto-complete key, use this code:</p>\n\n<pre><code>inoremap &lt;tab&gt; &lt;c-r&gt;=InsertTabWrapper()&lt;cr&gt;\n\nfunction! InsertTabWrapper()\n    let col = col(\'.\') - 1\n    if !col || getline(\'.\')[col - 1] !~ \'\\k\'\n        return "\\&lt;tab&gt;"\n    else\n        return "\\&lt;c-p&gt;"\n    endif\nendfunction\n</code></pre>\n\n<p>You can find this, and tons of other vim tricks <a href="http://perlmonks.org/?node_id=540167" rel="nofollow noreferrer" title=".vimrc for perl programmers">in this thread at Perlmonks</a>--which links to even more threads with lots more customizations.</p>\n'}, {'answer_id': 75131, 'author': 'Mark Grimes', 'author_id': 13233, 'author_profile': 'https://Stackoverflow.com/users/13233', 'pm_score': 3, 'selected': False, 'text': '<p>The standard <kbd>Ctrl</kbd>+<kbd>N</kbd> and <kbd>Ctrl</kbd>+<kbd>P</kbd> works even better if you add the following to your <code>~/.vim/ftplugin/perl.vim</code> file:</p>\n<pre><code>set iskeyword+=:\n</code></pre>\n<p>Then it will autocomplete module names, etc.</p>\n'}, {'answer_id': 1810381, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p><a href="https://github.com/c9s/perlomni.vim" rel="nofollow noreferrer">https://github.com/c9s/perlomni.vim</a></p>\n'}]
['https://Stackoverflow.com/questions/54104', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4639/']