PitchHut logo
Log in / Sign up
hardtime.nvim
by m4xshen
Improve your Neovim command workflow effectively.
Pitch

hardtime.nvim helps you establish a better command workflow and eliminate bad habits while using Neovim. With features like blocking repeated keys, providing hints for optimal commands, and customizable options, it’s designed to enhance your productivity and create a smoother editing experience.

Description

hardtime.nvim is a powerful Neovim plugin designed to enhance your command workflow while helping you eliminate bad habits. By utilizing this tool, you can improve your efficiency and precision in navigating and editing in Neovim.

✨ Key Features

  • Key Repetition Blocking: Prevents the accidental repetition of commands within a specified time frame.
  • Command Hints: Provides insightful suggestions for better commands, guiding you to use alternatives, such as recommending ci" instead of di"i.
  • Customizable Restrictions: Tailor the plugin's functionality by configuring restricted keys, disabled keys, and more to suit your preferences.
  • Habit Reporting: Gain insights into your most frequent "bad habits" to help you focus on improvement areas.

Recommended Workflow

To maximize your productivity, follow these guidelines:

  1. Limit mouse and arrow key usage when not at the home row of your keyboard.
  2. Use relative jump commands (e.g., 5j, 12-) for efficient vertical screen navigation.
  3. Employ CTRL-U, CTRL-D, CTRL-B, CTRL-F, gg, and G for smooth vertical movements outside the visible area.
  4. Utilize word motions (w, W, b, B, e, E, ge, gE) for short horizontal adjustments.
  5. For medium to long-distance horizontal movements, use commands like f, F, t, T, ;, 0, ^, and $.
  6. Combine operators with motions/text-objects (e.g., ci{, y5j, dap) whenever possible.
  7. Use % and bracket commands to navigate between brackets effectively.

For a deeper understanding, check out this detailed blog post.

⚡ Requirements

🚀 Usage

Out of the box, hardtime.nvim is enabled. You can easily manage it using the following commands:

  • :Hardtime enable - Activates hardtime.nvim.
  • :Hardtime disable - Deactivates it.
  • :Hardtime toggle - Toggles the plugin's state.
  • To view the most common hints you have encountered, use :Hardtime report.

Additionally, your logs are accessible at ~/.local/state/nvim/hardtime.nvim.log.

🔧 Configuration

Customize your plugin experience by passing a configuration table into the setup() function or through opts if using lazy.nvim. Here's an example:

-- Add "oil" to the disabled file types
disabled_filetypes = { "qf", "netrw", "NvimTree", "lazy", "mason", "oil" },

You can modify options to overwrite default settings. For instance:

-- Disable <Up> keys and append <Space> to disabled keys
disabled_keys = {
   ["<Up>"] = {},
   ["<Space>"] = { "n", "x" },
},

Options Overview

Option NameTypeDefault ValueMeaning
max_timenumber1000Maximum time (ms) for repeated key presses.
max_countnumber3Maximum number of allowed repeat key presses.
disable_mousebooleantrueToggle mouse support.
hintbooleantrueToggle command hints.
notificationbooleantrueToggle notifications for restricted keys.
enabledbooleantrueWhether the plugin is enabled by default.

For a complete list of options and their configurations, visit the default config.

Join our Community and Contribute

We welcome everyone to contribute and improve hardtime.nvim. Please read our CONTRIBUTING.md for more details. 👥

Become part of our growing community of contributors and transform your Neovim experience!

1 comment
seymurkafkas
Dec 6, 2024

I remember spending an entire weekend just adjusting my neovim config :P Nice project.

Sign in to comment.