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

Fwd: Auto centering cursor when at top or bottom line

Expand Messages
  • Kerneels Roos
    Hi, where should questions like the below be posted? I realize it s not a dev question, but for some reason I can t post to the vim use group. ... Subject:
    Message 1 of 3 , Aug 3, 2011
      Hi, where should questions like the below be posted? I realize it's not a dev question, but for some reason I can't post to the vim use group.


      -------- Original Message --------
      Subject:Auto centering cursor when at top or bottom line
      Date:Wed, 03 Aug 2011 12:11:54 +0200
      From:Kerneels Roos <kerneels@...>
      To:vim_use@...


      Hi,
      
      Is there a simple way to always have the view port shifted up or down so 
      that the cursor moves to the center of the screen (vertically) whenever 
      you reach the top most, or bottom most visible line?
      
      What I'm looking for is a global setting or script that would 
      immediately shift the visible text vertically so that the line 
      containing the cursor is vertically centered the moment you move the 
      cursor vertically off the screen.
      
      The default behaviour is for the screen to only scroll one line, I would 
      like it to scroll half the visible lines while the cursor still only 
      moves one line down but now appears vertically centered on the screen.
      
      Any help would be much appreciated!
      
      Regards
      
      -- 
      Kerneels Roos
      Cell: +27 (0)82 309 1998
      Skype: cornelis.roos
      
      

      --
      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
    • Jürgen Krämer
      Hi, ... yes, vim_use would be the preferred group. ... try a combination of scrolljump and scrolloff: set scrolljump=-50 set scrolloff=1 This will scroll as
      Message 2 of 3 , Aug 3, 2011
        Hi,

        Kerneels Roos wrote:
        > Hi, where should questions like the below be posted? I realize it's
        > not a dev question, but for some reason I can't post to the vim use group.

        yes, vim_use would be the preferred group.

        > -------- Original Message --------
        > Subject: Auto centering cursor when at top or bottom line
        > Date: Wed, 03 Aug 2011 12:11:54 +0200
        > From: Kerneels Roos <kerneels@...>
        > To: vim_use@...
        >
        > Is there a simple way to always have the view port shifted up or down so
        > that the cursor moves to the center of the screen (vertically) whenever
        > you reach the top most, or bottom most visible line?

        try a combination of scrolljump and scrolloff:

        set scrolljump=-50
        set scrolloff=1

        This will scroll as soon as the cursor enters the top or bottom line.

        > What I'm looking for is a global setting or script that would
        > immediately shift the visible text vertically so that the line
        > containing the cursor is vertically centered the moment you move the
        > cursor vertically off the screen.

        If you want only want to scroll when the cursor would leave the visible
        part, keep scrolloff at its default value of 0:

        set scrolljump=-50
        set scrolloff=0

        Regards,
        Jürgen

        --
        Sometimes I think the surest sign that intelligent life exists elsewhere
        in the universe is that none of it has tried to contact us. (Calvin)

        --
        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
      • Kerneels Roos
        ... Thanks a lot, works brilliantly! ... -- Kerneels Roos Cell: +27 (0)82 309 1998 Skype: cornelis.roos -- You received this message from the vim_dev
        Message 3 of 3 , Aug 3, 2011
          On 8/3/2011 1:41 PM, Jürgen Krämer wrote:
          > Hi,
          >
          > Kerneels Roos wrote:
          >> Hi, where should questions like the below be posted? I realize it's
          >> not a dev question, but for some reason I can't post to the vim use group.
          > yes, vim_use would be the preferred group.
          >
          >> -------- Original Message --------
          >> Subject: Auto centering cursor when at top or bottom line
          >> Date: Wed, 03 Aug 2011 12:11:54 +0200
          >> From: Kerneels Roos<kerneels@...>
          >> To: vim_use@...
          >>
          >> Is there a simple way to always have the view port shifted up or down so
          >> that the cursor moves to the center of the screen (vertically) whenever
          >> you reach the top most, or bottom most visible line?
          > try a combination of scrolljump and scrolloff:
          >
          > set scrolljump=-50
          > set scrolloff=1
          >
          > This will scroll as soon as the cursor enters the top or bottom line.
          >
          >> What I'm looking for is a global setting or script that would
          >> immediately shift the visible text vertically so that the line
          >> containing the cursor is vertically centered the moment you move the
          >> cursor vertically off the screen.
          > If you want only want to scroll when the cursor would leave the visible
          > part, keep scrolloff at its default value of 0:
          >
          > set scrolljump=-50
          > set scrolloff=0
          Thanks a lot, works brilliantly!
          > Regards,
          > Jürgen
          >

          --
          Kerneels Roos
          Cell: +27 (0)82 309 1998
          Skype: cornelis.roos

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