Linux operation and Maintenance Phase II (ii) VI EditorVI Editor (full-screen plain text editor)1. Command mode, insert mode, last line mode2. a insert in the word specifier the cursor a at the end of the line where the cursor is insertedI insert in the word match either the cursor i insert at the beginning of the line where the cursoro insert a new line un
The VI Editor is a text tool that handles ASCII data. Most Linux distributions already have the VI editor installed by default. VI is the abbreviation for Visual interface vim is the visual interface improved is the enhanced version of the VI,VIM default support code commands are highlighted, which makes the text easier to read. VI There are two kinds of configur
This contact should be at 37, since it is necessary to modify the service time of some serversThis part should belong to the focus, about the VI of a lot of things, seemingly out of a few books specifically about VI. There are cows who use this program super fast. For most of us, it's OK to use them.Vim/vi is a powerful screen text editor, the most commonly used text editor on
about two windows open fileInsert mode
Input I: Insert before cursor I: Insert a at the beginning of the cursor: Insert a: At the end of the line insert O: Insert a new line under the cursor o: Insert a line on the cursor press ESC to enter command modeEdit mode
Press Colon to enter edit mode from command mode and press ENTER to enter command mode again. Eg:setnu
When exiting VI: Command mode, press ZZ to exit: Q
Set line number: Set Nu Cancel line number: Set Nonu config file: Home dir
section.----------------------------------------------------------------------Input modeESC enters edit mode----------------------------------------------------------------------Last-line mode: : :!: x equals: Wq:/?: s/Where%s can express full-text SearchOpen multiple Files: Next switches to the next fileVim can open multiple files at the same time by default displaying the first parameter of the file.:p Rev Switch to previous file: Last switch to final file: first switch to file one: QA Exits
Tags: line number document encryption Auto Sharp CTRL Jump Indent View text bodyGconf-editor # Configuration Editor/ETC/VIMRC # Profile path vim +24 file # Open files Navigate to the specified line vim file1 file2 # Open multiple files Vim-o2 file1 fil E2 # Vertical split screen vim-on file1 file2 # Horizontal Split-screen SP filename # up and down split open new file VSP
you want to edit the text: Start vim, enter command mode, press I, switch to input mode.Command mode has only some of the most basic commands, so you still have to rely on the bottom line command mode to enter more commands.Input modePress I in command mode to enter the input mode.In input mode, you can use the following keys:
character keys and shift combinations , enter characters
Enter, enter, line break
Back SPACE, backspace key, delete the previous charact
/This/that/ g/usr/bin directory Replacement/home:% s/\/usr\/bin/\/home/g Add a word at the beginning of each line Linux:% s/^/linux/ G Add a S to each word:% s/$*\>/s/g: Suspend VI temporarily put the rest in the background. Recovery with FG (^Z)Defining shortcut keys in vimDefinition Format: Map f2-f4 Execute commandUse the method to execute in VIM: Map RoleExit the last line mode and try F2 in command m
Linux does not have the concept of Windows, to edit a file must have a minimum of two ribbon1. Edit Area2. Functional areaFunctional areawindow: Click the various buttons on the menu bar or ALT + Shortcut-----> Perform functions that cannot be performed (such as Save, copy, paste, etc.)Linux: Press a special key to enter the function editing area, and then press different keys to achieve different functions
Linux in the use of VI editor, VI appeared in the case of the card, and this situation often occurs, what is the cause of the VI card dead? The following small series to introduce the next VI card dead solution.
Opened another terminal to enter and exit the Strace, and found the card dead in the Connect function
Process 12251 Attached–interrupt to quit
Connect (4, {sa_family=af_file, path= "/dev/gpmctl"
beginning of the cursorx: Delete a character at the cursorR B: Replace the character at the cursor with B and then: R N Replace the character at the cursor with nR: Continuously right from the cursor until you press the ESC key to stopU: Undo Previous ActionU: Undo all changes to the current rowCtry+r: Anti-revocation--------------------Enter in command mode: Enter the last line mode--------------------------------------------------W: SaveQ: ExitWQ: After saving, exit is the same as X.q!: Do no
Description : This is a relatively simple bash script editor, but has been tested. The reason for writing this blog is to practice the loop control language, functions, positional parameters, local variables, and function parameter calls, as well as calls between functions, as well as parameters for obtaining user options and options.Note: The script options and the script options parameter get method use getopt and make further judgments, consult the
Tags: linux--vim editor details vim16. Use Vim to edit multiple filesUsage:Vim FILE1 FILE2 FILE3Switch between files:Last-line mode:: Next switches to the next file: prev Switch to previous file: Last switch to final file: first to switch to file oneExit: QA All exits17, split screen display a file.Ctrl+w, S: Horizontal splitter windowCtrl+w, V: Vertical splitter windowToggle the cursor between windows:CTRL
contents of the next n rowsP: Paste operations on copied content4. Related Quick actionU:undo RevocationJ: Merge up and down two linesR: Single character substitution.: Repeatedly upload the most recent instructionsDrwxr-xr-x, 2 Haifeng haifeng 4096 September 21 09:38 's PhotosSeparate: Master permissions same group user rights other groups user rights file group of owner fileMaster: Haifeng to file permissions: R read W write X ExecuteSame group of users: Huo to file permissions: R Read W writ
Delete one character: XDelete one line of characters: DDRecover Delete: UCancel command: Ctrl+r Copy and paste: P y Paste: PCopy: Y Find string:/ Find string in current text hello: ":/hello" Jump to a line: G or: N The command ": N" allows the cursor to jump to a low n line, or "NG" jumps to the nth row. Note G must be capitalized.This is useful when modifying the error line of a program or debugger. Vim Learning Document: Enter Vimtutor in bash.Format settings for 4.vimNumber of spaces
This article is your own study notes, welcome reprint, but please specify the source: http://blog.csdn.net/jesson20121020The most powerful text editor under Linux is Vi/vim, and its commands, if used flexibly, are more efficient than other text editors when writing programs or editing text.Vi/vim There are no menus, only commands, there are three modes of operation: Command mode, insert mode, and edit mode,
edit operationThe continuous u command undoes the previous n edit operations#u: Undo Recent # edits directlyUndo the most recent undo action: Ctrl+r12. Repeat the previous edit operationDot character.13, the visualization mode is used to delete the copy and paste operationsV: Select by characterV: Select by rectangle14, find (support regular expression, in the last row mode)/pattern from yourselves to tail? PATTERN from current to headerN: Find from top to bottomN: Find from bottom to topXV, fi
Tags: filename mode vi editor Common data characters size Delete InuxVI filename into VI modeFirst the most commonly used DD: delete the whole line where the cursor is located ;D1G: Removes all data from the first row of the cursor;DG: Removes all data from the cursor to the last line;d$: Delete the cursor to the last character of the row;D0: Deletes the first character of the line to which the cursor is located;x: Delete, equivalent to delete key;X:
Tags: Vim editor command copy operation edit mode position Ctrl Expand CtrThree modes of VIM: Command line mode, edit mode, extended mode1: Common operations in command line modeDeleteA): DD deletes the cursor as it moves forwardb): NDD delete n rows after the current line of the cursorCopyc): YY copy cursor where you are moving forwardd): Nyy The N rows after the current line where the cursor is copiedPastee): P Paste the next line of the cursorf): N
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.