vi / vim Auto complete File Name While Editing Files
Q. I use vi / vim as IDE (Integrated development environment) a software development system using Ubuntu Linux. How do I auto complete file name under vim / vi text editor while editing text file or java / c / python program? I can auto complete file nameunder bash shell by hitting [TAB] key.
A. Yes, it is quite frustrating when you are not able to open files immediately. There is no need to add any special command for this task. All you have to do is press [Tab] key to complete directory or file names just like bash command. For example, while coding html file, if you would like to open email.php, just type following (ESC + : + em + hit [TAB] key):
:e em[TAB]
To auto complete directory name again hit [TAB]:
:cd /e[tab]
For further information see help page, by typing following command:
:help path
This works with vim version 6.1 and above. If you are using old version add following to your ~/.vimrc file:
map ,e :e <C-R>=expand("%:p:h") . "/" <CR>
Save and close the file. Then when you type ,e in normal mode you can use tab to complete to the file.
E-mail this to a friend
Printable version
Related Other Helpful FAQs:
- Finding files in Linux filesystems
- How do I enable SQL *Plus Up and down arrow keys?
- Turn on or off color syntax highlighting in vi or vim
- Linux or Unix find and remove files with one find command on fly
- How do I Compress a Whole Linux or UNIX Directory?
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: BASH Shell, easy edit of files, file names, integrated development environment, Linux, python program, software development system, tab key, version 6, vi editor, vim, vim editor, ~/.vimrc




Recent Comments
Yesterday ~ 12 Comments
Yesterday ~ 7 Comments
Yesterday ~ 2 Comments
Yesterday ~ 3 Comments
Yesterday ~ 3 Comments