In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Vim is an up-compatible vi text editor that can be used to edit a variety of plain text. It is especially useful for editing programs.
Basic mode: edit mode: default edit file entry mode input mode: last line mode: built-in command line interface basically uses: # vim [options] [file..] + #: after opening the file, directly place the cursor at the beginning of line #; + / PATTERN: after opening the file, place the cursor on the line of the first line matched by PATTERN Mode conversion: edit mode: default mode edit mode-> input mode: i:insert, enter at the cursor; a: append, enter behind the cursor; o: open a new line below the cursor; I: enter at the beginning of the line where the cursor is located; A: enter at the end of the line where the cursor is located; O: open a new line above the cursor Input mode-> edit mode ESC key edit mode-> last line mode: key last line mode-> edit mode ESC key close file: 1. Edit mode: ZZ: save and exit; ZQ: exit directly without saving; 2. Enter the last line mode:: Q exit: Q! Forced exit without saving previous editing operations: wq save and exit;: W,: Q: X save and exit;: W / PATH/TO/SOMEFILE save to the specified file command mode cursor jump cursor jump: jump between characters h: left j: next k: above l: right now directly up and down keys # COMMAND: jump to the number of characters specified by #; jump between words w: the beginning of the next word E: the end of the current or next word; b: the beginning of the current or previous word; # COMMAND: jump to the number of words specified by #; jump at the beginning of the line ^: jump to the first non-white space character at the beginning of the line; 0: jump to the beginning of the line; $: jump to the end of the line; jump between lines # G: jump to the line specified by #; 1G, gg: first line; G: last line Jump between sentences:) next sentence (previous paragraph jump} next paragraph {previous paragraph flip screen: Ctrl+f: turn a screen to the end of the file Ctrl+b: turn a screen to the head of the file Ctrl+d: turn half the screen to the end of the file Ctrl+u: turn half the screen to the beginning of the file Enter: turn back the current page by line jump: h: top M: middle line L: bottom zt: move the cursor to the top of the screen zz: cursor Move the current line to the middle of the screen zb: move the current line of the cursor to the bottom of the screen editing command: character editing: default mode x: delete the character where the cursor is located # x: delete the # characters at the beginning of the cursor; xp: swap the position of the character where the cursor is located and the character following it; replace command (replace): r: replace the character where the cursor is located; rCHAR ~: switch case delete command: edit mode delete d: delete command, which can be combined with the cursor jump character to achieve range deletion; Dcancel: delete the character where the cursor is located to the end of the line D ^: delete the character where the cursor is located to the beginning of the line; d0: delete the character where the cursor is located to the beginning of the line Dw: delete the character from the cursor position to the beginning of the next word de: delete the character from the cursor position to the end of the current word or the next word db: delete the character # COMMAND: d: equivalent to d $dd: delete the line at the beginning of the cursor; # dd: delete the total # lines at the beginning of the line where the cursor is located Paste command (p, put, paste): edit mode paste p: if the content in the buffer is an entire line, it is pasted below the line of the current cursor; otherwise, it is pasted behind the current cursor; P: if the content of the buffer is the whole line, it is pasted above the line of the current cursor; otherwise, it is pasted in front of the current cursor Copy command (yank, y): edit mode copy y: copy, working behavior similar to d command Copy cursor position to the end of the line character y ^: copy the cursor position to the beginning of the non-blank line y0: copy the cursor position to the beginning of the line ye: copy the position of the cursor to the end of the current word or the next word yw: copy the cursor position to the beginning of the next word yb: copy the cursor position to the current word or The first character of the previous word # COMMAND yy: copy an entire line # yy: copy # line change command (change C): edit mode-- > input mode Implement delete operation Delete the character from the cursor position to the end of the line and switch to input mode; c ^: delete the character from the cursor position to the beginning of the line and switch to input mode; c0: delete the character from the cursor position to the beginning of the line and switch to input mode; cb: delete the character from the cursor position to the current word or the first word of the previous word and switch to input mode Ce: delete the character from the cursor position to the end of the current word or the next word and switch to input mode; cw: delete the character from the cursor position to the beginning of the next word and switch to input mode; # COMMAND cc: delete the line of the cursor and switch to input mode; # cc: delete line # and switch to input mode Other editing operations: visual mode: selected character v: selected by character; V: selected by line; combined with editing command: d, c, y undo (undo) operation: U: undo previous operation; # u: undo previous operation; undo previous undo: Ctrl+r repeats the previous editing operation:. Activity tutorial included with vim: vimtutorvim Last Line Mode: built-in Command Line Interface (1) address demarcation: start_pos [, end_pos] #: specific line #, for example, line 5 is line 5;.: current line; $: last line; #, #: specify line range, start line on the left and end line on the right #, + #: specify a line range, the left is the absolute number of the super starting line, and the right is the offset relative to the left line number; for example: 3 pattern/: 7., $- 1: the range is the current line refers to the penultimate line 1: the range is from the first line to the last line%: the full text / line starts from the cursor to the line to which the pattern matches the end of the file for the first time. / first/,$: starts at the cursor, the first time it starts with the line matched by pat1, all the lines in the middle of the last line / pat1/,/pat2/: start at the cursor, the first time from the line matched by pat1, to the end of the line matched by pat2 for the first time. Can be used with the editing command to achieve editing operations: d: delete lines within the delimited range y: address delimited followed by d to copy lines within the delimited range c: address delimited followed by d to replace lines within the delimited range and switch to input mode w / PATH/TO/SOMEFILE: save the text in the range to the specified file R / PATH/FROM/SOMEFILE: reads and inserts text from the specified file to the specified location; (2) find pattern match lookup / PATTERN: find all strings that can be matched by the current pattern from the current cursor to the end of the file;? PATTERN: find all the strings that can be matched by the current pattern from the current cursor to the head of the file; n: next, in the same direction as the command N: last, opposite to the direction of the command; (3) find and replace the command in s: last line mode; use format: s / what to find / replace with / modifier to find: regular expression can be used; replaced by content: regular expressions cannot be used, but can be referenced If the "what to find" section uses grouping symbols in the pattern: use backward references in "replaced with"; directly refer to all text matched by the pattern, use the & symbol; modifier: I: ignore case; g: global substitution, which means that if there are multiple matches in a line, all are replaced. You can replace the delimiter with other unused characters: swords @ swatches characters # example:% s @\ @ T\ 1g% s @\ @ & er@gvim 's multi-file function: multi-file: vim FILE1 FILE2... Switch between files:: next next: prev previous one: first first: last last exit all files:: wqall save all files and exit : wall: qall Multi-window: window split-o: horizontal split window-O: vertical split window switch between windows: Ctrl+w, ARROW Note: a single file can also be divided into multiple windows to view: Ctrl+w, s: horizontal split window Ctrl+w, v: vertical split window customize the working characteristics of vim: note: settings in the last line mode are only valid for the current vim process Permanent validity: global: / etc/vimrc user personal: ~ / .vimrc 1, line number display: set number, abbreviated to set nu cancel display: set nomber, set nonu 2, parenthesis match highlight match: set showmatch Set sm cancel: set nosm 3, Auto indentation enabled: set ai disabled: set noai 4, highlight search enabled: set hlsearch disabled: set nohlsearch 5, Syntax highlighting enabled: syntax on disabled: syntax off 6, ignore character case enabled: set ic disabled: set noic get help:: help: help subject
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.