Re: Tables.

2006-05-22 Thread cga2000
On Sat, May 20, 2006 at 04:08:01PM EDT, Thomas Adam wrote:
 --- Hari Krishna Dara [EMAIL PROTECTED] wrote:
  It is a text browser like lynx, but does a better job of formatting
  tables and others. From my man page, the homepage should be:
 
 Of which I find 'Elinks' to do an even better job.  As usual, YMMV.
 
.. and has a more sensible name than 'links' - try googling on links..

I have switched from mozilla to Elinks and find it mature enough for
just about anything. Only drawback - at least in the version I am
running, is that it does not appear to support javascript.

Thanks,

cga


Re: Tables.

2006-05-22 Thread Hari Krishna Dara

On Tue, 23 May 2006 at 12:51am, cga2000 wrote:

 On Sat, May 20, 2006 at 04:08:01PM EDT, Thomas Adam wrote:
  --- Hari Krishna Dara [EMAIL PROTECTED] wrote:
   It is a text browser like lynx, but does a better job of formatting
   tables and others. From my man page, the homepage should be:
 
  Of which I find 'Elinks' to do an even better job.  As usual, YMMV.
 
 .. and has a more sensible name than 'links' - try googling on links..

 I have switched from mozilla to Elinks and find it mature enough for
 just about anything. Only drawback - at least in the version I am
 running, is that it does not appear to support javascript.

 Thanks,

 cga

From the screenshots, it seems like it does a great job of formatting
pages.

BTW, did you find my solution of using links -dump (or elinks -dump)
partially meeting your needs? I didn't see any feedback from you on
either this or the soft-tab-stop plugin that I sent before. I am curious
on which apprach you are finally going to adapt and why.

-- 
Thanks,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: Tables.

2006-05-22 Thread cga2000
On Sat, May 20, 2006 at 12:09:20AM EDT, Hari Krishna Dara wrote:
 
[..]
 
 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
 thNumber/ththDescription/th
   /tr
   tr
 td1/tdtdOne/td
   /tr
   tr
 td2/tdtdTwo/td
   /tr
   tr
 td3/tdtdThree/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.
 
Thanks, Hari,

This is very nice indeed. Took me about two minutes to set it up and run
the test and would appear to meet my requirements: I can get the
text-only rendering - without box characters - for a quick preview in
vim via a simple keyboard action and I could likely set up some other
macro/function that would launch Elinks or a graphical web browser for
different levels of rendering of my documents.

I need to dig into vim's function capabilities, see if I can have the
preview window full screen-height - or use normal vertical split instead
of the preview window - so I can have the html source and the basic
text-mode rendering thereof side-by-side.

The dilemma of course is choosing which markup language I should choose
(html, groff, latex, ..). I'm sure I could start one of those
never-ending threads if I asked something quite vague such as which
markup language is the best choice for the documenting dilettante.. or
something to that effect. :-)

Personally the main issue I have with html is that I find its syntax
rather illegible and quite difficult to type. But I'm sure there must be
quite a collection of vim tools to help your enter all these tags
rapidly.

Thank you very much.

cga

 -- 
 HTH,
 Hari
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com 


Re: Tables.

2006-05-20 Thread cga2000
On Fri, May 19, 2006 at 11:35:09PM EDT, Gary Johnson wrote:
 On 2006-05-19, cga2000 [EMAIL PROTECTED] wrote:
  On Fri, May 19, 2006 at 08:22:40AM EDT, Benji Fisher wrote:
   On Thu, May 18, 2006 at 10:08:53PM -0400, cga2000 wrote:

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?
   
It depends on what you mean by split the screen.  
  
  vim vertical split on an xterm. 
 
 If the compiled version is plain text, sure.  You could use an 
 autocommand with the BufWritePost event that would run the compiler 
 on your source file, switch vim windows, delete the existing 
 contents, and :read in the compiler output file.

Sounds pretty straight-forward.
 
 This will work with HTML and with man pages, with some limitations 
 on fonts and styles.
 
   If you want one window that has vim running in the bottom half and an
   HTML browser running in another, 
  
  yes.. pretty much what I had in mind.. another example: I'm writing a
  man page and I would like to work on the source in the left vim window
  and check the rendered man page in the right vim window:
  
  1. I make changes to my man page  save to disk
  2. I switch to the other window and hit the refresh key
  3. Now I can see the results of my changes
  4. Back to 1. above etc..
  
  In order to do this in vim you would probably need to be able to run a
  shell in a vim window - doesn't seem to be possible.
 
 You don't need a shell in a window, just do what I suggested above.  
 Or use a refresh key instead of an autocommand, if you prefer.
 
Yes, your description of the process is very clear. If I understand
correctly I would just need to direct the output of the compile command
to a temp file and cause vim to re-read it and display the updated
version.

 There is a plugin that lets you read man pages within vim.  You 
 could probably use this directly or adapt it to your needs.
 
I was just going to ask whether you could suggest something comparable
that I could adapt.. :-)

As it happens, the :Man  plugin is one of my favorites.
 
  It doesn't have to be html, though. Some very basic markup language
  that provides headers, paragraphs, lists, and tables and that could be
  easily translated to html, pdf, postscript, and simple text would be
  well-adapted to my needs. 
  
  No idea if linux has such a thing.
 
 Well, there is nroff.  

I have used it once in the past to write a test man page. Just taking
a look at how things work. And I don't remember running into any
problems.

 Man pages are actually written using nroff macros.  At least one
 implementation of the man command uses the following to format the
 pages it finds:
 
 tbl -TX file name | neqn | nroff -man | col -x

I don't remember a man page that has a table in it. I mean a table that
actually visualizes the cells with box drawing characters.
 
 The tbl command is used to format tables and the neqn command is used
 to format equations.
 
 Nroff does some things really well and some things not so well.  I
 think w3m does a better job of creating tables from HTML than tbl and
 nroff do from their source code.

I use mostly elinks and it also does a very good job of rendering HTML
tables. 
 
 Then there's latex, which I know nothing about other than it is
 supposedly a very nice typesetting language for everything from short
 letters to long dissertations and books.  A lot of people swear by it. 

Yes, I've used LyX in the past and it's rather nice. Don't know if
latex is quite suitable for the small documentation tasks I have in
mind but from what I have heard it's probably worth the effort. 
 
 HTH, Gary
 
Very much so.

Thanks,

cga


Re: Tables.

2006-05-19 Thread Benji Fisher
On Thu, May 18, 2006 at 10:08:53PM -0400, cga2000 wrote:
 
 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?

 It depends on what you mean by split the screen.  If you want one
window that has vim running in the bottom half and an HTML browser
running in another, you will have to look for some other program that
can embed both.  If you are content with [g]vim and a browser running in
separate windows, it should not be hard (depending on your OS) to have
vim save the current version and send the browser a command to re-load
the file.

HTH --Benji Fisher


Re: Tables.

2006-05-19 Thread cga2000
On Fri, May 19, 2006 at 08:22:40AM EDT, Benji Fisher wrote:
 On Thu, May 18, 2006 at 10:08:53PM -0400, cga2000 wrote:
  
  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?
 
  It depends on what you mean by split the screen.  

vim vertical split on an xterm. 

 If you want one window that has vim running in the bottom half and an
 HTML browser running in another, 

yes.. pretty much what I had in mind.. another example: I'm writing a
man page and I would like to work on the source in the left vim window
and check the rendered man page in the right vim window:

1. I make changes to my man page  save to disk
2. I switch to the other window and hit the refresh key
3. Now I can see the results of my changes
4. Back to 1. above etc..

In order to do this in vim you would probably need to be able to run a
shell in a vim window - doesn't seem to be possible.

 you will have to look for some other program that can embed both.  

I use gnu/screen and the one feature that I miss is that it does not
have vertical split. So I can't have my source and output side by side
visualising in one window the outcome of my changes in the other.

 If you are content with [g]vim and a browser running in separate
 windows, it should not be hard (depending on your OS) to have vim save
 the current version and send the browser a command to re-load the
 file.

It doesn't have to be html, though. Some very basic markup language
that provides headers, paragraphs, lists, and tables and that could be
easily translated to html, pdf, postscript, and simple text would be
well-adapted to my needs. 

No idea if linux has such a thing.

Thanks,

cga


Re: Tables.

2006-05-19 Thread Gary Johnson
On 2006-05-19, cga2000 [EMAIL PROTECTED] wrote:
 On Fri, May 19, 2006 at 08:22:40AM EDT, Benji Fisher wrote:
  On Thu, May 18, 2006 at 10:08:53PM -0400, cga2000 wrote:
   
   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?
  
   It depends on what you mean by split the screen.  
 
 vim vertical split on an xterm. 

If the compiled version is plain text, sure.  You could use an 
autocommand with the BufWritePost event that would run the compiler 
on your source file, switch vim windows, delete the existing 
contents, and :read in the compiler output file.

This will work with HTML and with man pages, with some limitations 
on fonts and styles.

  If you want one window that has vim running in the bottom half and an
  HTML browser running in another, 
 
 yes.. pretty much what I had in mind.. another example: I'm writing a
 man page and I would like to work on the source in the left vim window
 and check the rendered man page in the right vim window:
 
 1. I make changes to my man page  save to disk
 2. I switch to the other window and hit the refresh key
 3. Now I can see the results of my changes
 4. Back to 1. above etc..
 
 In order to do this in vim you would probably need to be able to run a
 shell in a vim window - doesn't seem to be possible.

You don't need a shell in a window, just do what I suggested above.  
Or use a refresh key instead of an autocommand, if you prefer.

There is a plugin that lets you read man pages within vim.  You 
could probably use this directly or adapt it to your needs.


 It doesn't have to be html, though. Some very basic markup language
 that provides headers, paragraphs, lists, and tables and that could be
 easily translated to html, pdf, postscript, and simple text would be
 well-adapted to my needs. 
 
 No idea if linux has such a thing.

Well, there is nroff.  Man pages are actually written using nroff 
macros.  At least one implementation of the man command uses the 
following to format the pages it finds:

tbl -TX file name | neqn | nroff -man | col -x

The tbl command is used to format tables and the neqn command is 
used to format equations.

Nroff does some things really well and some things not so well.  I 
think w3m does a better job of creating tables from HTML than tbl 
and nroff do from their source code.

Then there's latex, which I know nothing about other than it is 
supposedly a very nice typesetting language for everything from 
short letters to long dissertations and books.  A lot of people 
swear by it. 

HTH,
Gary

-- 
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
 | Spokane, Washington, USA


Re: Tables.

2006-05-19 Thread Hari Krishna Dara

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
thNumber/ththDescription/th
  /tr
  tr
td1/tdtdOne/td
  /tr
  tr
td2/tdtdTwo/td
  /tr
  tr
td3/tdtdThree/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 


Re: Tables.

2006-05-18 Thread Benji Fisher
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

HTH --Benji Fisher


Re: Tables.

2006-05-18 Thread Benji Fisher
On Wed, May 17, 2006 at 04:52:50PM -0400, cga2000 wrote:
 Does vim provide any form of native support for drawing tables?
 
 I have tried a couple of plugins and they don't seem to play well with
 my setup, presumably because I have temporarily switched my locale back
 from UTF-8 to en_US (due to problems with other applications that do are
 not yet utf8-ready).
 
 When in UTF-8 I was able to manually draw nice-looking tables to dress
 up text that I had previously formatted in rows and columns by using
 digraphs (Ctrl+K hh/vv etc..) and though there were some issues with
 printing I was all-in-all quite happy. 
 
 The functionalities I had in mind would probably do something like this:
 
 1. Assist text entry by letting you define tab stops,
 2. Let you select a column of text and justify it, 
 3. Provide some means of inserting vertical lines at each tab stop,
 4. Assist in creating horizontal lines by adding the ad hoc character
where a vertical and a horizontal line intersect, 
 5. Reformat the table frame when box drawing characters are not
available (replacing line intersections by '+' for instance).
 
 But then again I have little experience with vim and there is probably
 a vim way of doing this that I have not even imagined. So I am open
 to better strategies.

 You mention trying some plugins, but you did not say which ones, so
I do not know if you have already tried these suggestions.

 For (1) see my other post on this thread.  I think that Dr. C's
Align plugin can do (2) and his DrawIt plugin can help with the rest.

http://www.vim.org/scripts/script.php?script_id=294
http://www.vim.org/scripts/script.php?script_id=40

HTH --Benji Fisher


Re: Tables.

2006-05-18 Thread Hari Krishna Dara

On Thu, 18 May 2006 at 8:23am, 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

 HTH   --Benji Fisher


Oops... I searched for scripts and didn't find anything dealing with
this kind of tabs, so got curious and went ahead and wrote a small
plugin for this. I hope there is more to be offered in this, than your
VarTab() function, especially that there is a GUI tabstop setter, and it
maps Tab to insert the right number of spaces.

I am attaching the plugin, and hope to get some feedback. You need
genutils.vim also, and read the plugin header.

-- 
HTH,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com  softtabs.vim: Lookup filenames from tagfiles.
 Author: Hari Krishna (hari_vim at yahoo dot com)
 Last Change: 18-May-2006 @ 10:55
 Created: 17-May-2006
 Requires:Vim-7.0, genutils.vim(1.19)
 Version: 1.0.1
 Licence: This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License.
  See http://www.gnu.org/copyleft/gpl.txt 
 Download From:
 http://www.vim.org//script.php?script_id=
 Usage:
   - Use STEdit to bring up an editor for setting soft-tab stops (or to just
 view them). You would see two lines, one with numbers to guide you, and
 another to show the current tab stops. Use space bar or click with left
 mouse button to toggle tabstops. You can of course use any editor command
 to mark tabstops by replacing the space with a v (or even save/compose
 your tabstop lines somewhere and replace the whole line here). To save
 changes at the end, use :wq command (or just :w, to leave the window
 open).
   - Use STTgl to toggle using tabstops.
 TODO:
   - More testing.
   - A command to reset tab stops.
   - A command to add a tabstop at the current cursor position.
   - Do more with tabstops (investigate).

if exists('loaded_softtabs')
  finish
endif
if v:version  700
  echomsg 'softtabs: You need at least Vim 7.0'
  finish
endif
if !exists('loaded_genutils')
  runtime plugin/genutils.vim
endif
if !exists('loaded_genutils') || loaded_genutils  119
  echomsg 'softtabs: You need a newer version of genutils.vim plugin'
  finish
endif

let g:loaded_softtabs = 1

 Make sure line-continuations won't cause any problem. This will be restored
   at the end
let s:save_cpo = cpo
set cpovim

if !exists('s:myBufNum')
  let s:myBufNum = -1
  let s:windowName = '[Soft Tabs]'
  let s:tabstops = range(9, 80, 8)
endif

if (! exists(no_plugin_maps) || ! no_plugin_maps) 
  \ (! exists(no_softtabs_maps) || ! no_softtabs_maps)
  noremap script silent PlugSoftTabs :STEditCR
  inoremap script expr PlugSoftTabStop SIDFillToNextTab()

  if !hasmapto('PlugSoftTabs', 'n')
nmap unique silent F6 PlugSoftTabs
  endif
endif

command! STEdit :call SIDSetupSoftTabs()
command! STTgl :call SIDToggleSoftTabStop()

function! s:ToggleSoftTabStop()
  if maparg('Tab', 'i') == 'PlugSoftTabStop'
iunmap Tab
  else
imap Tab PlugSoftTabStop
  endif
endfunction

function! s:SetupSoftTabs()
  call s:SetupBuffer()
  call OptClearBuffer()
  call append(0, repeat(join(range(1,8), ''), 10))
  call append(1, repeat(' ', 80))
  silent! 3d _  The blank line.
  2
  for tst in s:tabstops
call s:ToggleMark(tst)
  endfor
  setl nomodified
endfunction

function! s:FillToNextTab()
   FIXME: Place holder
  return repeat(' ', 8)
  let curCol = col('.')
   Search for next column
  for col in s:tabstops
if curCol  col
  return repeat(' ', (col - curCol))
endif
  endfor
  return \Tab
endfunction

function! s:UpdateTabStops()
  if bufnr('%') == s:myBufNum
let tabstr = getline(2)
if tabstr != ''
  let s:tabstops = []
   Determine the tab stops.
  let tabl = split(tabstr, 'v', 1)
  let tabCnt = 0
  for ea in tabl
call add(s:tabstops, strlen(ea) + 1 +
  \ (tabCnt == 0 ? 0 : s:tabstops[tabCnt-1]))
let tabCnt = tabCnt + 1
  endfor
endif
  endif
  setl nomodified
endfunction

function! s:AddTabStop(col)
endfunction

function! 

Re: Tables.

2006-05-18 Thread cga2000
On Thu, May 18, 2006 at 01:55:03PM EDT, Hari Krishna Dara wrote:
 
 On Thu, 18 May 2006 at 8:23am, 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
 
  HTH --Benji Fisher
 
 
 Oops... I searched for scripts and didn't find anything dealing with
 this kind of tabs, so got curious and went ahead and wrote a small
 plugin for this. I hope there is more to be offered in this, than your
 VarTab() function, especially that there is a GUI tabstop setter, and it
 maps Tab to insert the right number of spaces.
 
 I am attaching the plugin, and hope to get some feedback. You need
 genutils.vim also, and read the plugin header.

Thanks to all. This was just a general question.. something I planned
to keep on the back burner for a while.. so I'm not sure when I will
have the time to look into this further. 

Saving this thread for later reference.

cga


Re: Tables.

2006-05-18 Thread 'cga2000'
On Wed, May 17, 2006 at 10:50:08PM EDT, 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

Thanks much, saving this for later.

cga


Re: Tables.

2006-05-18 Thread cga2000
On Thu, May 18, 2006 at 02:36:05AM EDT, Stano Sitar wrote:
 cga2000 napsal(a):
 
 The functionalities I had in mind would probably do something like this:
 
 1. Assist text entry by letting you define tab stops,
 2. Let you select a column of text and justify it, 
 3. Provide some means of inserting vertical lines at each tab stop,
 4. Assist in creating horizontal lines by adding the ad hoc character
where a vertical and a horizontal line intersect, 
 5. Reformat the table frame when box drawing characters are not
available (replacing line intersections by '+' for instance).
 
 Try program sc
 sc is an anicent spreadsheet calculator for console
 (text only, no mouse)
 It does everything you want, it is very small,
 it exists for number of platforms (for dos and Windows
 version look for gnuish collection)
 
 keybindings in sc are very vi-like
 
 You can make script that sends data from vim to sc,
 format data in sc and export them back to vim
 
 best regards
 Stanislav

Definitely the better strategy. I'll keep this in mind for when I have
more time to look into it. 

I downloaded it to take a look. Is there a some kind of user guide or
other resource that  might help getting started?

I also found another text-mode spreadsheet called slsc. Would you know
if either of these is still maintained and where I should go, should I
need some form of assistance?

Thanks,

cga


Re: Tables.

2006-05-18 Thread cga2000
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


Re: Tables.

2006-05-17 Thread A.J.Mechelynck

cga2000 wrote:

Does vim provide any form of native support for drawing tables?

I have tried a couple of plugins and they don't seem to play well with
my setup, presumably because I have temporarily switched my locale back
from UTF-8 to en_US (due to problems with other applications that do are
not yet utf8-ready).

When in UTF-8 I was able to manually draw nice-looking tables to dress
up text that I had previously formatted in rows and columns by using
digraphs (Ctrl+K hh/vv etc..) and though there were some issues with
printing I was all-in-all quite happy. 


The functionalities I had in mind would probably do something like this:

1. Assist text entry by letting you define tab stops,
  
Tabs stops in Vim are fixed-width; and it's usually a good idea to keep 
the hard tab width at 8, though it is possible to define soft tab 
stops (:h 'softtabstop') of a different width.
2. Let you select a column of text and justify it, 
3. Provide some means of inserting vertical lines at each tab stop,
  
I think that's possible using block visual mode, but I don't know the 
details.

4. Assist in creating horizontal lines by adding the ad hoc character
   where a vertical and a horizontal line intersect, 
5. Reformat the table frame when box drawing characters are not

   available (replacing line intersections by '+' for instance).

But then again I have little experience with vim and there is probably
a vim way of doing this that I have not even imagined. So I am open
to better strategies.

Thanks,

cga


  


See also
:help :s
:help line()
:help column()
:help sub-replace-special
etc.


Best regards,
Tony.


Re: Tables.

2006-05-17 Thread cga2000
On Wed, May 17, 2006 at 05:13:46PM EDT, A.J.Mechelynck wrote:
 cga2000 wrote:
 Does vim provide any form of native support for drawing tables?
 
 I have tried a couple of plugins and they don't seem to play well with
 my setup, presumably because I have temporarily switched my locale back
 from UTF-8 to en_US (due to problems with other applications that do are
 not yet utf8-ready).
 
 When in UTF-8 I was able to manually draw nice-looking tables to dress
 up text that I had previously formatted in rows and columns by using
 digraphs (Ctrl+K hh/vv etc..) and though there were some issues with
 printing I was all-in-all quite happy. 
 
 The functionalities I had in mind would probably do something like this:
 
 1. Assist text entry by letting you define tab stops,
   
 Tabs stops in Vim are fixed-width; and it's usually a good idea to keep 
 the hard tab width at 8, though it is possible to define soft tab 
 stops (:h 'softtabstop') of a different width.

ok. But I was not thinking of these tab stops.. more in the line of
typewriter stuff, I guess. Both regular tabs and soft tabs would
appear to be more useful for indentation than column formatting.

 2. Let you select a column of text and justify it, 
 3. Provide some means of inserting vertical lines at each tab stop,
   
 I think that's possible using block visual mode, but I don't know the 
 details.

that's pretty much how I was doing it manually - with a ':s' command.

 4. Assist in creating horizontal lines by adding the ad hoc character
where a vertical and a horizontal line intersect, 
 5. Reformat the table frame when box drawing characters are not
available (replacing line intersections by '+' for instance).
 
 But then again I have little experience with vim and there is probably
 a vim way of doing this that I have not even imagined. So I am open
 to better strategies.
 
 Thanks,
 
 cga
 
 
   
 
 See also
 :help :s
 :help line()
 :help column()
 :help sub-replace-special
 etc.

Probably some of the building blocks of the tools I'm looking for. 
 
 
 Best regards,
 Tony.

Thanks, much appreciated,

cga


RE: Tables.

2006-05-17 Thread Suresh Govindachar

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