SkillAgentSearch skills...

Hardtime.nvim

Break bad habits, master Vim motions

Install / Use

/learn @m4xshen/Hardtime.nvim
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<!-- panvimdoc-ignore-start --> <div align="center">

hardtime.nvim

Break bad habits, master Vim motions

Busted Neovim version

FeaturesInstallationUsageConfiguration

https://github.com/user-attachments/assets/3cc1bcdd-1ace-40f0-b295-f84a78051d6a

https://github.com/user-attachments/assets/1c120fe5-c57d-4cb3-8313-25f2395e95fa

</div>

✨ Features

  • Block repeated keys within a short period of time
  • Provide hints for faster Vim motion
  • Get report of your most common bad habits
<!-- panvimdoc-ignore-end -->

👍🏻 Recommended workflow

Instead of only relying on hjkl, arrow keys and mouse, you should:

  1. Use relative jump (eg: 5j 12-) for vertical movement within the screen.
  2. Use CTRL-U CTRL-D CTRL-B CTRL-F gg G for vertical movement outside the screen.
  3. Use word-motion (w W b B e E ge gE) for short-distance horizontal movement.
  4. Use f F t T , ; 0 ^ $ for medium to long-distance horizontal movement.
  5. Use operator + motion/text-object (eg: ci{ y5j dap) whenever possible.
  6. Use % and square bracket commands (see :h [) to jump between brackets.

Learn more in this blog post

⚡ Requirements

📦 Installation

  1. Install via your favorite package manager.
{
   "m4xshen/hardtime.nvim",
   lazy = false,
   dependencies = { "MunifTanjim/nui.nvim" },
   opts = {},
},
  1. Setup the plugin in your init.lua. This step is not needed with lazy.nvim if opts is set as above.
require("hardtime").setup()

If you want to see the hint messages in insert and visual mode, set the 'showmode' to false.

But if you want to see both the hint message and current mode you can setup with one of the following methods:

  • Display the mode on status line and set 'showmode' to false. You can do this with some statusline plugin such as lualine.nvim.
  • Set the 'cmdheight' to 2 so that the hint message won't be replaced by mode message.
  • Use nvim-notify to display hint messages on the right top corner instead of commandline.

🚀 Usage

Hardtime is enabled by default. You can change its state with the following commands:

  • :Hardtime enable enable Hardtime
  • :Hardtime disable disable Hardtime
  • :Hardtime toggle toggle Hardtime

You can view the most frequently seen hints with :Hardtime report.

Your log file is at ~/.local/state/nvim/hardtime.nvim.log.

🔧 Configuration

You can pass your config table into the setup() function or opts if you use lazy.nvim.

If the option is a table (key = value pair), you can set value to false to disable the default value.

Examples:

disabled_keys = {
   ["<Up>"] = false, -- Allow <Up> key
   ["<Space>"] = { "n", "x" }, -- Disable <Space> key in normal and visual mode
},
disabled_filetypes = { 
   lazy = false, -- Enable Hardtime in lazy filetype
   ["dapui*"] = false, -- Enable Hardtime in filetype starting with dapui
},

Options

| Option Name | Type | Default Value | Meaning | | ------------------------ | ---------------------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | max_time | number | 1000 | Maximum time (in milliseconds) to consider key presses as repeated. | | max_count | number | 3 | Maximum count of repeated key presses allowed within the max_time period. | | disable_mouse | boolean | true | Disable mouse support. | | hint | boolean | true | Enable hint messages for better commands. | | notification | boolean | true | Enable notification messages for restricted and disabled keys. | | timeout | number or boolean | 3000 | Time to show notification in milliseconds, set to false to disable timeout. | | allow_different_key | boolean | true | Allow different keys to reset the count. | | enabled | boolean | true | Whether the plugin is enabled by default or not. | | resetting_keys | table | See Config | Keys in what modes that reset the count. | | restricted_keys | table | See Config | Keys in what modes triggering the count mechanism. | | restriction_mode | string ("block" or "hint") | "block" | The behavior when restricted_keys trigger count mechanism. | | disabled_keys | table | See Config | Keys in what modes are disabled. | | disabled_filetypes | table | See Config | Hardtime is disabled under these filetypes. | | hints | table | See Config | key is a string pattern you want to match, value is a table of hint message and pattern length. Learn more about Lua string pattern. | | callback | function(text) | vim.notify | callback function can be used to override the default notification behavior. | | force_exit_insert_mode | boolean | false | Enable forcing exit Insert mode if user is inactive in Insert mode. | | max_insert_idle_ms | number | 5000 | Maximum amount of idle time, in milliseconds, allowed in Insert mode. | | ui | table of strings/table pair | See Config | An option to customize the popup for the Hardtime report.

hints example

These are two default hints:

hints = {
   ["k%^"] = {
      message = function()
         return "Use - instead of k^" -- return the hint mes
View on GitHub
GitHub Stars3.7k
CategoryDevelopment
Updated3h ago
Forks46

Languages

Lua

Security Score

100/100

Audited on Mar 29, 2026

No findings