Depending on your preference, you can get this feature using a (the easiest way) or by installing standalone mods for Forge or Fabric. Option 1: Use a Custom Client (Easiest)
: Supports version 1.18. Select 1.18 in the launcher, start the game, and press Right Shift to open the mod menu. Search for "Keystrokes" and toggle it on. How To Get KeyStrokes In Minecraft Version 1.18
If you prefer using the standard Minecraft launcher, you will need to install a mod loader first. For Forge Users Depending on your preference, you can get this
: Includes a built-in Keystrokes mod. You can customize the colors (including rainbow/chroma) and move the display by clicking "Edit HUD Layout" in the settings. Option 2: Standalone Mods (Manual Install) Search for "Keystrokes" and toggle it on
Getting in Minecraft 1.18 displays your movement (WASD) and mouse clicks (LMB/RMB) directly on your screen, which is especially popular for PvP or recording gameplay.
Custom clients come with Keystrokes pre-installed, so you don't have to manually download or move files.