On Mi, 28 Sep 2016, Bram Moolenaar wrote: > Justin Keyes wrote: > > > On Tue, Sep 27, 2016 at 10:10 PM, Christian Brabandt <[email protected]> > > wrote: > > > Bram, > > > I maintain the popular eye-candy plugin vim-airline. For files > > > maintained in git, it checks the current branch and displays it in the > > > statusline using system('git status...') and caches the result, so that > > > it is not called to often. However after a ShellCmdPost autocommand, it > > > invalidates the cache and runs the command to update it (since the user > > > could have interacted with git using !git..) > > > > Why *must* the plugin do this in ShellCmdPost? Why can't it set a flag > > and then refresh the cache on CursorMoved or CursorHold? This is not a > > strong case for making this variable writable. > > > > Keeping variables read-only makes it easier to reason about things. > > Very few v: vars are writable, and each time it's slightly convenient > > someone asks to make them writable. > > > > I believe ZyX also noted that calling system() in a ShellCmdPost is a > > code smell.
That is neither what is happening nor what I described above. > Right. How about using a timer? That way you can also avoid too many > updates (set timer for 1 second, if another shell command is used > kill the timer and start another one). Let me just withdraw the patch. I use async feature now to workaround. Best, Christian -- Sie geht mit dem Fortschritt, so daß dieser keuchend zurückbleibt. -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
