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

RE: highlighting current line

Expand Messages
  • Hubbell, Sean (GDIS)
    Hello, v for line select and V for column select. see :he V Sean
    Message 1 of 11 , May 2, 2001
      Hello,

      <Shift> v for line select and <Cntl> V for column select.

      see :he V

      Sean

      > -----Original Message-----
      > From: Roel Vanhout [mailto:roel@...]
      > Sent: Wednesday, May 02, 2001 7:44 AM
      > To: vim@...
      > Subject: highlighting current line
      >
      >
      > Hi all,
      >
      > Is there a way to highlight the line the cursor is currently on?
      >
      > cheers,
      >
      > roel
      >
    • Roel Vanhout
      Hi, Sorry for being unclear; what I meant, was: when I move around with the cursor, I want to have the line highlighted, but not selecting it. When I do V
      Message 2 of 11 , May 2, 2001
        Hi,

        Sorry for being unclear; what I meant, was: when I move around with the
        cursor, I want to have the line highlighted, but not selecting it. When
        I do 'V' and move the cursor, this will select more/less lines; I want
        always just one line to be highlighted. This way, it is easier to see
        what line you are on when you have a wide screen, the cursor is at the
        beginning of the line, and you are looking at the end of the line.

        cheers,

        roel

        On Wed, May 02, 2001 at 07:27:52AM -0500, Hubbell, Sean (GDIS) wrote:
        > Hello,
        >
        > <Shift> v for line select and <Cntl> V for column select.
        >
        > see :he V
        >
        > Sean
        >
        > > -----Original Message-----
        > > From: Roel Vanhout [mailto:roel@...]
        > > Sent: Wednesday, May 02, 2001 7:44 AM
        > > To: vim@...
        > > Subject: highlighting current line
        > >
        > >
        > > Hi all,
        > >
        > > Is there a way to highlight the line the cursor is currently on?
        > >
        > > cheers,
        > >
        > > roel
        > >
      • Chris Houser
        ... This does highlight the current line, but it is only updated when a line changes, or when you force a screen redraw with ^L. It may also only be available
        Message 3 of 11 , May 2, 2001
          :syntax match Search "^.*\%#.*"

          This does highlight the current line, but it is only updated when a line
          changes, or when you force a screen redraw with ^L. It may also only be
          available in vim 6.0.

          :help \%#

          There may be a better way, but I don't know what it is.

          --Chouser


          Roel Vanhout wrote: [Wed May 2 2001, 8:33:10AM EDT]
          > Hi,
          >
          > Sorry for being unclear; what I meant, was: when I move around with the
          > cursor, I want to have the line highlighted, but not selecting it. When
          > I do 'V' and move the cursor, this will select more/less lines; I want
          > always just one line to be highlighted. This way, it is easier to see
          > what line you are on when you have a wide screen, the cursor is at the
          > beginning of the line, and you are looking at the end of the line.
          >
          > cheers,
          >
          > roel
          >
          > On Wed, May 02, 2001 at 07:27:52AM -0500, Hubbell, Sean (GDIS) wrote:
          > > Hello,
          > >
          > > <Shift> v for line select and <Cntl> V for column select.
          > >
          > > see :he V
          > >
          > > Sean
          > >
          > > > -----Original Message-----
          > > > From: Roel Vanhout [mailto:roel@...]
          > > > Sent: Wednesday, May 02, 2001 7:44 AM
          > > > To: vim@...
          > > > Subject: highlighting current line
          > > >
          > > >
          > > > Hi all,
          > > >
          > > > Is there a way to highlight the line the cursor is currently on?
          > > >
          > > > cheers,
          > > >
          > > > roel
          > > >
        • Benoit Cerrina
          Hi, I ve seen an editor which was higlighting the current line, I found that this looked nice and tried to put together a script doing it. The approach I took
          Message 4 of 11 , Jan 17, 2002
            Hi,
            I've seen an editor which was higlighting the current line, I found that
            this looked nice and tried to put together a script doing it.
            The approach I took is using signs and cursorhold commands, however this
            is not satisfying due to the time before the cursorhold command is used.
            Anybody has an idea on how to do this in a nice fashion?

            hi default curLine guibg=white
            au! CursorHold * call s:HiCur()
            sign define curline linehl=curLine
            map <F10> :call s:HiCur()<cr>
            function! s:HiCur()
            execute 'sign unplace 2121'

            execute 'sign place 2121 line='.line('.').' name=curline
            buffer='.bufnr('%')
            endfunction


            Benoit
          • Dan Sharp
            Can you remap the motion commands to do the motion and then call your function? Although it would take work to get them all, you could at least do it for the
            Message 5 of 11 , Jan 18, 2002
              Can you remap the motion commands to do the motion and then call your
              function? Although it would take work to get them all, you could at least
              do it for the ones you use most.

              Dan Sharp


              >From: "Benoit Cerrina" <b.cerrina@...>
              >
              >Hi,
              >I've seen an editor which was higlighting the current line, I found that
              >this looked nice and tried to put together a script doing it.
              >The approach I took is using signs and cursorhold commands, however this
              >is not satisfying due to the time before the cursorhold command is used.
              >Anybody has an idea on how to do this in a nice fashion?
              >
              >hi default curLine guibg=white
              >au! CursorHold * call s:HiCur()
              >sign define curline linehl=curLine
              >map <F10> :call s:HiCur()<cr>
              >function! s:HiCur()
              > execute 'sign unplace 2121'
              >
              > execute 'sign place 2121 line='.line('.').' name=curline
              >buffer='.bufnr('%')
              >endfunction


              _________________________________________________________________
              MSN Photos is the easiest way to share and print your photos:
              http://photos.msn.com/support/worldwide.aspx
            • Dan Sharp
              Just a quick followup, but this script seems to work passably well: =================== hi default curLine guibg=yellow au! CursorHold * call s:HiCur() sign
              Message 6 of 11 , Jan 18, 2002
                Just a quick followup, but this script seems to work passably well:

                "===================
                hi default curLine guibg=yellow
                au! CursorHold * call s:HiCur()
                sign define curline linehl=curLine
                nmap j j:call <SID>HiCur()<cr>
                nmap <Down> <Down>:call <SID>HiCur()<cr>
                nmap k k:call <SID>HiCur()<cr>
                nmap <Up> <Up>:call <SID>HiCur()<cr>
                function! s:HiCur()
                execute 'sign unplace 2121'
                execute 'sign place 2121 line='.line('.').' name=curline
                buffer='.bufnr("%")
                endfunction
                "===================

                Notes:
                1) The second execute command in HiCur() is one line...the buffer=...
                stuff got wrapped.
                2) You need +sign in your build of Vim. This is default for MSWin, but
                Unix users need --with-features=big when they compile.

                Is there a way to make this work without using :sign?

                Dan Sharp

                >From: "Dan Sharp" <dwsharp@...>
                >
                >Can you remap the motion commands to do the motion and then call your
                >function? Although it would take work to get them all, you could at least
                >do it for the ones you use most.
                >
                >Dan Sharp
                >
                >
                >>From: "Benoit Cerrina" <b.cerrina@...>
                >>
                >>Hi,
                >>I've seen an editor which was higlighting the current line, I found that
                >>this looked nice and tried to put together a script doing it.
                >>The approach I took is using signs and cursorhold commands, however this
                >>is not satisfying due to the time before the cursorhold command is used.
                >>Anybody has an idea on how to do this in a nice fashion?
                >>
                >>hi default curLine guibg=white
                >>au! CursorHold * call s:HiCur()
                >>sign define curline linehl=curLine
                >>map <F10> :call s:HiCur()<cr>
                >>function! s:HiCur()
                >> execute 'sign unplace 2121'
                >>
                >> execute 'sign place 2121 line='.line('.').' name=curline
                >>buffer='.bufnr('%')
                >>endfunction


                _________________________________________________________________
                Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
              • Thomas S. Urban
                On Fri, Jan 18, 2002 at 03:29:21PM -0500, Dan Sharp wrote: ... How about this (using match): nmap j j:call HiCur() nmap k k:call
                Message 7 of 11 , Jan 18, 2002
                  On Fri, Jan 18, 2002 at 03:29:21PM -0500, Dan Sharp wrote:
                  <snip>
                  >
                  > Notes:
                  > 1) The second execute command in HiCur() is one line...the buffer=...
                  > stuff got wrapped.
                  > 2) You need +sign in your build of Vim. This is default for MSWin, but
                  > Unix users need --with-features=big when they compile.
                  >
                  > Is there a way to make this work without using :sign?

                  How about this (using match):

                  nmap j j:call <SID>HiCur()<cr>
                  nmap k k:call <SID>HiCur()<cr>

                  hi def link CurLine Todo

                  function! s:HiCur()
                  let l = escape (getline("."), '/[]*.')
                  if l == ''
                  echo "empty"
                  match none
                  else
                  exec ("match CurLine /^" . l . "$/")
                  endif
                  endfunction

                  Scott

                  --
                  I have seen these EGG EXTENDERS in my Supermarket ... I have read the
                  INSTRUCTIONS ...
                • Thomas S. Urban
                  On Fri, Jan 18, 2002 at 01:06:31PM -0800, Thomas S. Urban wrote: I forgot to mention that you would probably need to play with the escape characters
                  Message 8 of 11 , Jan 18, 2002
                    On Fri, Jan 18, 2002 at 01:06:31PM -0800, Thomas S. Urban wrote:
                    <snip>

                    I forgot to mention that you would probably need to play with the escape
                    characters (escape arg 2) to make sure you don't foul up the regex, the
                    ones there are just the obvious ones - add ^, $, etc.

                    > How about this (using match):
                    >
                    > nmap j j:call <SID>HiCur()<cr>
                    > nmap k k:call <SID>HiCur()<cr>
                    >
                    > hi def link CurLine Todo
                    >
                    > function! s:HiCur()
                    > let l = escape (getline("."), '/[]*.')
                    > if l == ''
                    > echo "empty"
                    > match none
                    > else
                    > exec ("match CurLine /^" . l . "$/")
                    > endif
                    > endfunction
                    >
                    > Scott
                    >
                    > --
                    > I have seen these EGG EXTENDERS in my Supermarket ... I have read the
                    > INSTRUCTIONS ...

                    --
                    "Who cares if it doesn't do anything? It was made with our new
                    Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."
                  • Dan Sharp
                    Also, make the maps nmap ... so the command isn t echoed at the bottom of the screen, and remove the echo empty to make the whole thing silent.
                    Message 9 of 11 , Jan 18, 2002
                      Also, make the maps

                      nmap <silent> ...

                      so the command isn't echoed at the bottom of the screen, and remove the

                      echo "empty"

                      to make the whole thing silent. This is fun :)

                      Dan Sharp

                      >From: "Thomas S. Urban" <scottu@...>
                      >
                      >On Fri, Jan 18, 2002 at 01:06:31PM -0800, Thomas S. Urban wrote:
                      ><snip>
                      >
                      >I forgot to mention that you would probably need to play with the escape
                      >characters (escape arg 2) to make sure you don't foul up the regex, the
                      >ones there are just the obvious ones - add ^, $, etc.
                      >


                      _________________________________________________________________
                      MSN Photos is the easiest way to share and print your photos:
                      http://photos.msn.com/support/worldwide.aspx
                    • KONTRA Gergely
                      What about? set ut=300 au CursorHold * match Search .* %#.* Vim6 only solution I think, but works :) Gergo +-[Kontra Gergely @ Budapest University of
                      Message 10 of 11 , Jan 22, 2002
                        What about?
                        set ut=300
                        au CursorHold * match Search '.*\%#.*'

                        Vim6 only solution I think, but works :)

                        Gergo

                        +-[Kontra Gergely @ Budapest University of Technology and Economics]-+
                        | Email: CHANGED! kgergely@... kgergely@... (old) |
                        | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 |
                        +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"------+
                        .
                        Magyar php mirror es magyar php dokumentacio: http://hu.php.net
                      Your message has been successfully submitted and would be delivered to recipients shortly.