==日常编辑==
按住Ctrl滚滚轮,代码的字体会随你心意变大变小,对保护视力特别有好处。
在编辑区按住右键可拖动代码,省去拉(尤其是横向)滚动条之麻烦;相关设置:Mouse Drag Scrolling。
Ctrl+D可复制当前行或选中块。
Ctrl+Shift+C注释掉当前行或选中块,Ctrl+Shift+X则解除注释。
Tab缩进当前行或选中块,Shift+Tab减少缩进。
可拖动选中块使其移动到新位置,按住Ctrl则为复制到新位置。
按下Atl,再拖动鼠标,可以实现部分选择(即只选中一个区域内的字符,而不会包含它们所在行的其他字符)。
需要更大编辑空间时,F2和Shift+F2分别可以显隐下方Logs & others栏和左方的Management栏。
==导航相关==
? Ctrl+G 到达指定行,ALT+G 到达指定文件,Ctrl+Alt+G 到达指定函数(支持头文件中的函数定义),F11 切换源文件与头文件。
? Ctrl+PageUp 到达上一个函数,Ctrl+PageDown 到达下一个函数。
? Ctrl+B 添加书签,Alt+PageUp和Alt+PageDown可以切换书签。
? Ctrl+Shift+B可找到匹配的括号。
? 看长代码时,可右击,Folding->Fold All,然后慢慢展开来看,也可充分利用左方Management栏的Symbol浏览器。
? 在一个变量、函数或宏上右击,三个以Find开头的菜单项,分别可以为你转到它的声明、定义和找到所有出现的地方(按F2在下方Thread Search那里查看)。
其他:
? General Settings中可以设置缩进、自动换行等细节。
? 让Code::Blocks永远记住你的Layout,尤其是debug的layout,善用debug工具栏。
Ctrl+L 剪切选中行
F11 切换源文件与头文件
F10 全屏
Ctrl+Shift+B 括号匹配
按下ATL,再拖动鼠标,可以实现部分选择
Ctrl+B 添加书签,ALT+PageUp和PageDown可以切换书签。
Ctrl+G 到达指定行
ALT+G 到达指定文件
Ctrl+Alt+G 到达指定函数(支持头文件中的函数定义)
Ctrl+PageUp 到达上一个函数
Ctrl+PageDown 到达下一个函数
? 备份C:\Documents and Settings\[你的用户名]\Application Data\codeblocks\Default.conf,如遇重装,将其放在codeblocks.exe所在目录,就不会丢失你的配置;这样也可以打造出Code::Blocks的绿色版。
FN+F11 建立头文件(.h)
Ctrl+F9 编译
Ctrl+F10 运行
Ctrl+F11 编译和运行
快捷键
IDE
Function Shortcut Key
Undo last action Ctrl + Z
Redo last action Ctrl + Shift + Z
Cut selected text Ctrl + X
Copy selected text Ctrl + C
Paste text from clipboard Ctrl + V
Select all text Ctrl + A
Swap header / source F11
Comment highlighted code Ctrl + Shift + C
Uncomment highlighted code Ctrl + Shift + X
Duplicate line caret is on Ctrl + D
Auto-complete / Abbreviations Ctrl + Space / Ctrl + J
Show call tip Ctrl + Shift + Space
Swap line caret is on with line above it Ctrl + T
Toggle bookmark Ctrl + B
Goto previous bookmark Alt + PgUp
Goto next bookmark Alt + PgDown
Toggle current block folding F12
Toggle all folds Shift + F12
CodeBlocks代码编辑器组件提供的快捷键
Function Shortcut Key
Magnify text size. Ctrl + Keypad "+"
Reduce text size. Ctrl + Keypad "-"
Restore text size to normal. Ctrl + Keypad "/"
Cycle through recent files. Ctrl + Tab
Indent block. Tab
Dedent block. Shift + Tab
Delete to start of word. Ctrl + BackSpace
Delete to end of word. Ctrl + Delete
Delete to start of line. Ctrl + Shift + BackSpace
Delete to end of line. Ctrl + Shift + Delete
Go to start of document. Ctrl + Home
Extend selection to start of document. Ctrl + Shift + Home
Go to start of display line. Alt + Home
Extend selection to start of display line. Alt + Shift + Home
Go to end of document. Ctrl + End
Extend selection to end of document. Ctrl + Shift + End
Go to end of display line. Alt + End
Extend selection to end of display line. Alt + Shift + End
Expand or contract a fold point. Ctrl + Keypad "*"
Create or delete a bookmark. Ctrl + F2
Go to next bookmark. F2
Select to next bookmark. Alt + F2
Find selection. Ctrl + F3
Find selection backwards. Ctrl + Shift + F3
Scroll up. Ctrl + Up
Scroll down. Ctrl + Down
Line cut. Ctrl + L
Line copy. Ctrl + Shift + T
Line delete. Ctrl + Shift + L
Line transpose with previous. Ctrl + T
Line duplicate. Ctrl + D
Find matching preprocessor conditional, skipping nested ones. Ctrl + K
Select to matching preprocessor conditional. Ctrl + Shift + K
Find matching preprocessor conditional backwards, skipping nested ones. Ctrl + J
Select to matching preprocessor conditional backwards. Ctrl + Shift + J
Previous paragraph. Shift extends selection. Ctrl + [
Next paragraph. Shift extends selection. Ctrl + ]
Previous word. Shift extends selection. Ctrl + Left
Next word. Shift extends selection. Ctrl + Right
Previous word part. Shift extends selection. Ctrl + /
Next word part. Shift extends selection. Ctrl + \
Files
Function Shortcut Key
New file or project Ctrl + N
Open existing file or project Ctrl + O
Save current file Ctrl + S
Save all files Ctrl + Shift + S
Close current file Ctrl + F4 / Ctrl + W
Close all files Ctrl + Shift + F4 / Ctrl + Shift + W
CodeBlocks的Tab组件所提供的快捷键,这些快捷键不能重新绑定(rebound)。
Function Shortcut Key
Activate next open file Ctrl + Tab
Activate previous open file Ctrl + Shift + Tab
View
Function Shortcut Key
Show / hide Messages pane F2
Show / hide Management pane Shift + F2
Move project up (in Project tree) Ctrl + Shift + Up
Move project down (in Project tree) Ctrl + Shift + Down
Activate prior (in Project tree) Alt + F5
Activate next (in Project tree) Alt + F6
Zoom in / out Ctrl + Roll Mouse Wheel
Focus editor CTRL + Alt + E
Search
Function Shortcut Key
Find Ctrl + F
Find next F3
Find previous Shift + F3
Find in files Crtl + Shift + F
Replace Ctrl + R
Replace in files Ctrl + Shift + R
Goto line Ctrl + G
Goto next changed line Ctrl + F3
Goto previous changed line Ctrl + Shift + F3
Goto file Alt + G
Goto function Ctrl + Alt + G
Goto previous function Ctrl + PgUp
Goto next function Ctrl + PgDn
Goto declaration Ctrl + Shift + .
Goto implementation Ctrl + .
Open include file Ctrl + Alt + .
Build
Function Shortcut Key
Build Ctrl + F9
Compile current file Ctrl + Shift + F9
Run Ctrl + F10
Build and Run F9
Rebuild Ctrl + F11
Debug
Function Shortcut Key
Debug F8
Continue debugging Ctrl + F7
Step over a code block F7
Step into a code block Shift + F7
Step out of a code block Ctrl + Shift + F7
Toggle breakpoint F5
Run to cursor F4
Previous error Alt + F1
Next error Alt + F2