Vim Tips Wiki
No edit summary
 
(change "anon" author to blank; trim "created" date; minor manual clean)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{review}}
 
{{review}}
  +
{{TipImported
{{Tip
 
 
|id=196
 
|id=196
  +
|previous=195
|title=FileName Completion in Shell Scripts
 
  +
|next=197
|created=January 10, 2002 10:10
+
|created=2002
 
|complexity=basic
 
|complexity=basic
|author=vim_power
+
|author=
 
|version=5.7
 
|version=5.7
 
|rating=30/17
 
|rating=30/17
  +
|category1=
|text=
 
  +
|category2=
In shell scripts, you often define environment variables for diff directory names.
 
 
}}
 
In shell scripts, you often define environment variables for different directory names, for example:
  +
<pre>
 
JAVA_HOME=/opt/java/jdk1.4
 
PATH=/usr/local/bin:/bin....
  +
</pre>
   
 
Normally typing Ctrl-X Ctrl-F is used to complete FileName under cursor. But this does not work if used on lines given above.
i.e.
 
   
 
This is because Vim treats "=" sign as a valid filename character.
JAVA_HOME=/opt/java/jdk1.4
 
   
 
Since the actual possibility of "=" being in any filename is very less, this char can be removed from the list of valid filename char.
PATH=/usr/local/bin:/bin....
 
  +
<pre>
 
set isfname-==
  +
</pre>
   
 
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>
   
 
==Comments==
Normally typing Ctrl-X Ctrl-F is used to complete FileName under cursor.
 
 
For source code editors of Progress, based on this tip, I used
 
  +
<pre>
But this does not work if used on lines given above.
 
 
set isfname-={,}
 
  +
</pre>
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 u can easyly complete filenames using &lt;Ctrl-X&gt; &lt;Ctrl-F&gt;
 
 
Njoy
 
}}
 
 
== Comments ==
 
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}
 
and now my include files are pulled in automatically with gf when they are in the format {myinclude.i}
   
'''Anonymous'''
 
, September 17, 2002 7:41
 
----
 
Hi,
 
 
I have a question regarding this tip...
 
 
Suppose I want to escape the . (dot) how would i do it.
 
 
In Java I have many cases wherin the static methods are called directory.
 
 
For eg.: SomeClass.someMethod();
 
 
When I take my cursor over SomeClass, it tries to search the whole string - "SomeClass.someMethod()" in the path.
 
 
I tried to use the above tip: set isfname-=. but it didn't work. Any ideas?
 
 
--
 
Regards,
 
 
Suraj Amin
 
 
Homepage: http://www.geocities.com/suraj_amin/
 
 
/* May the source be with you */
 
 
 
 
suraj_amin--AT--yahoo.com
 
, June 15, 2004 20:31
 
----
 
Sorry for the typo... directory = directly.
 
Sometimes my hand and my mind are not in sync.
 
 
'''Anonymous'''
 
, June 15, 2004 21:11
 
 
----
 
----
<!-- parsed by vimtips.py in 0.531309 seconds-->
 

Latest revision as of 02:58, 4 December 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>

Comments[]

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}