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.
- Let your favourite package manager do the work:
-- lazy.nvim
{
"csessh/stopinsert.nvim",
opts = {}
},
- Setup the plugin in your
init.lua
. This step is not needed with lazy.nvim ifopts
is set.
require("stopinsert").setup()
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. |
show_popup_msg |
boolean | true |
Enable/disable popup message" |
clear_popup_ms |
number | 5000 |
Maximum time (in milliseconds) for which the popup message hangs around |
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*
.
stopinsert.nvim
is enabled by default. You can toggle its state on the fly with the following commands:
:StopInsertPlug enable
:StopInsertPlug disable
:StopInsertPlug toggle
:StopInsertPlug status
Each of them does exactly what it says on the tin.
All contributions are most welcome! Please open a PR or create an issue.