On 09/06/09 14:17, Ben Fritz wrote:
>
>
>
> On Jun 8, 9:57 am, Ben Fritz<[email protected]>  wrote:
>> I find myself wondering if the problem is that<S-Right>  and friends
>> all enter selection mode (something I never use). :help Select-mode
>> (actually :help v_CTRL-G) says that "printable characters will cause
>> the selection to be deleted, and Vim enters Insert mode." Perhaps the
>> CursorMoved autocmd fires after entering selection mode, and simply
>> feeds the (printable) zz sequence in, causing the text to be deleted
>> and zz inserted?
>
> I'm almost certain this is the cause, because here is a fix:
>
> autocmd CursorMoved * if mode() ==# 'n' | exec 'normal zz' | endif
>
> I'd still like to figure out a way to verify this however.

My homemade colorscheme includes an autocommand to change the statusline 
color on CursorHold,CursolrHoldI events. It can be readily adapted to 
test any other event.

Here are the relevant lines, I'm inserting them here in "quoted" style 
to avoid confusion about where a line begins. Block-delete in Vim should 
be an easy way to remove the start-of-line mail-quote marks if you 
decide to use it.

One line apparently not shown consists of setting not only g:colors_name 
but also s:colors_name to the colorscheme name, so the autocommands can 
be removed if the user decides to use a different colorscheme.


> " display the status line of the active window in a distinctive color:
> " bold black on bright red in the GUI, white on green in the console
> " (where the bg is never bright, and dark red is sometimes an ugly sort
> " of reddish brown).
> hi StatusLine   gui=NONE,bold   guibg=red           guifg=black
>         \       cterm=NONE,bold ctermbg=darkgreen   ctermfg=white
> hi WildMenu     gui=NONE,bold   guibg=green         guifg=black
>         \       cterm=NONE,bold ctermbg=black       ctermfg=white
> " make the status line bold-reverse (but B&W) for inactive windows
> hi StatusLineNC gui=reverse,bold
>         \       cterm=NONE      ctermbg=black       ctermfg=lightgrey
> " make the active status line colours alternate between two settings
> " to give a visual notice of the CursorHold/CursorHoldI events
> if ! exists("s:statuslineflag")
>   let s:statuslineflag = 0
> endif
> function! ToggleStatusLine()
>     if s:statuslineflag
>         hi StatusLine
>           \     cterm=NONE,bold ctermbg=darkgreen   ctermfg=white
>           \     gui=NONE,bold   guibg=red           guifg=black
>         hi WildMenu
>           \     cterm=NONE,bold ctermbg=black       ctermfg=white
>           \     gui=NONE,bold   guibg=green         guifg=black
>     else
>         hi StatusLine
>           \     cterm=NONE,bold ctermbg=black       ctermfg=white
>           \     gui=NONE,bold   guibg=green         guifg=black
>         hi WildMenu
>           \     cterm=NONE,bold ctermbg=darkgreen   ctermfg=white
>           \     gui=NONE,bold   guibg=red           guifg=black
>     endif
>     let s:statuslineflag = ! s:statuslineflag
> endfunction
> exe "augroup" s:colors_name
>     au! CursorHold,CursorHoldI * call ToggleStatusLine()
>     au! ColorScheme *
>         \ if g:colors_name != s:colors_name | exe "au!" s:colors_name | endif
> augroup END



Best regards,
Tony.
-- 
Do infants have as much fun in infancy as adults do in adultery?

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to