Re: FW: elastic tabstops and gvim's GTK text widget

2006-10-30 Thread Peter Hodge

--- Nick Gravgaard [EMAIL PROTECTED] wrote:

 Hi Zdenek,
 
 On 30/10/06, Zdenek Sekera [EMAIL PROTECTED] wrote:
 
  Hi, Nick,
 
   -Original Message-
   From: [EMAIL PROTECTED]
   [mailto:[EMAIL PROTECTED] On Behalf Of Nick Gravgaard
   Sent: 19 October 2006 13:42
   To: vim-dev@vim.org
   Subject: elastic tabstops and gvim's GTK text widget
  
   Hi all,
  
   I am the creator of a mechanism called elastic tabstops (see
   nickgravgaard.com/elastictabstops/). Right now, my plan is to try and
   implement this in as many text widgets as possible so that the editors
   that use them will be able to easily add this as a feature. Since vim
   (well, gvim really) is my editor of choice I thought I'd start with
   that. Could someone tell me which GTK widget gvim uses and what
   problems they think I might encounter?
  
   Any other comments are also welcome.
  
 
  I went to your side and read all about it, sounds very
  (read *very*) interesting. I would surely love it.
  As a comment, I'd suggest you reconsider implementing it
  only for gvim+GTK (as that's what I understood from all
  I read). First, it will quite significantly limit number
  of people who would be interested (not all have GTK when
  you go outside Linux) second, some people just do not
  use gvim (I for one use almost only console vim, I can't
  get gvim running with pleasing fonts and if it is not pleasing
  to my eyes, I don't like it). You seem to see a big advantage
  is being able to use non-monospce fonts. Sure, it is an
  advantage (perhaps even a big one), however, one gets very
  far with monospaced fonts, and I feel lots of people
  would think that way. In other words, those who can/want
  to run non-monospaced, great!, but don't leave out all
  the rest of us who have accomodated themselves well with monospaced
  outside of your project.
 
  Brief: consider seriously also the console vim.
 
 I think you may be right - I have a feeling vim is probably just
 treating it's GTK widget in a similar way to how it treats a console.
 If that's true, adding proportional font support is probably a much
 bigger task than I would like to solve right now...
 
 BTW, does anyone know if it's possible to implement elastic tabstops
 as a vim script? It would need to be called whenever a character is
 inserted or deleted and would then modify the size of the tabstops.
 The tabstops would need to have different widths on different lines.
 Is this possible?

Actually, you might be able to get it done with Vimscript, but you'd need to
use space characters instead of tabs.  You would map TAB to call a function
which examines the current line, the line above, the line below, and inserts
the
correct number of spaces, and also adjusts the lines above or below
accordingly.  Also, if you're inserting spaces instead of tabs, it's backwards
compatible with just about everything, which would be great.

cheers,
Peter


Send instant messages to your online friends http://au.messenger.yahoo.com 


Re: FW: elastic tabstops and gvim's GTK text widget

2006-10-30 Thread Ilya Bobir

Peter Hodge wrote:

--- Nick Gravgaard [EMAIL PROTECTED] wrote:

  

Hi Zdenek,

On 30/10/06, Zdenek Sekera [EMAIL PROTECTED] wrote:


Hi, Nick,

  

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Nick Gravgaard
Sent: 19 October 2006 13:42
To: vim-dev@vim.org
Subject: elastic tabstops and gvim's GTK text widget

Hi all,

I am the creator of a mechanism called elastic tabstops (see
nickgravgaard.com/elastictabstops/). Right now, my plan is to try and
implement this in as many text widgets as possible so that the editors
that use them will be able to easily add this as a feature. Since vim
(well, gvim really) is my editor of choice I thought I'd start with
that. Could someone tell me which GTK widget gvim uses and what
problems they think I might encounter?

Any other comments are also welcome.



I went to your side and read all about it, sounds very
(read *very*) interesting. I would surely love it.
As a comment, I'd suggest you reconsider implementing it
only for gvim+GTK (as that's what I understood from all
I read). First, it will quite significantly limit number
of people who would be interested (not all have GTK when
you go outside Linux) second, some people just do not
use gvim (I for one use almost only console vim, I can't
get gvim running with pleasing fonts and if it is not pleasing
to my eyes, I don't like it). You seem to see a big advantage
is being able to use non-monospce fonts. Sure, it is an
advantage (perhaps even a big one), however, one gets very
far with monospaced fonts, and I feel lots of people
would think that way. In other words, those who can/want
to run non-monospaced, great!, but don't leave out all
the rest of us who have accomodated themselves well with monospaced
outside of your project.

Brief: consider seriously also the console vim.
  

I think you may be right - I have a feeling vim is probably just
treating it's GTK widget in a similar way to how it treats a console.
If that's true, adding proportional font support is probably a much
bigger task than I would like to solve right now...

BTW, does anyone know if it's possible to implement elastic tabstops
as a vim script? It would need to be called whenever a character is
inserted or deleted and would then modify the size of the tabstops.
The tabstops would need to have different widths on different lines.
Is this possible?



Actually, you might be able to get it done with Vimscript, but you'd need to
use space characters instead of tabs.  You would map TAB to call a function
which examines the current line, the line above, the line below, and inserts
the
correct number of spaces, and also adjusts the lines above or below
accordingly.  Also, if you're inserting spaces instead of tabs, it's backwards
compatible with just about everything, which would be great.
  

But how will you save information about where is a tab and where is a space?
You have to save tabs in a file on disk and in vim you'll have to 
remember where those tab were in some buffer local variable.

cheers,
Peter


Send instant messages to your online friends http://au.messenger.yahoo.com