Monday, May 25, 2026

timer_start to refresh rulerformat

HI,

I saw here :  https://vim.fandom.com/wiki/Display_date-and-time_on_status_line
and there : https://vi.stackexchange.com/questions/17875/how-to-update-the-statusline-continuously-even-if-the-window-becomes-inactive
that `timer_start` could refresh statusline.

something might have happened, because I can't get it to work.

here's the simple code I use:

```
set ruler
set rulerformat=%55(%{strftime('%H:%M:%S')}\ %5l,%-6(%c%V%)\ %P%)
call timer_start(1000, {-> execute(':let &stl=&stl')}, {'repeat': -1})
```

and here's version:

$ LC_ALL=C vim --version
VIM - Vi IMproved 9.2 (2026 Feb 14, compiled May 22 2026 18:43:08)
Included patches: 1-511
Compiled by Arch Linux
Huge version without GUI.  Features included (+) or not (-):
+acl                +file_in_path       +mouse_xterm        -tag_any_white
+arabic             +find_in_path       +multi_byte         +tcl/dyn
+autocmd            +float              +multi_lang         +termguicolors
+autochdir          +folding            -mzscheme           +terminal
-autoservername     -footer             +netbeans_intg      +terminfo
-balloon_eval       +fork()             +num64              +termresponse
+balloon_eval_term  +gettext            +packages           +textobjects
-browse             -hangul_input       +path_extra         +textprop
++builtin_terms     +iconv              +perl/dyn           +timers
+byte_offset        +insert_expand      +persistent_undo    +title
+channel            +ipv6               +popupwin           -toolbar
+cindent            +job                +postscript         +user_commands
+clientserver       +jumplist           +printer            +vartabs
-clipboard          +keymap             +profile            +vertsplit
+clipboard_provider +lambda             -python             +vim9script
+cmdline_compl      +langmap            +python3/dyn        +viminfo
+cmdline_hist       +libcall            +quickfix           +virtualedit
+cmdline_info       +linebreak          +reltime            +visual
+comments           +lispindent         +rightleft          +visualextra
+conceal            +listcmds           +ruby/dyn           +vreplace
+cryptv             +localmap           +scrollbind         -wayland
+cscope             +lua/dyn            +signs              -wayland_clipboard
+cursorbind         +menu               +smartindent        +wildignore
+cursorshape        +mksession          +socketserver       +wildmenu
+dialog_con         +modify_fname       -sodium             +windows
+diff               +mouse              -sound              +writebackup
+digraphs           -mouseshape         +spell              -X11
-dnd                +mouse_dec          +startuptime        +xattr
-ebcdic             +mouse_gpm          +statusline         -xfontset
+emacs_tags         -mouse_jsbterm      -sun_workshop       -xim
+eval               +mouse_netterm      +syntax             -xpm
+ex_extra           +mouse_sgr          +tabpanel           -xsmp
+extra_search       -mouse_sysmouse     +tag_binary         -xterm_clipboard
-farsi              +mouse_urxvt        -tag_old_static     -xterm_save
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
 3rd user vimrc file: "~/.config/vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/vim/src=/usr/src/debug/vim -flto=auto -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.42/core_perl/CORE -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -L/usr/local/lib -o vim -lm -ltinfo -lnsl -lacl -lattr -lgpm -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm 
$

No comments: