sponsor Vim development Vim logo Vim Book Ad

basic Tip #469: The use of  %< instead of %

 tip karma   Rating 0/9, Viewed by 2178 

created:   May 2, 2003 5:22      complexity:   basic
author:   Vincent NAUDOT      as of Vim:   5.7

This tips is for vim or gvim user. We know the following map

map! /' ^[:w^M:! latex %^Mi

is doing the following. By typing "/'" in insert mode, this
will save the current tex file, and compile it.
The reader understand that one can change "/'" by anything he want,
as long as it does not bug its own configuration, I like this map 'cause
on an english keyboard both / and  ' are close to eachother.

We may wonder
what to do if we wish to open the associated dvi file?!
Indeed one has to replace % by %<.dvi and then we get

map! <F4> ^[:! xdvi %<.dvi ^Mi
or
map! <F4> ^[:! kdvi %<.dvi ^M
if you are using K environement.

The same thing apply indeed for any other extension i.e.,
the map
map! <F5> ^[:! gv %<.ps ^Mi
will open the associated ps file with gv.

 rate this tip  Life Changing Helpful Unfulfilling 

<<display date-and-time on status line | Map to quickly swap/exchange arbitrary text >>

Additional Notes

blah at blah.com, May 4, 2003 8:59
nice one,  but realise this is deprecated, the preferred form is %:r

And in fact there's a whole bunch more things you can do than just remove the extension - you can remove the directory/path, keep just the extension, etc etc by using different ':' modifiers.

:he filename-modifers
cniehaus at kde.org, May 8, 2003 6:26
There is the vim-latex-project:

http://vim-latex.sourceforge.net/

If you install that in your ~/.vim you will have _a lot_ improvments all over the map. \ll compiles you .tex-file,
\lv shows you the .dvi. `d give you \delta and `D gives you \Delta. There is so much, just check it out!
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to [email protected] after searching the archive. Help Bram help Uganda.
Sponsored by Web Concept Group Inc. SourceForge Logo