Vim Tips Wiki
(Manual import and fix of a tip that had an invalid title)
 
(Change <tt> to <code>, perhaps also minor tweak.)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  +
{{delete|This should be deleted in favor of [[Compiling LaTeX from Vim]], which has much better methods of compiling.}}
{{review}}
 
  +
{{TipImported
{{Tip
 
 
|id=469
 
|id=469
  +
|previous=468
|title=Replace the file name extension
 
  +
|next=471
|created=May 2, 2003 5:22
+
|created=2003
 
|complexity=basic
 
|complexity=basic
 
|author=Vincent NAUDOT
 
|author=Vincent NAUDOT
 
|version=5.7
 
|version=5.7
 
|rating=0/9
 
|rating=0/9
  +
|category1=LaTeX
|text=
 
  +
|category2=
 
}}
 
}}
 
 
Here is a map allowing you to press "\'" in insert mode. It saves the current tex file, then compiles it.
 
Here is a map allowing you to press "\'" in insert mode. It saves the current tex file, then compiles it.
   
map! \' &lt;Esc&gt;:w&lt;CR&gt;:! latex %&lt;CR&gt;i
+
map! \' <Esc>:w<CR>:! latex %<CR>i
   
You may wonder how to open the associated dvi file. Simply replace '''%''' with '''%&lt;.dvi''' to give:
+
You may wonder how to open the associated dvi file. Simply replace '''%''' with '''%<.dvi''' to give:
   
map! &lt;F4&gt; &lt;Esc&gt;:! xdvi %&lt;.dvi &lt;CR&gt;i
+
map! <F4> <Esc>:! xdvi %<.dvi <CR>i
 
"Or (if using K environment):
 
"Or (if using K environment):
map! &lt;F4&gt; &lt;Esc&gt;:! kdvi %&lt;.dvi &lt;CR&gt;
+
map! <F4> <Esc>:! kdvi %<.dvi <CR>
   
 
The same thing applies for any other extension. The following will open the associated ps file with gv.
 
The same thing applies for any other extension. The following will open the associated ps file with gv.
map! &lt;F5&gt; &lt;Esc&gt;:! gv %&lt;.ps &lt;CR&gt;i
+
map! <F5> <Esc>:! gv %<.ps <CR>i
   
== Comments ==
+
==Comments==
This is deprecated, the preferred form is %:r
+
This is deprecated, the preferred form is <code>%:r</code>
   
 
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.
 
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.
Line 32: Line 33:
   
 
----
 
----
There is the vim-latex-project:
+
There is the vim-latex-project: http://vim-latex.sourceforge.net/
 
http://vim-latex.sourceforge.net/
 
   
 
If you install that in your ~/.vim you will have a ''lot'' of improvments over the map. \ll compiles your .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 install that in your ~/.vim you will have a ''lot'' of improvments over the map. \ll compiles your .tex-file, \lv shows you the .dvi. `d give you \delta, and `D gives you \Delta. There is so much, just check it out!
   
 
----
 
----
[[Category:LaTeX]]
 

Latest revision as of 05:32, 13 July 2012


Tip 469 Printable Monobook Previous Next

created 2003 · complexity basic · author Vincent NAUDOT · version 5.7


Here is a map allowing you to press "\'" in insert mode. It saves the current tex file, then compiles it.

map! \' <Esc>:w<CR>:! latex %<CR>i

You may wonder how to open the associated dvi file. Simply replace % with %<.dvi to give:

map! <F4> <Esc>:! xdvi %<.dvi <CR>i
"Or (if using K environment):
map! <F4> <Esc>:! kdvi %<.dvi <CR>

The same thing applies for any other extension. The following will open the associated ps file with gv.

map! <F5> <Esc>:! gv %<.ps <CR>i

Comments[]

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.

:help filename-modifers


There is the vim-latex-project: http://vim-latex.sourceforge.net/

If you install that in your ~/.vim you will have a lot of improvments over the map. \ll compiles your .tex-file, \lv shows you the .dvi. `d give you \delta, and `D gives you \Delta. There is so much, just check it out!