Development

VI 편집기에서 자주 사용되는 단축키.

sonpro 2023. 3. 14. 20:10
반응형

Frequently

Frequently used shortcuts in VI editor

As a programmer, you might have heard of the VI editor. It is a powerful text editor that is widely used in the Unix/Linux environment. VI editor is a command-line editor that allows you to edit text files quickly and efficiently. However, it can be a bit intimidating for beginners. In this blog post, we will discuss frequently used shortcuts in VI editor that will help you to work more efficiently.

Summary

  • VI editor is a powerful text editor that is widely used in the Unix/Linux environment.
  • VI editor is a command-line editor that allows you to edit text files quickly and efficiently.
  • Frequently used shortcuts in VI editor include:
  • Moving the cursor: h, j, k, l
  • Inserting text: i, a, o
  • Saving and quitting: :w, :q, :wq
  • Undo and redo: u, Ctrl+r
  • Searching for text: /, ?
  • Copy and paste: yy, p
  • Learning these shortcuts will help you to work more efficiently in VI editor.

Moving the cursor

Moving the cursor is one of the most basic tasks in VI editor. You can move the cursor in four directions using the following keys:

  • h: Move the cursor left
  • j: Move the cursor down
  • k: Move the cursor up
  • l: Move the cursor right

These keys are used to navigate through the text file quickly. You can also use the arrow keys to move the cursor, but it is not recommended as it slows down your typing speed.

Inserting text

To insert text in VI editor, you need to switch to insert mode. There are three ways to switch to insert mode:

  • i: Insert text before the cursor
  • a: Insert text after the cursor
  • o: Insert text on a new line below the cursor

Once you are in insert mode, you can type the text you want to insert. To exit insert mode, press the Esc key.

Saving and quitting

Saving and quitting are two essential tasks in VI editor. To save a file, use the :w command. To quit VI editor, use the :q command. If you want to save the changes and quit, use the :wq command.

Undo and redo

Undo and redo are two powerful features in VI editor. To undo the last change, use the u command. To redo the last change, use the Ctrl+r command.

Searching for text

Searching for text is another essential task in VI editor. To search for text, use the / command followed by the text you want to search for. To search backward, use the ? command followed by the text you want to search for.

Copy and paste

To copy a line of text, use the yy command. To paste the copied text, use the p command. You can also copy multiple lines of text by specifying the number of lines before the yy command. For example, to copy three lines of text, use the 3yy command.

Conclusion

VI editor is a powerful text editor that can help you to edit text files quickly and efficiently. Learning frequently used shortcuts in VI editor will help you to work more efficiently. In this blog post, we discussed some of the most commonly used shortcuts in VI editor, including moving the cursor, inserting text, saving and quitting, undo and redo, searching for text, and copy and paste. We hope this blog post has been helpful in getting you started with VI editor.

반응형