Customizing Options: Keyboard

==Control Settings==
These control settings files can be altered to modify the Keyboard tab & its dialog.
* resource/OptionsSubKeyboard.res
* resource/OptionsSubKeyboardAdvancedDlg.res
==scripts/kb_def.lst==
 This file is not used anymore; use cfg/config_default.cfg to define a default keyboard layout.
==cfg/config_default.cfg==
The config_default.cfg provided in a Source game doesn't have all of the archived ConVars that config.cfg does, you don't need to put the ConVars from config.cfg into config_default.cfg as you should only worry about binds. 
The config_default.cfg from Half-Life 2/hl2/cfg looks like this:
 // YWB 10/10/03: 
 // If the user doesn't have a config.cfg when they run,
 // this gets executed the first time they run the engine
 // It doesn't execute if they have their own config.cfg saved out.
 unbindall
 
 bind "ESCAPE" 		"cancelselect"
 bind "`" 		"toggleconsole"
 bind "w"		"+forward"
 bind "s"		"+back"
 bind "a"		"+moveleft"
 bind "d"		"+moveright"
 bind "SPACE"		"+jump"
 bind "CTRL"		"+duck"
 bind "e"		"+use"
 bind "c"		"impulse 50"
 bind "r"		"+reload"
 bind "ALT"		"+walk"
 bind "SHIFT"		"+speed"
 bind "MOUSE1"		"+attack"
 bind "MOUSE2"		"+attack2"
 bind "f"		"impulse 100"
 bind "1"		"slot1"
 bind "2"		"slot2"
 bind "3"		"slot3"
 bind "4"		"slot4"
 bind "5"		"slot5"
 bind "6"		"slot6"
 bind "7"		"slot7"
 bind "MWHEELUP" "invprev"
 bind "MWHEELDOWN"	"invnext"
 bind "q"		"lastinv"
 bind "F5"		"jpeg"
 bind "F6"		"save quick"
 bind "F9"		"load quick"
 bind "PAUSE" 		"pause"
 bind "z"		"+zoom"
 bind "g"		"phys_swap"
 //bugbait switch
 bind "x"			"bug_swap"
 
 // on Mac don't cause CTRL to be bound as it doesn't play well with mouse wheel
 // move duck and walk across one key as we had the command key to play with
 bind_mac "ALT"	"+duck"
 bind_mac "LWIN"	"+walk"
 unbind_mac "CTRL" 
 // F9 is Expose by default so move it to F8 on Mac
 bind_mac "F8"			"load quick"
 unbind_mac "F9"
==scripts/kb_act.lst==
The keyboard commands refers to the list of commands and headers in scripts/kb_act.lst that appears in the keyboard tab of the options dialog.
To create a header, use the following format in your kb_act.lst:
 "blank"					"=========================="
 "blank"					"#Localized_String"
 "blank"					"=========================="
The tokenized string should be put in your mod's localized string files (i.e. valve_english.txt).
Here's what the kb_act.lst from Source SDK Base 2013 Singleplayer/hl2/scripts looks like:
 "blank"			"=========================="
 "blank"			"#Valve_Movement_Title"
 "blank"			"=========================="
 "+forward"				"#Valve_Move_Forward"
 "+back"					"#Valve_Move_Back"
 "+moveleft"				"#Valve_Move_Left"
 "+moveright"			"#Valve_Move_Right"
 "+speed" 	"#Valve_Sprint"
 "+jump"					"#Valve_Jump"
 "+duck"					"#Valve_Duck"
 "blank"			"=========================="
 "blank"			"#Valve_Combat_Title"
 "blank"			"=========================="
 "+attack"				"#Valve_Primary_Attack"
 "+attack2"				"#Valve_Secondary_Attack"
 "+reload"				"#Valve_Reload_Weapon"
 "+use"					"#Valve_Use_Items"
 "phys_swap"				"#Valve_Gravity_Gun"
 "impulse 100"			"#Valve_Flashlight"
 "+zoom"					"#Valve_Suit_Zoom"
 "impulse 50"			"#Valve_Commander_Mode"
 "slot1"					"#Valve_Weapon_Category_1"
 "slot2"					"#Valve_Weapon_Category_2"
 "slot3" 				"#Valve_Weapon_Category_3"
 "slot4"					"#Valve_Weapon_Category_4"
 "slot5"					"#Valve_Weapon_Category_5"
 "slot6"					"#Valve_Weapon_Category_6"
 "invnext"				"#Valve_Next_Weapon"
 "invprev"				"#Valve_Previous_Weapon"
 "lastinv"				"#Valve_Last_Weapon_Used"
 "blank"			"=========================="
 "blank"			"#Valve_Miscellaneous_Title"
 "blank"			"=========================="
 "incrementvar closecaption 0 1 1"	"#Valve_CC_Toggle"
 "jpeg"					"#Valve_Take_Screen_Shot"
 "save quick"			"#Valve_Quick_Save"
 "load quick"			"#Valve_Quick_Load"
 "pause"					"#Valve_Pause_Game"
 "quit"					"#Valve_Quit_Game"
 "toggleconsole"			"#Valve_Console_Toggle"
 "blank"			"=========================="
 "blank"			"#Valve_Miscellaneous_Keyboard_Keys_Title"
 "blank"			"=========================="
 "+walk" 	"#Valve_Walk"
 "+left"					"#Valve_Turn_Left"
 "+right"				"#Valve_Turn_Right"
 "+moveup"				"#Valve_Swim_Up"
 "+movedown"				"#Valve_Swim_Down"
 "+lookup"				"#Valve_Look_Up"
 "+lookdown"				"#Valve_Look_Down"
 "+strafe"				"#Valve_Strafe_Modifier"
 "+klook"				"#Valve_Keyboard_Look_Modifier"
As you can see, the format of adding a command to the list is very simple. Note also that any commands with "+" create a "-" command when you lift the key. For example, creating the custom command "+camera" and binding it to "TAB". When you press TAB, check the console and you will see:
Unknown command: +camera
Unknown command: -camera
Keep this in mind when designing your custom keyboard commands.
==See also==
*, the console command used for assigning keys functions (also lists related commands).
category:Technical
Category:Modding