On Thu, 18 May 2006 at 10:08pm, cga2000 wrote:
> On Thu, May 18, 2006 at 08:23:00AM EDT, Benji Fisher wrote:
> > On Wed, May 17, 2006 at 07:50:08PM -0700, Suresh Govindachar wrote:
> > >
> > > cga2000 wrote:
> > >
> > > > But I was not thinking of these tab stops..
> > > > more in the line of typewriter stuff, I guess.
> > >
> > > Creating an imap involving the following
> > > operations might do the job:
> > >
> > > "---set up the typewriter style tab-stops---
> > > let twtabs=[3, 5, 10, 28, 40, 58]
> > > "---then imap <tab> to
> > > " something involving the following---
> > > let idx=0
> > > while (getpos('.')[2] >= twtabs[idx])
> > > let idx += 1
> > > endwhile
> > > "---then something like---
> > > cursor(0, twtabs[idx])
> > > "---or---
> > > normal (twtabs[idx] - getpos('.')[2])l
> > >
> > > --Suresh
> >
> > I already implemented that. See the VarTab() function in foo.vim
> > (my file of example vim functions):
> >
> > http://www.vim.org/script.php?script_id=72
> >
> Thanks. Will play with that too.
>
> I was wondering if another approach such as using a markup language
> that supports tables might not be preferable in the long run. What I
> mean by this is that it might be a little more difficult to start off
> with but might provide more control and facilities and end up being a
> more "portable" solution.
>
> html would be an obvious candidate but I suppose that there are others
> in the linux world?
>
> Is there any way I can split the screen and have the source version of a
> document written in a markup language in one window and the compiled
> version in the other? With a simple command or key combo that I could
> issue in the "source" window that would cause a refresh of what is
> displayed in the other window..? Or is vim just not suited for this
> kind of approach?
>
> Thanks,
>
> cga
If you have links installed, you can do this easily with the -dump
option. Here is a quick idea:
function! HtmlToTxt()
write
let filename = expand('%')
pedit %.txt
wincmd p
setl bufhidden=delete
exec 'silent! 1,$!links -dump '.filename
setl nomodified
wincmd p
endfunc
nnoremap <silent> <F12> :call HtmlToTxt()<CR>
E.g., if you have the following in a file:
<html>
<table border="1">
<tr>
<th>Number</th><th>Description</th>
</tr>
<tr>
<td>1</td><td>One</td>
</tr>
<tr>
<td>2</td><td>Two</td>
</tr>
<tr>
<td>3</td><td>Three</td>
</tr>
</table>
</html>
and press <F12>, you get the below in the preview window:
+----------------------+
| Number | Description |
|--------+-------------|
| 1 | One |
|--------+-------------|
| 2 | Two |
|--------+-------------|
| 3 | Three |
+----------------------+
To make your HTML table editing easier, you can have macros to insert new
rows and columns.
--
HTH,
Hari
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com