Vim Tips Wiki
(adjust previous/next navigation + minor manual clean)
(Change <tt> to <code>, perhaps also minor tweak.)
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
|id=255
 
|id=255
 
|previous=254
 
|previous=254
|next=256
+
|next=258
 
|created=2002
 
|created=2002
 
|complexity=basic
 
|complexity=basic
Line 22: Line 22:
 
</pre>
 
</pre>
   
Now I can to simple {{tt|:tag file.jsp}} to quickly switch between the many .jsp files.
+
Now I can to simple <code>:tag file.jsp</code> to quickly switch between the many .jsp files.
   
The <tt>sort</tt> utility will use the value of LC_COLLATE to sort according to your locale. This will give Vim issues. On Unix based systems, try {{tt|1=LC_COLLATE=C sort}} instead of plain <tt>sort</tt>.
+
The <code>sort</code> utility will use the value of LC_COLLATE to sort according to your locale. This will give Vim issues. On Unix based systems, try <code>LC_COLLATE=C sort</code> instead of plain <code>sort</code>.
   
 
==Comments==
 
==Comments==
There's also the <tt>:find</tt> command and the path-option, with which one can easily switch between files in arbitrary directories.
+
There's also the <code>:find</code> command and the path-option, with which one can easily switch between files in arbitrary directories.
   
 
For example, if one sets
 
For example, if one sets
Line 43: Line 43:
 
Vim will :find any file under the current sub directory.
 
Vim will :find any file under the current sub directory.
   
Use <tt>:sfind</tt> (split find) to open the file in a new window.
+
Use <code>:sfind</code> (split find) to open the file in a new window.
   
 
----
 
----

Latest revision as of 12:30, 15 July 2012

Tip 255 Printable Monobook Previous Next

created 2002 · complexity basic · author Travis · version 6.0


I've started working with tomcat and many .jsp files. I find this trick to be very helpful.

find -name '*.jsp' -printf '%f\t%P\t1\n' |sort > jsp.tags

This will create a file called jsp.tags with tag entries for each .jsp file. Within Vim I use

:set tags+=jsp.tags

Now I can to simple :tag file.jsp to quickly switch between the many .jsp files.

The sort utility will use the value of LC_COLLATE to sort according to your locale. This will give Vim issues. On Unix based systems, try LC_COLLATE=C sort instead of plain sort.

Comments[]

There's also the :find command and the path-option, with which one can easily switch between files in arbitrary directories.

For example, if one sets

:set path+=/usr/include

on a Unix system one can do ":find stdio.h" to jump to the stdio-header file.

Recursive search is also possible by using the double-star:

:set path+=./**

Vim will :find any file under the current sub directory.

Use :sfind (split find) to open the file in a new window.