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

Seletively limit CursorLine colors and/or set precedence of :hi groups

Expand Messages
  • Paul
    I always have trouble finding where the cursor is in a large window, especially of syntax highlighting is used. I recently discovered cursorline and
    Message 1 of 2 , Sep 6, 2013
    View Source
    • 0 Attachment
      I always have trouble finding where the cursor is in a large window, especially of syntax highlighting is used. I recently discovered cursorline and cursorcolumn (thanks, Tony), which helps.

      However, cursorcolumn has some distracting effects. The highlight colours I use for cursorcolumn seems to override those for syntax highlighting, folds, and search highlighting. It can look very strange; cognitively, it causes seemingly random characters to leap out of the page, making it hard to compose a report in (say) LaTeX.

      I suspect that ideal solution is for the ":hi CursorColumn guifg=... guibg=..." to take effect only where Normal colours are in effect -- not where there is Search highlighting or folds. This means that CursorColumn highlighting takes effect even at page positions where syntax colouring is in effect. I can't actually try this to check that it has the desired cognitive effect. Is there a way to achieve this?

      As a second related question, can :hi colours be specified in such a way that some groups take precedence over others? If so, I can achieve the desired effect by specifying the precedence of :hi groups.

      --
      --
      You received this message from the "vim_use" 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_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Paul
      Yay! No need to turn on cursorline or cursorcolumn to locate the cursor. func! FlashLocn() hi CursorColumn guibg=yellow hi CursorLine guibg=yellow set cul cuc
      Message 2 of 2 , Sep 6, 2013
      View Source
      • 0 Attachment
        Yay! No need to turn on cursorline or cursorcolumn to locate the cursor.

        func! FlashLocn()
        hi CursorColumn guibg=yellow
        hi CursorLine guibg=yellow
        set cul cuc
        redraw!
        "sleep 1m
        set nocul nocuc
        endfunction

        Since I'm running out of hot keys, I piggy back this function off of a key used for toggling the "wrap" option:

        nmap <C-H> :set wrap! \| call FlashLocn() \| set wrap? <CR>

        --
        --
        You received this message from the "vim_use" 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_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+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.