About TF2 Configuration Files
This Guide will go over what TF2 Configuration files are. Click here to learn how to setup your own config files.
Configuration Files Are plain text files (file extension .cfg) that contain a list of console commands that are executed in order when the configuration file is executed by TF2. These console commands can change settings, bind commands to keys, define aliases and combinations of those, forming "scripts".
TF2s Configuration Files
TF2 executes specific congifuration files at specific times, from this we can apply specific settings (or scripts) at those specific times.
config.cfg | This file is where TF2 stores all your user settings. It executes when you open TF2. Do not put your custom commands/scripts in here since this file is edited directly by TF2. |
autoexec.cfg | This file executes when you open TF2 after config.cfg - Put your custom commands/scripts in here if you want to execute them when TF2 starts. |
demoman.cfg | This file executes when you change class to demoman (while playing). |
engineer.cfg | This file executes when you change class to engineer (while playing). |
heavyweapons.cfg | This file executes when you change class to heavy weapons guy (while playing). |
medic.cfg | This file executes when you change class to medic (while playing). |
pyro.cfg | This file executes when you change class to pyro (while playing). |
scout.cfg | This file executes when you change class to scout (while playing). |
sniper.cfg | This file executes when you change class to sniper (while playing). |
demoman.cfg | This file executes when you change class to soldier (while playing). |
spy.cfg | This file executes when you change class to spy (while playing). |
listenserver.cfg | This file executes when you create a game, directly after the map loads. |
Scripting with Configuration Files
Scripting is the use of configuration files (.cfg) to create new keybinds and aliases automating complex behaviors and console command sequences. Unlike hacking, scripting is built into Team Fortress 2 and is not banned by VAC (Valve Anti-Cheat). Uses of scripting vary from simply binding a key to a command to self-referential loops and nested aliases that redefine one another.
TF2 Wiki has a great article on Scripting with TF2 Config files here.