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

User defined action after jumping to a tag...

Expand Messages
  • John Szakmeister
    One issue I ve run into a few times is that when jumping to a tag, I d really like to center the line in the middle of the screen after jumping. The problem
    Message 1 of 5 , May 31, 2013
      One issue I've run into a few times is that when jumping to a tag, I'd
      really like to center the line in the middle of the screen after
      jumping. The problem is that I also want to be able to use the
      taglist functionality, and I'd like this to work when plugins jump to
      tags for me (like CtrlP). I've resorted to patching plugins to add
      the `zz` where I need it, but it seems like Vim should offer a way for
      users to control this in general.

      If you agree, is there an acceptable approach? I know adding
      autocommands is generally frowned upon because of the issues that come
      with them. Is there some other mechanism that would work better?
      Perhaps assigning a function, similar to indentexpr, and then invoking
      it after jumping?

      Thanks!

      -John

      --
      --
      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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Roland Eggner
      ... -- Regards Roland Eggner
      Message 2 of 5 , May 31, 2013
        On 2013-05-31 Friday at 06:36 -0400 John Szakmeister wrote:
        > One issue I've run into a few times is that when jumping to a tag, I'd
        > really like to center the line in the middle of the screen after
        > jumping.

        :h scrolloff

        --
        Regards
        Roland Eggner
      • John Szakmeister
        ... Thank you for the suggestion, but I don t want to keep my cursor in the middle of the screen. I just want it there after jumping. :-) -John -- -- You
        Message 3 of 5 , May 31, 2013
          On Fri, May 31, 2013 at 8:52 AM, Roland Eggner <edvx1@...> wrote:
          > On 2013-05-31 Friday at 06:36 -0400 John Szakmeister wrote:
          >> One issue I've run into a few times is that when jumping to a tag, I'd
          >> really like to center the line in the middle of the screen after
          >> jumping.
          >
          > :h scrolloff

          Thank you for the suggestion, but I don't want to keep my cursor in
          the middle of the screen. I just want it there after jumping. :-)

          -John

          --
          --
          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

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Gary Johnson
          ... I like the idea of a post-jump expression, as long as the user has control over the types of jumps the function applies to, an option along the lines of
          Message 4 of 5 , May 31, 2013
            On 2013-05-31, John Szakmeister wrote:
            > One issue I've run into a few times is that when jumping to a tag, I'd
            > really like to center the line in the middle of the screen after
            > jumping. The problem is that I also want to be able to use the
            > taglist functionality, and I'd like this to work when plugins jump to
            > tags for me (like CtrlP). I've resorted to patching plugins to add
            > the `zz` where I need it, but it seems like Vim should offer a way for
            > users to control this in general.
            >
            > If you agree, is there an acceptable approach? I know adding
            > autocommands is generally frowned upon because of the issues that come
            > with them. Is there some other mechanism that would work better?
            > Perhaps assigning a function, similar to indentexpr, and then invoking
            > it after jumping?

            I like the idea of a post-jump expression, as long as the user has
            control over the types of jumps the function applies to, an option
            along the lines of 'foldopen'.

            I generally like the way Vim adjusts the screen after a jump:
            short, on-screen jumps don't scroll; long jumps center the cursor.
            I usually don't like it, though, when the jump puts the cursor on
            the first or last line of the screen. I want a little context for
            that line.

            'scrolloff' is not the solution. I want to be able to move the
            cursor to those top and bottom lines.

            I've written a function that scrolls the screen if certain jumps
            that I've mapped (e.g., n and N) put the cursor too close to the top
            or bottom of the screen. It works very well, but it would be nice
            if I could easily apply it to other jumps such as initial cscope and
            tags jumps as well.

            I do not want that adjustment to occur after a % jump, though. I
            often use % to get as much of a block on-screen as I can. But other
            users might want that adjustment for %, so control over the kinds of
            jumps that use post-jump adjustment is important.

            Regards,
            Gary

            --
            --
            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

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • John Szakmeister
            ... Sorry it s taken me a while to get back to this. Thank you for the suggestion. I ll look into this a little more. ... Hmm. I actually don t like the
            Message 5 of 5 , Jun 14, 2013
              On Fri, May 31, 2013 at 1:17 PM, Gary Johnson <garyjohn@...> wrote:
              > On 2013-05-31, John Szakmeister wrote:
              >> One issue I've run into a few times is that when jumping to a tag, I'd
              >> really like to center the line in the middle of the screen after
              >> jumping. The problem is that I also want to be able to use the
              >> taglist functionality, and I'd like this to work when plugins jump to
              >> tags for me (like CtrlP). I've resorted to patching plugins to add
              >> the `zz` where I need it, but it seems like Vim should offer a way for
              >> users to control this in general.
              >>
              >> If you agree, is there an acceptable approach? I know adding
              >> autocommands is generally frowned upon because of the issues that come
              >> with them. Is there some other mechanism that would work better?
              >> Perhaps assigning a function, similar to indentexpr, and then invoking
              >> it after jumping?
              >
              > I like the idea of a post-jump expression, as long as the user has
              > control over the types of jumps the function applies to, an option
              > along the lines of 'foldopen'.

              Sorry it's taken me a while to get back to this. Thank you for the
              suggestion. I'll look into this a little more.

              > I generally like the way Vim adjusts the screen after a jump:
              > short, on-screen jumps don't scroll; long jumps center the cursor.
              > I usually don't like it, though, when the jump puts the cursor on
              > the first or last line of the screen. I want a little context for
              > that line.

              Hmm. I actually don't like the same screen jumps avoiding the scroll,
              but I could live with that. What I've noticed is that using CtrlP and
              jumping to a tag tends to put my cursor all over the place when
              jumping to another buffer. I wonder if that's because the tag is
              within the visible data at that point, so Vim doesn't scroll? I'll
              have to investigate that more.

              > 'scrolloff' is not the solution. I want to be able to move the
              > cursor to those top and bottom lines.

              Same here.

              > I've written a function that scrolls the screen if certain jumps
              > that I've mapped (e.g., n and N) put the cursor too close to the top
              > or bottom of the screen. It works very well, but it would be nice
              > if I could easily apply it to other jumps such as initial cscope and
              > tags jumps as well.
              >
              > I do not want that adjustment to occur after a % jump, though. I
              > often use % to get as much of a block on-screen as I can. But other
              > users might want that adjustment for %, so control over the kinds of
              > jumps that use post-jump adjustment is important.

              Good point. Thanks for the example!

              -John

              --
              --
              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

              ---
              You received this message because you are subscribed to the Google Groups "vim_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            Your message has been successfully submitted and would be delivered to recipients shortly.