Loading ...
Sorry, an error occurred while loading the content.

Re: Implementation of script support for non-uniform tabstops

Expand Messages
  • Ben Fritz
    ... I did a little thinking about this. Obviously there is not a good way to STORE these non-uniform tabstops on a line-by-line basis in a file. But maybe
    Message 1 of 12 , Nov 18, 2012
    • 0 Attachment
      On Sunday, November 18, 2012 4:23:29 PM UTC-6, Nick Gravgaard wrote:
      > > > I am aware that elastic tabstops is not something many people use
      >
      > > > (yet). Still, for me it is a very nice feature to use with a gedit
      >
      > > > plugin, but since my favourite editor is vim, I was hoping that
      >
      > > > support for this might appear here, in the form of introducing
      >
      > > > non-uniform tabstop support.
      >
      > >
      >
      > > A quick search of this list tells me that there is a patch for elastic
      >
      > > tabstops floating around.
      >
      >
      >
      > I'd love to see elastic tabstops get added to Vim, but if it's not going to get added to the main code base, could we at least have the ability to set non-uniform tabstops on different lines? Many text widgets have this functionality now, so it's a shame that Vim cannot do this yet. Not only would this make elastic tabstops easier to implement, but it would also be useful for the implementation of many other table and layout related features.
      >
      >

      I did a little thinking about this. Obviously there is not a good way to STORE these non-uniform tabstops on a line-by-line basis in a file.

      But maybe there could be 2 new features that could combine together to create the ability to do things like elastic tabstops or tables in the middle of text nicely, without backwards-incompatible changes and keeping in the spirit of other Vim options:

      1. Implement variable-width tabstops by allowing a comma-separated list to be used as a value for 'tabstop'. For example, setting ts=4,2,8 would have the first tab in the line stop at column 4, the next stop at column 6, and all other tabs stop at 14, 22, 30, ...
      2. Implement a 'tabstopexpr' option which would be set to an expression giving the value of 'tabstop' to use for v:lnum (which could potentially be a different comma-separated list for each line depending on context)

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Nick Gravgaard
      ... This sounds interesting. Are there any other Vim settings that work on different lines? If so, how do they work? -- You received this message from the
      Message 2 of 12 , Nov 19, 2012
      • 0 Attachment
        On Mon, Nov 19, 2012, at 0:28, Ben Fritz wrote:
        > On Sunday, November 18, 2012 4:23:29 PM UTC-6, Nick Gravgaard wrote:
        > > > > I am aware that elastic tabstops is not something many people use
        > > > > (yet). Still, for me it is a very nice feature to use with a gedit
        > > > > plugin, but since my favourite editor is vim, I was hoping that
        > > > > support for this might appear here, in the form of introducing
        > > > > non-uniform tabstop support.
        > > >
        > > > A quick search of this list tells me that there is a patch for elastic
        > > > tabstops floating around.
        > >
        > > I'd love to see elastic tabstops get added to Vim, but if it's not going to get added to the main code base, could we at least have the ability to set non-uniform tabstops on different lines? Many text widgets have this functionality now, so it's a shame that Vim cannot do this yet. Not only would this make elastic tabstops easier to implement, but it would also be useful for the implementation of many other table and layout related features.
        >
        > I did a little thinking about this. Obviously there is not a good way to
        > STORE these non-uniform tabstops on a line-by-line basis in a file.
        >
        > But maybe there could be 2 new features that could combine together to
        > create the ability to do things like elastic tabstops or tables in the
        > middle of text nicely, without backwards-incompatible changes and keeping
        > in the spirit of other Vim options:
        >
        > 1. Implement variable-width tabstops by allowing a comma-separated list
        > to be used as a value for 'tabstop'. For example, setting ts=4,2,8 would
        > have the first tab in the line stop at column 4, the next stop at column
        > 6, and all other tabs stop at 14, 22, 30, ...
        > 2. Implement a 'tabstopexpr' option which would be set to an expression
        > giving the value of 'tabstop' to use for v:lnum (which could potentially
        > be a different comma-separated list for each line depending on context)

        This sounds interesting. Are there any other Vim settings that work on
        different lines? If so, how do they work?

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Ben Fritz
        ... The ones that come to mind immediately are indentexpr and foldexpr, and to a lesser extent formatexpr. I think indentexpr is the most similar to what
        Message 3 of 12 , Nov 19, 2012
        • 0 Attachment
          On Monday, November 19, 2012 7:43:32 AM UTC-6, Nick Gravgaard wrote:
          > > But maybe there could be 2 new features that could combine together to
          >
          > > create the ability to do things like elastic tabstops or tables in the
          >
          > > middle of text nicely, without backwards-incompatible changes and keeping
          >
          > > in the spirit of other Vim options:
          >
          > >
          >
          > > 1. Implement variable-width tabstops by allowing a comma-separated list
          >
          > > to be used as a value for 'tabstop'. For example, setting ts=4,2,8 would
          >
          > > have the first tab in the line stop at column 4, the next stop at column
          >
          > > 6, and all other tabs stop at 14, 22, 30, ...
          >
          > > 2. Implement a 'tabstopexpr' option which would be set to an expression
          >
          > > giving the value of 'tabstop' to use for v:lnum (which could potentially
          >
          > > be a different comma-separated list for each line depending on context)
          >
          >
          >
          > This sounds interesting. Are there any other Vim settings that work on
          >
          > different lines? If so, how do they work?

          The ones that come to mind immediately are indentexpr and foldexpr, and to a lesser extent formatexpr. I think indentexpr is the most similar to what tabstopexpr would do.

          AFAIK for indentexpr and foldexpr, Vim evaluates the expression on every line starting at the first, setting v:lnum to the line being evaluated for each line. Normally a user sets the expression to a function, like ":set indentexpr=MyFunIndent(v:lnum)".

          If these two options were to be implemented, I imagine elastic tabstops could be done fairly simply in vimscript by using getline() to get some context around v:lnum and returning an appropriate string for the tabstops in the line.

          I have no idea how complex these two options would be to implement.

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Matthew Winn
          On Sun, 18 Nov 2012 16:28:19 -0800 (PST), Ben Fritz ... I implemented a patch to do this a few years ago, when I was out of work and decided to grab something
          Message 4 of 12 , Nov 19, 2012
          • 0 Attachment
            On Sun, 18 Nov 2012 16:28:19 -0800 (PST), Ben Fritz
            <fritzophrenic@...> wrote:

            > 1. Implement variable-width tabstops by allowing a comma-separated list to be used as a value for 'tabstop'. For example, setting ts=4,2,8 would have the first tab in the line stop at column 4, the next stop at column 6, and all other tabs stop at 14, 22, 30, ...

            I implemented a patch to do this a few years ago, when I was out of
            work and decided to grab something off the TODO list to keep me busy.
            (It's since been taken over by someone else.) During the initial
            discussion it was decided that it wasn't a good idea to have multiple
            values in the "tabstop" option in case someone tried to treat its
            value as a number, so I eventually settled on "vartabstop" as the name
            of the option.

            --
            Matthew Winn

            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • Christian Brabandt
            ... Thanks for your work. Are you still maintaining this patch? Or where can one find the latest patch. I found one patch against Vim 7.1 I think, but I
            Message 5 of 12 , Nov 19, 2012
            • 0 Attachment
              On Mon, November 19, 2012 17:21, Matthew Winn wrote:
              > On Sun, 18 Nov 2012 16:28:19 -0800 (PST), Ben Fritz
              > <fritzophrenic@...> wrote:
              >
              >> 1. Implement variable-width tabstops by allowing a comma-separated list
              >> to be used as a value for 'tabstop'. For example, setting ts=4,2,8 would
              >> have the first tab in the line stop at column 4, the next stop at column
              >> 6, and all other tabs stop at 14, 22, 30, ...
              >
              > I implemented a patch to do this a few years ago, when I was out of
              > work and decided to grab something off the TODO list to keep me busy.
              > (It's since been taken over by someone else.) During the initial
              > discussion it was decided that it wasn't a good idea to have multiple
              > values in the "tabstop" option in case someone tried to treat its
              > value as a number, so I eventually settled on "vartabstop" as the name
              > of the option.

              Thanks for your work. Are you still maintaining this patch? Or where can
              one find the latest patch. I found one patch against Vim 7.1 I think,
              but I figured, it probably doesn't apply anymore and it was pretty big.

              I think, once this patch is included, adding a 'tabstopexpr' setting isn't
              much work. That should be reasonable, just replace a bunch of buf->b_p_ts
              by a call to a function which returns the tabstop setting.

              regards,
              Christian

              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • Lech Lorens
              ... It might be me that Matt is referring to as a person that took over maintaining the feature. In fact I only updated the patch to be applicable to the
              Message 6 of 12 , Nov 19, 2012
              • 0 Attachment
                On 19 November 2012 18:02, Christian Brabandt <cblists@...> wrote:
                > On Mon, November 19, 2012 17:21, Matthew Winn wrote:
                >> I implemented a patch to do this a few years ago, when I was out of
                >> work and decided to grab something off the TODO list to keep me busy.
                >> (It's since been taken over by someone else.) During the initial
                >> discussion it was decided that it wasn't a good idea to have multiple
                >> values in the "tabstop" option in case someone tried to treat its
                >> value as a number, so I eventually settled on "vartabstop" as the name
                >> of the option.
                >
                > Thanks for your work. Are you still maintaining this patch? Or where can
                > one find the latest patch. I found one patch against Vim 7.1 I think,
                > but I figured, it probably doesn't apply anymore and it was pretty big.

                It might be me that Matt is referring to as a person that took over
                maintaining the feature. In fact I only updated the patch to be
                applicable to the source code of Vim as of 2010. Look for the branch
                called feat/var-tabstops in vim_extended at repo.or.cz:
                http://repo.or.cz/w/vim_extended.git

                Cheers,
                Lech

                --
                You received this message from the "vim_dev" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              • Christian Brabandt
                Hi Lech! ... I thought that Repo was closed by Markus some time ago. Anyhow, at a first look, it looks like it is still active (although unmaintained), but it
                Message 7 of 12 , Nov 19, 2012
                • 0 Attachment
                  Hi Lech!

                  On Mo, 19 Nov 2012, Lech Lorens wrote:

                  > On 19 November 2012 18:02, Christian Brabandt <cblists@...> wrote:
                  > > On Mon, November 19, 2012 17:21, Matthew Winn wrote:
                  > >> I implemented a patch to do this a few years ago, when I was out of
                  > >> work and decided to grab something off the TODO list to keep me busy.
                  > >> (It's since been taken over by someone else.) During the initial
                  > >> discussion it was decided that it wasn't a good idea to have multiple
                  > >> values in the "tabstop" option in case someone tried to treat its
                  > >> value as a number, so I eventually settled on "vartabstop" as the name
                  > >> of the option.
                  > >
                  > > Thanks for your work. Are you still maintaining this patch? Or where can
                  > > one find the latest patch. I found one patch against Vim 7.1 I think,
                  > > but I figured, it probably doesn't apply anymore and it was pretty big.
                  >
                  > It might be me that Matt is referring to as a person that took over
                  > maintaining the feature. In fact I only updated the patch to be
                  > applicable to the source code of Vim as of 2010. Look for the branch
                  > called feat/var-tabstops in vim_extended at repo.or.cz:
                  > http://repo.or.cz/w/vim_extended.git

                  I thought that Repo was closed by Markus some time ago. Anyhow, at a
                  first look, it looks like it is still active (although unmaintained),
                  but it seems to be seriously broken, at least I get a lot of

                  404 Not Found - Missing one of the blob diff parameters

                  errors.

                  regards,
                  Christian
                  --

                  --
                  You received this message from the "vim_dev" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                • Lech Lorens
                  ... Hi Christian, I guess this is a problem with the web interface at repo.or.cz, not with the git repository itself. I cloned the repository without any
                  Message 8 of 12 , Nov 19, 2012
                  • 0 Attachment
                    On 19 November 2012 19:50, Christian Brabandt <cblists@...> wrote:
                    > Hi Lech!
                    >
                    > On Mo, 19 Nov 2012, Lech Lorens wrote:
                    >> It might be me that Matt is referring to as a person that took over
                    >> maintaining the feature. In fact I only updated the patch to be
                    >> applicable to the source code of Vim as of 2010. Look for the branch
                    >> called feat/var-tabstops in vim_extended at repo.or.cz:
                    >> http://repo.or.cz/w/vim_extended.git
                    >
                    > I thought that Repo was closed by Markus some time ago. Anyhow, at a
                    > first look, it looks like it is still active (although unmaintained),
                    > but it seems to be seriously broken, at least I get a lot of
                    >
                    > 404 Not Found - Missing one of the blob diff parameters
                    >
                    > errors.
                    >
                    > regards,
                    > Christian

                    Hi Christian,

                    I guess this is a problem with the web interface at repo.or.cz, not
                    with the git repository itself. I cloned the repository without any
                    problems from git://repo.or.cz/vim_extended.git

                    Cheers,
                    Lech

                    --
                    You received this message from the "vim_dev" maillist.
                    Do not top-post! Type your reply below the text you are replying to.
                    For more information, visit http://www.vim.org/maillist.php
                  • Nick Gravgaard
                    ... Was this the reason for this feature not making it into the official version of Vim? If so, is there another way to remain backwards compatible with stuff
                    Message 9 of 12 , Nov 19, 2012
                    • 0 Attachment
                      On Mon, Nov 19, 2012, at 16:21, Matthew Winn wrote:
                      > On Sun, 18 Nov 2012 16:28:19 -0800 (PST), Ben Fritz
                      > <fritzophrenic@...> wrote:
                      >
                      > > 1. Implement variable-width tabstops by allowing a comma-separated list to be used as a value for 'tabstop'. For example, setting ts=4,2,8 would have the first tab in the line stop at column 4, the next stop at column 6, and all other tabs stop at 14, 22, 30, ...
                      >
                      > I implemented a patch to do this a few years ago, when I was out of
                      > work and decided to grab something off the TODO list to keep me busy.
                      > (It's since been taken over by someone else.) During the initial
                      > discussion it was decided that it wasn't a good idea to have multiple
                      > values in the "tabstop" option in case someone tried to treat its
                      > value as a number

                      Was this the reason for this feature not making it into the official
                      version of Vim? If so, is there another way to remain backwards
                      compatible with stuff that expects its value to be a number?

                      > so I eventually settled on "vartabstop" as the name of the option.

                      --
                      You received this message from the "vim_dev" maillist.
                      Do not top-post! Type your reply below the text you are replying to.
                      For more information, visit http://www.vim.org/maillist.php
                    Your message has been successfully submitted and would be delivered to recipients shortly.