KangMoo
    • 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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Vi / Vim 에디터 텍스트 편집기는 프로그래밍에서 중요한 도구 중 하나이다. 그중에서도 `Vi` 및 `Vim`은 강력한 기능을 제공하며, CLI(명령줄 인터페이스) 환경에서 효율적으로 텍스트 작업을 수행할 수 있게 한다. `VI`는 Unix 기반 운영체제에서 처음 소개된 텍스트 편집기로, 간단하면서도 강력한 기능을 제공한다. `VIM`은 "Vi IMproved"의 약자로, VI의 기능을 확장하여 더 많은 기능을 제공한다. VIM은 무료로 제공되며, 다양한 플랫폼에서 사용할 수 있다. 이 에디터는 진입장벽이 높은 편이지만, 마우스를 사용하지 않고 키보드만으로 텍스트를 효율적으로 편집할 수 있게 해주기 때문에 익숙해지기만 한다면 아주 효율적으로 텍스트를 편집할 수 있다. ## Vim 을 사용하는 이유 현대에는 많은 좋은 텍스트 편집기가 존재한다. 그럼에도 불구하고 `Vim`을 사용하는 이유는 다음과 같다. 1. CLI 환경에서 사용 가능: `Vim`은 CLI 환경에서도 사용 가능하다. 따라서 원격 서버에 접속하여 텍스트 파일을 편집할 때도 편리하다. 2. 다양한 플랫폼에서 사용 가능: `Vim`은 다양한 플랫폼에서 사용 가능하다. 따라서 어떤 환경에서도 일관된 환경에서 텍스트 편집을 수행할 수 있다. 3. 별도의 설치 없이 사용 가능: 대부분의 Unix 기반 운영체제에는 기본적으로 `Vim`이 설치되어 있다. 따라서 별도의 설치 없이 바로 사용할 수 있다. (윈도우에서는 별도의 설치가 필요하다) 서버는 주로 CLI 환경인 경우가 많고, 이 환경에서 텍스트 파일을 편집할 때 `Vim`은 매우 유용하다. 따라서 서버 관리자나 개발자들은 `Vim`을 익히는 것이 좋다. ## Vi의 세 가지 모드 ![image](https://hackmd.io/_uploads/HyoWYTpW0.png) Vi 에디터는 기본적으로 세 가지 모드로 작동한다 | 모드 | 설명 | | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | | 일반 모드 (Normal Mode) | Vi/Vim을 실행하면 기본적으로 이 모드에 진입한다. 텍스트를 편집할 때 명령어를 입력하거나 이동 작업을 수행할 수 있다. | | 입력 모드 (Insert Mode) | 텍스트를 입력할 때 사용하는 모드이다. `i` 키를 누르면 이 모드로 전환할 수 있다. 입력 모드에서는 일반적인 텍스트 에디터와 유사하게 입력할 수 있다. | | 명령 모드 (Command Mode) | `:` (콜론)을 입력하면 명령 모드로 전환된다. 이 모드에서는 저장, 종료 등 다양한 명령어를 사용할 수 있다. | > 이 외에도 비쥬얼 모드 (Visual Mode), 선택 모드 (Select Mode) 등 다양한 모드가 존재하지만, 여기서는 주로 사용되는 세 가지 모드에 대해서만 다룬다. ## Vi 열기 Vi로 텍스트 파일을 열 때는 다음과 같이 명령어를 입력한다. ```bash vi filename ``` 이 외에도 다양한 열기 방법들이 있다. | 명령어 | 설명 | | ------------------------------ | ----------------------------------------------------------- | | `vi {filename}` | 새로운 파일을 열 때 사용한다. | | `vi -r {filename}` | 이전에 작업하던 파일을 열 때 사용한다. | | `vi +{line_number} {filename}` | 지정한 라인부터 파일을 열 때 사용한다. | | `vi +/{pattern} {filename}` | 지정한 패턴을 검색하여 해당 라인부터 파일을 열 때 사용한다. | ## Vi 커서 이동 Vi 에디터에서는 다양한 방법으로 커서를 이동할 수 있다. 가장 일반적인 방법은 `h`, `j`, `k`, `l` 키를 사용하는 방법이다. ![image](https://hackmd.io/_uploads/SJJaKp6WA.png) `h` 키는 왼쪽으로, `j` 키는 아래로, `k` 키는 위로, `l` 키는 오른쪽으로 커서를 이동시킨다. 이 외에도 다양한 방법으로 커서를 이동할 수 있다. 주로 사용되는 몇 가지 방법들은 다음과 같다. | 키 | 설명 | | ---------------- | ------------------------- | | `h` | 왼쪽으로 이동 | | `j` | 아래로 이동 | | `k` | 위로 이동 | | `l` | 오른쪽으로 이동 | | `w` | 다음 단어로 이동 | | `b` | 이전 단어로 이동 | | `0` | 현재 라인의 처음으로 이동 | | `$` | 현재 라인의 끝으로 이동 | | `gg` | 파일의 처음으로 이동 | | `G` | 파일의 끝으로 이동 | | `{line_number}G` | 지정한 라인으로 이동 | | ... | ... | ## Vi 텍스트 편집 커서를 이동하였다면, 이제 원하는 텍스트를 편집할 차례이다. Vi 에디터에서 텍스트를 편집하기 위해서는 입력 모드로 전환해야 한다. 입력 모드는 일반 모드에서 특정 키를 눌러서 전환할 수 있다. | 키 | 설명 | | --- | ---------------------------------------- | | `i` | 현재 커서 위치에서 입력 모드로 전환 | | `a` | 현재 커서 다음 위치에서 입력 모드로 전환 | | `o` | 현재 커서 다음 라인에서 입력 모드로 전환 | | `I` | 현재 라인의 처음에서 입력 모드로 전환 | | `A` | 현재 라인의 끝에서 입력 모드로 전환 | | `O` | 현재 커서 이전 라인에서 입력 모드로 전환 | 입력 모드로 전환하면 일반적인 텍스트 에디터와 유사하게 텍스트를 입력할 수 있다. 사용자는 일반 모드와 입력 모드를 자유롭게 전환하면서 텍스트를 편집할 수 있다. ## 명령 모드 일반적인 텍스트 편집은 일반 모드와 입력 모드로 충분하다. 그러나 Vi 에디터는 명령 모드를 제공하여 다양한 명령어를 사용할 수 있다. 명령모드는 일반 모드에서 `:` (콜론)을 입력하면 전환할 수 있다. 그러면 하단에 `:` 문자가 나타나며, 다양한 명령어를 입력할 수 있다. 이 명령어를 통해 파일 저장, 종료, 검색 등 다양한 작업을 수행할 수 있다. | 명령어 | 설명 | | --------------------------- | --------------------------------------------------- | | `:w` | 저장 (Write) | | `:q` | 종료 (Quit) | | `:q!` | 강제 종료 (Quit). | | `:wq` | 저장 후 종료 (Write & Quit) | | `:wq!` | 강제 저장 후 종료 (Write & Quit) | | `:w {filename}` | 다른 이름으로 저장하기 | | `:set nu` | 라인 번호 표시 | | `:set nonu` | 라인 번호 숨기기 | | `:/{pattern}` | 지정한 패턴 검색 | | `:n` | 다음 검색 결과로 이동 | | `:N` | 이전 검색 결과로 이동 | | `:s/{pattern}/{replace}/g` | 지정한 패턴을 지정한 문자열로 대체 | | `:s/{pattern}/{replace}/gc` | 지정한 패턴을 지정한 문자열로 대체 (대체 여부 확인) | | `:set ic` | 대소문자 구분 없이 검색 | | `:set noic` | 대소문자 구분하여 검색 | | ... | ... | 이 기능들은 아주 간단한 것들이지만, 이를 조합하면 다양한 작업을 수행할 수 있다. 또한 이 외에도 수많은 명령어들이 존재하므로, 필요할 때마다 찾아서 사용하면 된다.

    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