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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.
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*.

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
:StopInsertPlug status

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

Contribution

All contributions are most welcome! Please open a PR or create an issue.

Coding Style

  • Follow the coding style of LuaRocks.
  • Make sure you format the code with StyLua before PR.

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

Languages