Wikia

Vim Tips Wiki

Changes: FileName Completion in Shell Scripts

Edit

Back to page

(Remove html character entities)
(change "anon" author to blank; trim "created" date; minor manual clean)
 
Line 4: Line 4:
 
|previous=195
 
|previous=195
 
|next=197
 
|next=197
|created=January 10, 2002
+
|created=2002
 
|complexity=basic
 
|complexity=basic
|author=Anon
+
|author=
 
|version=5.7
 
|version=5.7
 
|rating=30/17
 
|rating=30/17
Line 13: Line 13:
 
}}
 
}}
 
In shell scripts, you often define environment variables for different directory names, for example:
 
In shell scripts, you often define environment variables for different directory names, for example:
 
 
<pre>
 
<pre>
 
JAVA_HOME=/opt/java/jdk1.4
 
JAVA_HOME=/opt/java/jdk1.4
Line 24: Line 23:
   
 
Since the actual possibility of "=" being in any filename is very less, this char can be removed from the list of valid filename char.
 
Since the actual possibility of "=" being in any filename is very less, this char can be removed from the list of valid filename char.
+
<pre>
set isfname-==
+
set isfname-==
  +
</pre>
   
 
Putting the above line in vimrc will remove "=" from the list of valid filename chars.
 
Putting the above line in vimrc will remove "=" from the list of valid filename chars.
Line 33: Line 32:
 
==Comments==
 
==Comments==
 
For source code editors of Progress, based on this tip, I used
 
For source code editors of Progress, based on this tip, I used
+
<pre>
set isfname-={,}
+
set isfname-={,}
  +
</pre>
   
 
and now my include files are pulled in automatically with gf when they are in the format {myinclude.i}
 
and now my include files are pulled in automatically with gf when they are in the format {myinclude.i}

Latest revision as of 02:58, December 4, 2009

Tip 196 Printable Monobook Previous Next

created 2002 · complexity basic · version 5.7


In shell scripts, you often define environment variables for different directory names, for example:

JAVA_HOME=/opt/java/jdk1.4
PATH=/usr/local/bin:/bin....

Normally typing Ctrl-X Ctrl-F is used to complete FileName under cursor. But this does not work if used on lines given above.

This is because Vim treats "=" sign as a valid filename character.

Since the actual possibility of "=" being in any filename is very less, this char can be removed from the list of valid filename char.

set isfname-==

Putting the above line in vimrc will remove "=" from the list of valid filename chars.

Thus you can easyly complete filenames using <Ctrl-X> <Ctrl-F>

CommentsEdit

For source code editors of Progress, based on this tip, I used

set isfname-={,}

and now my include files are pulled in automatically with gf when they are in the format {myinclude.i}


Around Wikia's network

Random Wiki