Boost Your Neovim Efficiency: Mastering Editing Habits with hardtime.nvim
Breaking Bad Habits in Neovim with hardtime.nvim
If you’ve found yourself slipping into inefficient editing habits while using Neovim, hardtime.nvim
might be the tool you need. Developed by m4xshen
, this plugin is designed to help users establish a more effective command workflow by restricting habitual keypresses and providing suggestions for better commands.
What is hardtime.nvim
?
hardtime.nvim
is a Neovim plugin that discourages bad habits by blocking repeated key usage within a set period of time and suggesting more efficient alternatives. For instance, it encourages using ci"
instead of the less efficient di"i
. This helps in honing your skills to become a more proficient Neovim user.
Key Features
- Blocking Repeated Keys: Avoid using the same command keys repeatedly within a short timeframe.
- Command Hints: Offers hints for better command usage directly within your editing sessions.
- Customization: Allows for tailored settings regarding restricted keys, disabled keys, and more.
- Usage Reports: Generates reports on your most common inefficiencies, helping you identify areas for improvement.
Installation and Setup
To install hardtime.nvim
, use your preferred package manager. For example, with lazy.nvim
, you can add the following to your Neovim configuration:
{
"m4xshen/hardtime.nvim",
dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" },
opts = {}
}
Post installation, initiate the plugin in your init.lua
:
require("hardtime").setup()
Customization: Tailoring Your Experience
You can configure hardtime.nvim
to better fit your editing style and specific needs. For example, you can disable the plugin for certain filetypes or adjust key restrictions:
disabled_filetypes = { "qf", "netrw", "NvimTree", "lazy", "mason", "oil" },
disabled_keys = {
["<Up>"] = {},
["<Space>"] = { "n", "x" },
}
Tracking and Improving Your Habits
One of the standout features of hardtime.nvim
is its ability to provide reports on your command usage. By using the command :Hardtime report
, you can view a summary of your most frequently used keys and get suggestions on how to improve your efficiency.
Furthermore, if you’re looking to implement custom hints or tracking, the plugin’s configuration allows for extensive modifications. You can define specific patterns and the corresponding hints:
hints = {
["d[tTfF].i"] = {
message = function(keys)
return "Use c" .. keys:sub(2, 3) .. " instead of " .. keys
end,
length = 4,
},
}
This flexibility allows you to mold the plugin to better address your specific bad habits, making hardtime.nvim
an invaluable tool for enhancing your Neovim proficiency.