Some years ago on the main vim mailing list I learned the following
gem:
setlocal autoread
function! Tailf()
normal G
checktime
let K_IGNORE = "\x80\xFD\x35" " internal key code that is ignored
call feedkeys(K_IGNORE)
endfunction
augroup tailf
au!
au CursorHold,CursorHoldI * :call Tailf()
augroup END
IMO its value in monitoring server processes that output to log files
is great, because one can do syntax colouring on the output. This has
two main benefits: it can make lousy output intelligible, and events
of particular interest stand out. Even colouring a timestamp makes a
huge difference.
The use of a loop with the cursor hold events allows one to scroll
about the output, and only on inactivity go back to watching the end
of the file. A vim script loop around a sleep wouldn't do this.
John Beckett has suggested that this be made into a tip, but I find
the use of the internal key sequence questionable, especially since
I've looked at keymap.h and found that the sequence is misnamed
(K_IGNORE is actually 0x35FD) and that the last code is implicitly
determined by an enum, which could change.
So, is there a better way:
Firstly, is there a guaranteed to be innocuous, small sequence of
keys that would make better input to feedkeys?
Secondly, is there a better way than the cursor hold mechanism?
Regards, John
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---