Vim Usage Guide

Vim is an advanced version of the Vi editor that provides more features while including the features of Vi. Vim can be operated with just the keyboard, enabling users to edit text rapidly without using a mouse. This post will summarize the basic usage and commands of Vim. Vim Modes Vim is divided into three main modes. Normal mode: This is the basic mode in which you can edit text or enter commands. Insert mode: This mode allows you to enter text, and you can add or modify text. Visual mode: This mode enables you to select text, and you can copy or delete the selected text. Normal Mode When you launch Vim, it starts in Normal mode by default. You can use the following commands in Normal mode. ...

July 6, 2024 · 3 min · 431 words · In-Jun Hwang

Useful VSCode Shortcuts Collection

Visual Studio Code (VSCode) is a free, open-source code editor developed by Microsoft. VSCode provides users with an efficient coding environment through various features including multi-language support, debugging, Git control, and plugin support. Let’s explore how to increase productivity and use VSCode more efficiently through various shortcuts. General Commands and Shortcuts Ctrl+Shift+P, F1: Opens the command palette where you can execute various commands, such as searching files or changing specific settings. Ctrl+P: Quickly search and open files. You can select from the file list by typing part of the filename. Ctrl+Shift+N: Open a new VSCode window or instance. Useful when working on multiple projects simultaneously. Ctrl+W: Close the current window or instance. Useful for quickly organizing multiple tabs. Ctrl+,: Open user settings to configure various environment settings like themes, font size, and extension settings. Ctrl+K Ctrl+S: Open keyboard shortcut settings to customize shortcuts according to your preferences. Basic Editing Features and Shortcuts Ctrl+X: Cut the current line when no text is selected. Cuts only the selected text when text is selected. Ctrl+C: Copy the current line when no text is selected. Copies only the selected text when text is selected. Alt+↓ / ↑: Move the current line up or down. Useful for rearranging code blocks. Ctrl+Shift+K: Delete the current line. Deletes all selected lines if multiple lines are selected. Ctrl+Enter / Ctrl+Shift+Enter: Insert a new line below/above the current line. Useful for quickly adding new code. Ctrl+Shift+\: Jump to the matching bracket. Helps in understanding nested brackets. Ctrl+] / Ctrl+[: Indent/outdent the current line. Useful for aligning code format. Home / End: Move to the beginning/end of the current line. Ctrl+Home / End: Move to the beginning/end of the file. Ctrl+↑ / ↓: Scroll up/down one line at a time in the current window. Useful for quickly scanning code. Alt+PgUp / PgDn: Scroll up/down one page at a time. Ctrl+Shift+[ / ]: Fold/unfold code regions. Useful for organizing code by hiding specific code blocks. Ctrl+K Ctrl+[ / ]: Fold/unfold all sub-regions. Ctrl+K Ctrl+0 / Ctrl+K Ctrl+J: Fold/unfold all code regions. Ctrl+K Ctrl+C: Add line comment to selected lines. Ctrl+K Ctrl+U: Remove line comment from selected lines. Ctrl+/: Toggle line comment for current line. Ctrl+Shift+A: Toggle block comment for selected block. Alt+Z: Toggle word wrap. Shows long lines wrapped to fit the screen. Rich Language Editing Features and Shortcuts Ctrl+Space, Ctrl+I: Show code completion suggestions while writing code. Ctrl+Shift+Space: Show parameter hints when calling functions. Ctrl+Shift+I: Automatically format the current document. Ctrl+K Ctrl+F: Automatically format the selected portion. F12: Go to definition at cursor position. Ctrl+Shift+F10: Preview definition at cursor position. Ctrl+K F12: Open definition at cursor position in new window. Ctrl+.: Show quick fixes for code errors. Shift+F12: Show references at cursor position. F2: Rename variable or function. Ctrl+K Ctrl+X: Remove trailing whitespace. Ctrl+K M: Change language mode of current file. Multi-cursor and Selection Features Alt+Click: Insert cursor at multiple positions. Shift+Alt+↑ / ↓: Add cursor above/below. Ctrl+U: Undo last cursor operation. Shift+Alt+I: Insert cursor at end of each selected line. Ctrl+L: Select current line. Ctrl+Shift+L: Select all occurrences of current selection. Ctrl+F2: Select all occurrences of current word. Shift+Alt+→ / ←: Expand/shrink selection. Shift+Alt+drag: Column (box) selection. Display Management F11: Toggle full screen mode. Shift+Alt+0: Toggle editor layout between horizontal/vertical. Ctrl+= / -: Zoom in/out. Ctrl+B: Toggle sidebar visibility. Ctrl+Shift+E: Show explorer or move focus to it. Ctrl+Shift+F: Show search panel. Ctrl+Shift+G: Show source control panel. Ctrl+Shift+D: Show debug panel. Ctrl+Shift+X: Show extensions panel. Ctrl+Shift+H: Use find and replace in files. Ctrl+Shift+J: Toggle search details. Ctrl+Shift+C: Open new command prompt or terminal. Ctrl+K Ctrl+H: Show output panel. Ctrl+Shift+V: Open Markdown preview. Ctrl+K V: Open Markdown preview to the side. Ctrl+K Z: Enable Zen mode. Press Esc twice to exit. Search and Replace Features Ctrl+F: Find in current file. Ctrl+H: Replace in current file. F3 / Shift+F3: Find next/previous match. Alt+Enter: Select all occurrences of find match. Ctrl+D: Add next occurrence to selection. Ctrl+K Ctrl+D: Move last selection to next find match. Navigation and Movement Ctrl+T: Show all symbols. Ctrl+G: Go to specific line. Ctrl+P: Go to specific file. Ctrl+Shift+O: Go to symbol. Ctrl+Shift+M: Show problems panel. F8: Go to next error or warning. Shift+F8: Go to previous error or warning. Ctrl+Shift+Tab: Navigate editor group history. Ctrl+Alt+-: Go back. Ctrl+Shift+-: Go forward. Ctrl+M: Toggle tab move focus. Editor Management and Shortcuts Ctrl+W: Close current editor. Ctrl+K F: Close current folder. Ctrl+\: Split editor horizontally. Ctrl+1 / 2 / 3: Focus first, second, third editor group. Ctrl+K Ctrl+← / →: Focus previous/next editor group. Ctrl+Shift+PgUp / PgDn: Move editor left/right. Ctrl+K ← / →: Move active editor group left/up or right/down. File Management and Shortcuts Ctrl+N: Create new file. Ctrl+O: Open file. Ctrl+S: Save file. Ctrl+Shift+S: Save file as. Ctrl+W: Close file. Ctrl+K Ctrl+W: Close all files. Ctrl+Shift+T: Reopen closed editor. Ctrl+K Enter: Keep preview mode editor. Ctrl+Tab: Open next editor. Ctrl+Shift+Tab: Open previous editor. Ctrl+K P: Copy path of active file. Ctrl+K R: Reveal active file in Explorer. Ctrl+K O: Open active file in new window/instance. Debug and Shortcuts F9: Toggle breakpoint. F5: Start/continue debugging. F11 / Shift+F11: Step into/out of code while debugging. F10: Step over code while debugging. Shift+F5: Stop debugging. Ctrl+K Ctrl+I: Show hover information. Integrated Terminal and Shortcuts Ctrl+`: Open integrated terminal. Ctrl+Shift+`: Create new terminal. Ctrl+Shift+C: Copy selected text. Ctrl+Shift+V: Paste selected text. Ctrl+Shift+↑ / ↓: Scroll up/down in terminal. Shift+PgUp / PgDn: Scroll up/down one page at a time. Shift+Home / End: Scroll to top/bottom of terminal. VSCode provides many more shortcuts beyond those introduced above. Let’s practice using VSCode shortcuts to code more efficiently. You can find the complete list of VSCode shortcuts here. ...

June 21, 2024 · 5 min · 943 words · In-Jun Hwang