Tổng hợp phím tắt của Visual Studio Code

Tổng hợp phím tắt của Visual Studio Code
Estimated Reading Time: 5 mins

Lời nói đầu

Trong những năm qua, tôi đã sử dụng một loạt các Code Editor khác nhau; TextMate, Php Storm, Sublime Text, Atom, và mỗi cái có những ưu điểm và nhược điểm khác nhau. Tuy nhiên, Visual Studio Code thì tôi đã hoàn toàn bị thuyết phục cho đến lúc này. Có rất nhiều các bài viết về tính năng vượt trội của nó so với các Code editor khác. Tuy nhiên trong bài viết này tôi sẽ chỉ chia sẻ về các phím tắt của Visual Studio Code sẽ giúp chúng ta tối ưu các thao tác hơn trong quá trình xử lý. Để xem bảng các phím tắt này chúng ta có thể bật Visual Studio Code lên và vào các mục File > Preferences > Keyboard Shortcuts. (Code > Preferences > Keyboard Shortcuts on macOS)

Các phím tắt dưới đây sẽ dùng cho macOS nếu bạn dùng Win chỉ cần thay ⌘ => Ctrl, ⇧ => Shift, ⌥ => Alt

Basic Editing

KeyCommand⌘XCut line (empty selection)⌘CCopy line (empty selection)⇧⌘KDelete Line⌘EnterInsert Line Below⇧⌘EnterInsert Line Above⌥↓Move Line Down⌥↑Move Line Up⇧⌥↓Copy Line Down⇧⌥↑Copy Line Up⌘DAdd Selection To Next Find Match⌘K ⌘DMove Last Selection To Next Find Match⌘UUndo last cursor operation⇧⌥IInsert cursor at end of each line selected⇧⌘LSelect all occurrences of current selection⌘F2Select all occurrences of current word⌘LSelect current line⌥⌘↓Insert Cursor Below⌥⌘↑Insert Cursor Aove⇧⌘\Jump to matching bracket⌘]Indent Line⌘[Outdent LineHomeGo to Beginning of LineEndGo to End of Line⌘↓Go to End of File⌘↑Go to Beginning of File⌃PageDownScroll Line Down⌃PageUpScroll Line Up⌘PageDownScroll Page Down⌘PageUpScroll Page Up⌥⌘[Fold (collapse) region⌥⌘]Unfold (uncollapse) region⌘K ⌘[Fold (collapse) all subregions⌘K ⌘]Unfold (uncollapse) all subregions⌘K ⌘0Fold (collapse) all regions⌘K ⌘JUnfold (uncollapse) all regions⌘K ⌘CAdd Line Comment⌘K ⌘URemove Line Comment⌘/Toggle Line Comment⇧⌥AToggle Block Comment⌘FFind⌥⌘FReplace⌘GFind Next⇧⌘GFind Previous⌥EnterSelect All Occurrences of Find Match⌥⌘CToggle Find Case Sensitive⌥⌘RToggle Find Regex⌥⌘WToggle Find Whole Word⌃⇧MToggle Use of Tab Key for Setting FocusunassignedToggle Render Whitespace⌥ZToggle Word Wrap

Rich Languages Editing

KeyCommand⌃SpaceTrigger Suggest⇧⌘SpaceTrigger Parameter Hints⇧⌥FFormat Document⌘K ⌘FFormat SelectionF12Go to Definition⌘K ⌘IShow Hover⌥F12Peek Definition⌘K F12Open Definition to the Side⌘.Quick Fix⇧F12Peek ReferencesF2Rename Symbol⇧⌘.Replace with Next Value⇧⌘,Replace with Previous Value⌃⇧⌘→Expand AST Selection⌃⇧⌘←Shrink AST Selection⌘K ⌘XTrim Trailing Whitespace⌘K MChange Language Mode

Navigation

KeyCommand⌘TShow All Symbols⌃GGo to Line...⌘PGo to File..., Quick Open⇧⌘OGo to Symbol...⇧⌘MShow ProblemsF8Go to Next Error or Warning⇧F8Go to Previous Error or Warning⇧⌘PShow All Commands⌃⇧TabNavigate Editor Group History⌃-Go Back⌃-Go back in Quick Input⌃⇧-Go Forward

Editor/Window Management

KeyCommand⇧⌘NNew Window⇧⌘WClose Window⌘WClose Editor⌘K FClose Folder⌘\Split Editor⌘1Focus into First Editor Group⌘2Focus into Second Editor Group⌘3Focus into Third Editor Group⌘K ⇧⌘←Move Editor Left⌘K ⇧⌘→Move Editor Right⌘K ←Move Active Editor Group Left⌘K →Move Active Editor Group Right⌃⌘→Move Editor into Next Group⌃⌘←Move Editor into Previous Group

File Management

KeyCommand⌘NNew File⌘SSave⌥⌘SSave All⇧⌘SSave As...⌘WClose⌥⌘TClose Others⌘K WClose Group⌘K ⌘WClose All⇧⌘TReopen Closed Editor⌘K EnterKeep Open⌃TabOpen Next⌃⇧TabOpen Previous⌘K PCopy Path of Active File⌘K RReveal Active File in Windows⌘K OShow Opened File in New Window

Display

KeyCommand⌃⌘FToggle Full Screen⌘K ZToggle Zen ModeEscape EscapeLeave Zen Mode⌘=Zoom in⌘-Zoom out⌘Numpad0Reset Zoom⌘BToggle Sidebar Visibility⇧⌘EShow Explorer / Toggle Focus⇧⌘FShow Search⌃⇧GShow Source Control⇧⌘DShow Debug⇧⌘XShow Extensions⇧⌘UShow Output⌃QQuick Open View⇧⌘COpen New Command Prompt⇧⌘VToggle Markdown Preview⌘K VOpen Preview to the Side⌃`Toggle Integrated Terminal

Search

KeyCommand⇧⌘FShow Search⇧⌘HReplace in Files⌥⌘CToggle Match Case⌥⌘WToggle Match Whole Word⌥⌘RToggle Use Regular Expression⇧⌘JToggle Search DetailsF4Focus Next Search Result⇧F4Focus Previous Search Result↓Show Next Search Term↑Show Previous Search Term

Preferences

KeyCommand⌘,Open Settings⌘K ⌘SOpen Keyboard Shortcuts⌘K ⌘TSelect Color Theme

Debug

KeyCommandF9Toggle BreakpointF5StartF5Continue⌃F5Start (without debugging)F6PauseF11Step Into⇧F11Step OutF10Step Over⇧F5Stop⌘K ⌘IShow Hover

Tasks

KeyCommand⇧⌘BRun Build Task⇧⌘TRun Test Task


Reference Links:

Hashtags: