JohnsonMao
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    3
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- title: 時間就是金錢 tags: VS Code date: 2021/8/17 --- ###### tags: `VS Code` ###### *date: 2021/8/17* # ⌨ 快捷鍵大師,時間就是金錢 ![快捷鍵大師,時間就是金錢](https://i.imgur.com/SzMnh4N.png) [TOC] ## 前言 還常常得使用滑鼠來操作 VS Code 嗎?想要更加提升自己的 Coding 效率嗎?沒錯!在這個效率至上的時代,一天 24 小時,人人都努力把任何一點點能省的時間榨出來,只要善用快捷鍵,人人都能成為<del>鍵盤俠</del>**快捷鍵大師**,這裡將會記錄著能提升效率的 VS Code 快捷鍵,從最簡單的開始,慢慢進階上去。 此筆記是以 Windows 操作,如果是 Mac 可能會有些許不一樣 Mac 需把 `Ctrl` 換成 `Cmd ⌘` ## 快捷鍵是什麼? 快捷鍵是使用鍵盤組合,來完成一個操作,加速操作效率。 都有碰電腦的人,想必大家都有使用過快捷鍵的功能了,對這些快捷鍵有如左右手般熟悉,最常見的快捷鍵就是 - 復原`Ctrl + Z` - 剪下`Ctrl + X` - 複製`Ctrl + C` - 貼上`Ctrl + V` - 全選`Ctrl + A` 這些快捷鍵,不管使用什麼軟體,幾乎都會有這個萬用的功能 ## 你應該嘗試看看 ### 導覽至檔案 - 別再左側資料夾慢慢找檔案,善用`Ctrl + E`或`Ctrl + P`搜尋檔案,就可以直接切換檔案 ![Ctrl + P](https://i.imgur.com/jHQoBOG.gif) *此圖範例為,快速導覽至 Nav.jsx* ### 選取 (反白) 單字組合技 - #### 選取整行,Ctrl + L 還在使用滑鼠選取整行程式碼嗎?可以嘗試看看使用`Ctrl + L`選取一整行唷 - #### 刪除整行,Shift + Delete 或 Ctrl + X 還在使用滑鼠選取整行程式碼後按`Backspace`嗎?可以嘗試看看使用`Shift + Delete`或`Ctrl + X`刪除一整行唷 - #### 反白,Shift + 方向鍵 還在使用滑鼠選取單字嗎?可以嘗試看看使用`Shift + 方向鍵`選取單字唷 - #### 單字間跳躍,Ctrl + 方向鍵 使用`Ctrl + 方向鍵`,能以單字最為單位,移動游標 ==注意== - 單字中有使用底線`_`,會視為與單字為一體 - 如果使用橫槓`-`,則會拆分單字 - 善用這個特性,可以提升開發效率 - #### 整行頭尾,Home 、 End 按鍵 - 使用`Home`能到游標那行句子的頭,在按一次會到最左側 - 使用`End`能到游標那行句子的尾巴 - #### 反白單字組合技 還在使用滑鼠連點選取單字嗎?可以嘗試看看使用`Shift + Ctrl + 方向鍵`選取整個單字唷 ![選取](https://i.imgur.com/fDzvWWO.gif) *此圖範例為,選取 PropTypes 單字* ### 選取同名字串 - 當想選取多個同名字串時,可以使用`Ctrl + D`,進行同名選取 ![change](https://i.imgur.com/zWquMNw.gif) *此圖範例為,選取 MyNavLink 換成 NavLink* ### 快速移動程式碼 - 還在整段複製貼上,移動程式碼嗎?可以嘗試看看使用`Alt + 上或下`來移動程式碼 ![move](https://i.imgur.com/YCYC974.gif) *此圖範例為,把整個`<ul>`進行移動* ### 快速複製程式碼 - 還在整段`Ctrl + C` + `Ctrl + V`,複製程式碼嗎?可以嘗試看看使用一個`Shift + Alt + 上或下`來複製程式碼 ![copy](https://i.imgur.com/Li08fjb.gif) *此圖範例為,把整個`<ul>`格式複製貼上* ### 搜尋、取代功能 - `Ctrl + F`,我想這應該是大家最常用、最熟悉的快捷鍵, 如同復原`Ctrl + Z`、剪下`Ctrl + X`、複製`Ctrl + C`、貼上`Ctrl + V`般熟悉 - `Ctrl + H`,我想這應該是大家常用,但不知道有這個快捷鍵,都是用`Ctrl + F`按出來 ![取代](https://i.imgur.com/vmIpAIu.png) 這還蠻常用的,像是 React 裡面 class 要換成 className 才能正常套用 取代功能簡略介紹 - 紅色框為你要搜尋的關鍵字 - 綠色框為要幫關鍵字修改成什麼 - 藍色框為,幫 ==所有== 關鍵字都替換成綠色框的字 - `Ctrl + Shift + F`,可以搜尋整個專案中出現的關鍵字 `Ctrl + Shift + E`,可以切換回專案檔案 ![search](https://i.imgur.com/mZ0w6q9.gif) *此圖範例為,搜尋整個專案的 addTodo* ### 新增檔案 - `Ctrl + N`,可以新增檔案,預設是`.txt`文字檔 如果想把它切換成程式語言,HightLight效果,可以使用以下其中一個快捷鍵 - `Ctrl + K + M`切換程式語言 - `Ctrl + S`先儲存並把副檔名改成你要的程式語言,有使用設計軟體的,應該對儲存功能的快捷鍵相當熟悉 ![HTML](https://i.imgur.com/Vi5ZXGn.gif) *此圖範例為,新增檔案並切換成 HTML 使用 HTML emmet* ### 搜尋 Symbol (變數、函數) - 當專案很大時,用滑鼠找很久,用`Ctrl + F`找又很多很雜 可使用`Ctrl + Shift + O`來搜尋 Symbol (變數、函數) ![deleteTodo](https://i.imgur.com/PTjyjfQ.gif) *此圖範例為,搜尋 deleteTodo 函式* ### 修改 Symbol (變數、函數) - 當游標在**Symbol**名稱時,按下`F2`可以幫變數重新命名 有使用到變數的都會跟著一起改 ==注意== `F2`的變數名稱修改優點,他只針對**變數名稱**,雖然字一樣,但是是字串型態,就不會跟著修改,如下圖 ![F2](https://i.imgur.com/hQSzktm.gif) *此圖範例為,將變數 num 修改成 abc,注意最下面 console.log('num')是字串,所以不會修改到* ### 在 VS Code 中使用終端機功能 - 使用`Ctrl + ‵`或`Ctrl + J`可以開啟/關閉終端機,除了可以使用 node.js,也支援 git ### 註解 - 使用`Ctrl + /`這應該也是大多數人知道的功能 - 使用`Alt + Shift + A`可以多行註解 ### 查看函數的實作 - 當你想查看函數是怎麼操作,可以對著函數名稱按下`F12`,會自動跳轉 - 如果不想跳轉,想開新視窗,就按`Ctrl + Shift + F12`,就不會發生跳轉 - 如果想要查看函數在哪些地方有用到,可以按`Alt + Shift + F12`,就可以看到 ![F12](https://i.imgur.com/JXJ5wgR.gif) *此圖範例為,查看 checkAllTodo 函式,不發生跳轉* ### 關閉/開啟左側選單 - 使用`Ctrl + B`就能關閉/開啟左側選單 ![選單](https://i.imgur.com/8zAL1he.png) *紅色框為左側選單* ## 比較少使用,但要使用時可以提高效率 ### 快速進行內容排版 - 使用`Shift + Alt + F`,就能快速為程式碼進行 Format 排版 ![Format](https://i.imgur.com/lJDcUXS.gif) *此圖範例為,使用`Shift + Alt + F`進行快速排版* ### 快速移動到指定行數 - 使用`Ctrl + G`輸入要去的行數數字,即可快速到達該行數 ### 幫所有分頁進行儲存 - 使用`Ctrl + Alt + S`,就能為所有分頁都進行儲存動作 ### 關閉/復原 分頁 - 當你想關閉當前的檔案分頁,可以按`Ctrl + W`關閉當前檔案 - 當你想關閉所有的檔案分頁,可以按`Ctrl + K + W`關閉所有檔案 - 當你想關閉所有**已儲存**的檔案分頁,可以按`Ctrl + K + U`關閉以儲存檔案 - 當你想復原剛剛關閉的分頁,可以按`Ctrl + Shift + T`復原分頁 ### 查看/關閉問題分頁 - 當打程式碼,有時候沒注意到問題,可以按`Ctrl + Shift + M`來初步查看問題分頁 ![question](https://i.imgur.com/8fQ9moF.png) *此圖範例為,a 的運算式沒輸入完* ### 切割視窗 - 可以使用`Ctrl + \`,進行切割視窗 ![window](https://i.imgur.com/o3VGJjd.gif) ### 摺疊/展開程式碼 - 當程式碼打太多時,想要摺疊某個段落,可以使用`Ctrl + K + [`摺疊,使用`Ctrl + K + ]`展開 ==注意== 我只有在日文或英文輸入法才可以使用 ![collapse](https://i.imgur.com/ahu3ork.gif) *此圖範例為,摺疊展開`<ul>`* ### 快速打開使用者設定 - 想要設定 VS Code 可以按`Ctrl + ,`來快速打開 ### 更多 keyboard [VS Code keyboard PDF](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf) ### 參考資料 - [VS Code keyboard PDF](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf) - [VS Code 快捷鍵大全](https://www.youtube.com/watch?v=8gJclv9z7I4) {%hackmd @JohnsonMao/theme-Wood-Fired %}

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully