Skip to content

Do you often find yourself caught off guard idling in Insert mode instead of escaping to Normal mode like a true Vim user? Let this help you train yourself out of the bad habit. It also boots you out of Insert mode after certain amount of seconds of inactivity

License

Notifications You must be signed in to change notification settings

csessh/stopinsert.nvim

Repository files navigation

Intro

stopinsert is a vim command (see vimdoc) that works like hitting <Esc> in Insert mode.

This plugin automatically kicks you out of Insert mode after certain amount of time of inactivity.

Installation

  1. Let your favourite package manager do the work:
-- lazy.nvim
{
    "csessh/stopinsert.nvim",
    opts = {}
},
  1. Setup the plugin in your init.lua. This step is not needed with lazy.nvim if opts is set.
require("stopinsert").setup()

Configuration

Items Type Default Value Description
idle_time_ms number 5000 (5 seconds) Maximum time (in milliseconds) before you are forced out of Insert mode back to Normal mode.
disabled_filetypes list { "TelescopePrompt", "checkhealth", "help", "lspinfo", "mason", "neo%-tree*", } List of filetypes to exclude the effect of this plugin.

NOTE: By default, stopinsert.nvim excludes a list of filetypes, as shown in the table above.

If you configure this attribute in opts with your package manager, like so, your list will replace stopinsert.nvim defaults.

Filetypes can also be listed as regex, such as neo%-tree*.

User command

stopinsert.nvim is enabled by default. You can toggle its state on the fly with the following commands:

:StopInsertPlug enable
:StopInsertPlug disable
:StopInsertPlug toggle

Each of them does exactly what it says on the tin.

Contribution

See CONTRIBUTING.md.

About

Do you often find yourself caught off guard idling in Insert mode instead of escaping to Normal mode like a true Vim user? Let this help you train yourself out of the bad habit. It also boots you out of Insert mode after certain amount of seconds of inactivity

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •