CS2 key binds and config commands: bind, unbind, toggle, exec, and how CS2 saves your settings

Focused on discussions specifically about CS 1.6, including gameplay strategies, nostalgic content, and server recommendations.
Post Reply
ice
Site Admin
Posts: 93
Joined: Tue Aug 27, 2024 5:17 am

CS2 key binds and config commands: bind, unbind, toggle, exec, and how CS2 saves your settings

Post by ice »

Quick summary

CS2 keeps your key bindings and console settings outside the in-game menus. If a bind stops working after an update, or you want the same setup on a second machine, the commands below are the ones that do the work. Valve publishes them in a single alphabetical table on the Developer Community wiki.

Commands that manage keys
  • bind: Bind a key.
  • unbind: Unbind a key.
  • unbindall: Unbind all keys.
  • binddefaults: Bind all keys to their default values.
  • bindss: Bind a key for a particular splitscreen player.
  • toggle: Toggles specified convar value on and off.
  • alias: Alias a command.
Valve's table marks each of these as a console command. All of them carry the release flag, and exec, execifexists and toggle are additionally marked norecord.

Loading and saving settings
  • exec: Execute a cfg file.
  • execifexists: Execute a cfg file if file exists.
  • host_writeconfig: Saves out the user config values.
  • writekeybindings: Saves current key bindings to disk.
  • cvarlist: Show the list of convars/concommands.
exec and execifexists are the pair worth knowing. exec runs a config file unconditionally, so a wrong path gives you nothing and no warning. execifexists runs the file only when it is actually there, which makes it the safer one to call from a startup config.

What to expect after an update

Valve's notes on the same page warn that some commands may be removed or hidden by default when the game receives new updates. A bind that works today can therefore disappear after a patch. Re-running the command, or pointing it at a config that still exists, is usually the fix.

Sources
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests