Tip #587: Preview current file in Mozilla through localhost
tip karma |
Rating 3/6, Viewed by 2175
|
created: |
|
October 14, 2003 20:30 |
|
complexity: |
|
intermediate |
author: |
|
Mark Woodward |
|
as of Vim: |
|
5.7 |
This is something I 'discovered' whilst trying to preview html or php files in mozilla using the apache server locally.
Put the path as the first line of a file wrapped in the appropriate comments.
eg: php:
<?php // http://localhost/examples/chapter02/vieworders2.php ?>
eg html:
<!-- http://localhost/examples/chapter02/orderform.html -->
Place the following mappings in your .vimrc file
" Typing <S-F12> will open the file in moz through the server.
nmap <S-F12> :sil! !start mozilla "<cfile>"<CR>
imap <S-F12> <esc>:sil! !start mozilla "<cfile>"<CR>i
As I'm working through Wellings PHP and MySQL Web Development I can use my tokens plugin to speed creating the first line as follows:
Add these as the string parts of the array:
(for php)
"phpf <?php // http://localhost/examples/chapter¤« chapter? »/¤« file name ».php ?>"
(for html)
"htmlf <!-- http://localhost/examples/chapter¤« chapter? »/¤« file name ».html -->"
then on the first line of the file if I type phpf <leader>et I'll only have to enter the chapter number and the filename without the extension. eg 04<cr> orders<cr>
This will insert:
<?php // http://localhost/examples/chapter04/orders.php ?>
Place the cursor anywhere on the file path, <S-F12> and the file will load (through apache) in moz.
Hope someone finds this useful,
Mark
<<Smarter Pasting |
How to sort using visual blocks >>
Additional Notes
|