Is there a way to make vim behave like the app flowstate?

What this app does is forces the user to type continuously without pause for a certain period of time (which is very useful for brainstorming). The moment the user stops typing before the time is up, it deletes everything on the page.

The app is only for Mac OS and there doesn't seem to be an alternative for windows/UNIX systems. Is there any way to implement this kind of functionality into vim?

  • For anyone looking for a non-vim solution for windows, this website has the same functionality and is system agnostic (by virtue of being a webapp): themostdangerouswritingapp.com
    – Dianne
    Jan 10, 2019 at 16:19

2 Answers 2


You can use the CursorHold and CursorHoldI events of autocmd to implement this easily.

This autocmd is sufficient to enable this for the current buffer:

:autocmd CursorHold,CursorHoldI <buffer> %d

This will run the %d command (delete whole buffer) once no key is pressed for the duration of 'updatetime', which defaults to 4 seconds.

If you want to update that to a shorter or longer interval, just set that option (it takes a number of milliseconds.) To erase after 10s of inactivity, for instance:

:setlocal updatetime=10000

Using both CursorHoldI and CursorHold means this works whether you're in insert mode or normal mode. There are some limitations though, it doesn't trigger in Visual mode, when waiting for a command to be typed or in operator-pending mode.

You can also undo the deletion using u, or just paste back from the default buffer... So it's not foolproof (it all depends on what you're trying to accomplish, I guess.) It's probably a good start though, it's pretty simple.

(If you're looking for something more robust and you don't mind depending on Vim 8 or nvim features, you can probably build something better using timer_start().)

  • Great answer! Quick question: how do you turn it off?
    – Dianne
    Jan 28, 2019 at 1:04
  • @Dianne You can use :autocmd! to remove auto-commands, for example :autocmd! CursorHold,CursorHoldI <buffer> would remove the autocmd above. (Using :augroup is a more elegant solution for that. See also this chapter of Learn Vimscript the Hard Way for more on effectively using :augroup.)
    – filbranden
    Jan 28, 2019 at 1:48

VimRoom, inspired by writeroom gives the same appearance


You could combine that with a pomodoro timer such as https://github.com/carlmjohnson/pomodoro or Tomighty (available for windows) to get a similar effect.

(There are also pomodoro plugins that you can use within VIM.)

  • While the minimalist design is one of the main features of flowstate, it's actually the auto-delete/forced continuous text feature that I want to reproduce. Is there a way to have vim auto-delete everything if I stop typing?
    – Dianne
    Jan 9, 2019 at 0:34
  • Sounds terrible; but if you capture every input and reset a timer it should be possible. 1. Capture every input in insert mode. 2. Reset a timer on input. 3. If timer exceeds 300 or you leave insert mode before 15 minutes then delete buffer. vim.wikia.com/wiki/Capture_all_keys
    – Hunaphu
    Jan 9, 2019 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.