Basic usage and parameters of vim

Source: Internet
Author: User
Tags line editor

About VIM
Vi:visual Interface, Text editor
Text: ASCII, Unicode
Type of text editing:
Line Editor: SED
Full Screen Editor: Nano, VI
Vim-vi improved
Other editors:
Gedit a simple graphical editor
Gvim a graphical version of the VIM editor

Open file: # vim [OPTION] ... File ... +#: After opening the files, leave the cursor at the beginning of the # line, + default end of line +/pattern: After opening the file, leave the cursor at the beginning of the first line that is matched by PATTERN –b file binary opening  Pieces –d file1 file2 ... Compare multiple Files-m file read-only open files ex file or vim–e directly into ex mode? If the file exists, the file is opened and the content is displayed if the file does not exist, it is created when the first disk is edited         Type: Keystroke behavior is dependent on Vim's "mode" three main modes: command (Normal) mode: default mode, move cursor, cut/paste text? HJKL Insert or edit mode: Modify text  Extended commands (Extended command) mode: Save, exit and so on ESC key exit current mode ESC key always return to command mode mode conversion: Command mode------insert mode I:insert,          Enter I at the cursor location: Enter A:append at the beginning of the line at the current cursor, enter a: At the end of the line where the cursor is located enter O: Opens a new row below the line where the current cursor is located     O: Opens a new row insert mode at the top of the current cursor line--------> Command mode ESC command mode--------> Extended Command mode: Extended Command mode--------> Command mode esc,enter close file extension mode:: Q exit: q! Force exit, discard the changes made: Wq Save exit: X Save exit: W filename Save as: w!    FileName Force save overwrites the filename File command mode:    ZZ: Save exit ZQ: Do not save exit Extension mode: Press ":" Into ex mode to create a command prompt: At the bottom of the screen left command: W write (Save) disk File Wq Write and exit x write and exit Q exit q! Do not save the exit, even if the change will be lost r filename Read file contents into the current file W filename writes the current file contents to another file!command executes the command r!          command to read commands to output characters jump: H: Left L: Right J: down K: Up #COMMAND: Jump by # Specify the number of characters between words jump: w: The first word of the next word         E: The ending of the current or next word B: the first word of the current or previous word #COMMAND: The number of words that are specified for a jump at a time by # current page jump: H: Top M: Page Middle row         L: End of header line end jump: ^: Jump to the first non-whitespace character at the beginning of the line 0: jump to the beginning of the row $: jump to the end of lines move: #G, Extended mode: #: Jump to the line specified by #     G: Last line 1G, GG: Move between the first line:): Next sentence (: Move between the previous sentence:}: Next paragraph {: Previous paragraph ctrl+f: Flip a screen to the end of the file         Ctrl+b: Turn to the file header ctrl+d: Half-screen to the end of the file Ctrl+u: half-screen character editing to the file header: x: Delete the character at the cursor #x: Delete the # characters at the beginning of the cursor XP: Swap the position of the character at the cursor and its trailing character ~: Convert case J: Remove line breaks after the current line    Replace command (R, replace) R: Replace the character at which the cursor is located r: Switch to replace mode Delete command: D: Delete command, can be combined with the cursor jump character, to achieve range deletion d$:          Delete to end of line d^: Delete to non-empty header d0: Delete to beginning dw:de:db: #COMMAND DD: Delete the line where the cursor is located         #dd: Multi-line Delete D: from the current cursor position is deleted to the end of the line, leaving blank lines, equivalent to the d$ copy command (Y, yank): Y: Copy, behaves similar to the D command y$ y0  y^ ye yw yb #COMMAND yy: Copy line #yy: Copy multiple lines Y: Copy entire line Paste command (p,     Paste): P: If the buffer is an entire row, paste the current cursor below the row, or paste it at the end of the current cursor at the end of the P: if the buffer is a whole row, paste the current cursor over the row, or paste to the front of the current cursor where it is located.        Alter command (c, change) C: Modify after switching to insert mode Command mode--insert mode C $ c^ c0 CB CE CW #COMMAND cc: Delete the current line and enter new content, equivalent to S #cc: C: Delete the current cursor to the end of the line and switch to insert mode 100iwang [ESC] Paste "Wang" 100 times <st             Art Position><command><end position> command:y copy, d Delete, GU to uppercase, GU to lowercase for example         The 0y$ command means:    0→ first to the costume y→ from here copy $→ copy to the last character of the line ye copy from the current position to the last character of the word address delimitation               : Start_pos,end_pos # line, for example, 2 means line 2nd #,# from the left # represents the starting line, to the right # indicates the end line #,+# from the left # represents the starting line, plus the right # represents the number of rows   : 2,+3 represents 2 to 5 rows. The last row of the current line., $-1 the current line to the penultimate line% full text, equivalent to 1,$/pat1/,/pat2/from the first time by PAT1 mode            The line that matches to begins, until the end of the line to which the first time the PAT2 match #,/pat//pat/,$? Usage: followed by an edit command D y w file: Save a range of rows to a specified file R file: at the specified location Insert all content in the specified file find/pattern: From the current cursor to the end of the file to find? PATTERN: Finds n from the current cursor to the file header: Same direction as command N: with command reverse direction s: Complete the Find replacement operation format in extended mode: s /What to look for/replace with content/modifiers to find: what you can replace with: you can't use patterns, but you can use \1, \2, ... You can also use "&" to refer to the entire content modifier found when you first looked up: I: Ignore case g: global substitution; By default, eachThe row only replaces the first occurrence of the GC: global substitution, which asks for the delimiter in the find substitution before each substitution/can be substituted with other characters, for example [Email protected]/[email prote         Cted]/[email protected] s#/boot#/#i undo Changes: U undo Recent Changes #u撤销之前多次更改 u undo cursor falls on this line after all the changes of this row Press Ctrl-r to redo the final undo change.          Repeat the previous action N. Repeat the previous action N times the Register of Vim has 26 named registers and 1 unnamed registers, often storing different contents of the Clipboard, you can share the register name, a, b,..., z, in the format: "Register is placed between the number and the command          such as: 3 "tyy means copy 3 rows to the T register" TP means to paste the T register content is unspecified, will use the unnamed register with 10 digital registers, with 0,1,...,9, 0 to hold the most recently copied content, 1 to store the most recently deleted content. When new text changes and deletions, 1 dumps to 2, 2 dumps to 3, and so on. Digital registers cannot be shared between sessions edit binary files open file in binary mode vim–b binaryfile extended command mode, Xxd command converted to readable 16 binary:%!xxd Edit binary Piece extended Command mode, use the XXD command to convert back to binary:%!xxd–r Save exit Visualization mode allows selection of text block V for character v facing line Ctrl-v polygon          The block visualization key can be used with the move key combined with: W)} arrows and other highlighted text can be deleted, copied, changed, filtered, searched, replaced, etc. multi-file mode vim FILE1 FILE2 FILE3 ... : Next Next:p Rev previous: first one: Last          : Wall Save All: Qall exit all: Wqall use multiple Windows multi-file segmentation vim-o|-o FILE1 FILE2 ...-o: Water Flat Split-o: Vertical split between windows toggle: Ctrl+w, Arrow Single File window split: ctrl+w,s:split, Horizontal split Ctrl+w,v:vertica L, Vertical split ctrl+w,q: Cancel adjacent window ctrl+w,o: Cancel all windows: Wqall exit custom Vim's working feature profile: Permanent effective Global:/etc/vim RC Personal: ~/.VIMRC Extended Mode: Current VIM process valid (1) line number display: Set numbers, abbreviated set NU Suppress: Set Nonu Mber, shorthand for set Nonu (2) ignores character case-enabled: Set IC does not ignore: Set Noic (3) Auto indent enabled: Set AI disabled: SE T Noai (4) Smart indent enabled: Smartindent set si disabled: Set Nosi (5) Highlight search enabled: SE T hlsearch disable: Set Nohlsearch (6) syntax highlighting enabled: syntax on disabled: syntax off (7              Display tab and newline characters ^i and display enabled: Set list disabled: Set Nolist (8) file format enable Windows format: Set Fileformat=dos Enable UNIX format: SET Fileformat=unix shorthand: Set Ff=dos|unix (9) Setting text width enabled: Set textwidth=65 (VIM only) disabled: SE T Wrapmargin=15 (10) Sets the identification line of the line where the cursor is enabled: Set Cursorline, Shorthand cul disabled: Set no Cursorline (1          1) Replication retention format enabled: Set paste disabled: Set Nopaste set Help: Assist Option-list:set Or:set all Vi/vim built-in Help : Help:help topic Use:q to exit Help Vimtutor

%[email protected]^# ([[: space:]]+.) [Email Protected]\[email protected]
%[email protected]^# ([[: space:]]+.
) @\[email protected]

Basic usage and parameters of vim

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.