7

Something funny is going on with my vim. I'm using it through xterm. I want to be able to autocomplete filenames that I try to open.

For example:

# Cursor is | character
:o exam|
:o exam|<TAB>
:o examplefile.txt|

I was sure vim supported this, but it's not working for me. When I hit <TAB> an ^I character is inserted instead of completing the filename:

:o exam|<TAB>
:o exam^I|
:o exam^I|<TAB>
:o exam^I^I|

However, <TAB> works fine in bash in xterm - it correctly completes filenames and doesn't expand to ^I.

Is my terminal configured incorrectly? Do I need some stty voodoo? Or is it something else entirely?

Edit

:e does work for me - seems like only :o doesn't...

nfm
  • 19,689
  • 15
  • 60
  • 90
  • For completeness: make sure you do not have compatible mode set (`:h 'cp'`) - auto-completion on command line works only when `:set nocp`. Some systems I have seen were shipped with /etc/vimrc containing `set cp`, making VIM to work more like a vi. – Dummy00001 Jun 29 '10 at 10:38

2 Answers2

6

:o is not really supported in vim. Try typing :h :o, you'll see this:

Vim does not support open mode, since it's not really useful. For those situations where ":open" would start open mode Vim will leave Ex mode, which allows executing the same commands, but updates the whole screen instead of only one line.

I think you're confusing :o and :e (they're not the same).

andereld
  • 86
  • 2
2

edit works for me:

:e exam|<TAB>
stefanB
  • 77,323
  • 27
  • 116
  • 141
  • Hrm... it works for me too! Any idea what the discrepancy with `:o` could be? – nfm Jun 29 '10 at 00:22
  • 1
    Seems that `:o` is not useful - whatever it was supposed to do, probably a legacy option, so has less functionality I guess ... I always use `:e` for `edit` files so I never noticed. – stefanB Jun 29 '10 at 05:12