By Tim Cook on Nov 12, 2012
From the Obscure Unix Admin Tip of the Day section...
If you occasionally edit files as root (I never do, I always use pfexec, wink wink), then you may have noticed that the vim (Vi Improved) editor that normally does filename completion via the <Tab> key now gives you something like:
when you try to open up /etc/motd with a little less typing
So, there are at least five solutions to this:
- Use <Ctrl>-E instead of <Tab>
- Use the "-N" flag when you start Vim
- :set wildchar=<Tab> (Enter those 5 characters, not an actual Tab)
- Use pfexec vim filename
- In Solaris 11.1 or later, use pfedit filename
The reason for this? It seems that when you are root, Vim sets it's "compatible" flag, which makes it behave more like its ancestor vi. In turn this makes Vim set 'wildchar' to <Ctrl>-E.
For more info, read the section you get when you enter :help cmdline-completion
Thanks to Darren for the tip on pfexec