First PartFirst section First: moving the cursor H left, J down, k up, L right Section Two: the entry and exit of Vim<ESC>: Make sure you're in normal mode : q! Exit editor (discard changes) Section three: deletion of text editsx key; Delete the character at the cursor position. Section Fourth: Inserting text editsI key: Inserts text at the cursor. Section Fifth: Adding text editsA key: Adds text at the end of the line. Section Sixth: Editing filesUse a file that can be changed (into the Vim editor): Shell input: Vim tutor< carriage return > Vim: Start Vim editor; Tutor: The name of the file you wish to edit wq< Enter;: Save exit Section Two: Delete class commandsDW: Delete the word where the cursor is located Second, section Two: more Delete commandsS $: Deletes from the cursor to the end of the current line. (entire line after the current position) Section II: About Commands and objects
Operator |
Action |
D (delete operator) |
W from the current cursor's current position until the beginning of the next word, excluding its first character |
E from the current cursor's current position until the end of the word, including the last character |
$ from current cursor current position until end of current line |
Section Fourth: Using counts to specify actionsAdd a number before the action to make it repeat so many times such as: 2w (the cursor moves forward two words), 3e (the cursor moves forward to the end of the third word), 0 (move the cursor to the beginning of the line) Section Fifth: Using counts to remove moreEnter a number when using the operator to make it repeat multiple times such as: d2w (delete two uppercase letters of the word) Format of modified commands in normal mode: operator (operator) [number] (numbers that can be appended, number of Delegates) motion (action) The second section sixth: operation of the whole lineDD: Delete the entire current line (2DD: Delete two rows) Section seventh: Undo Class CommandsU: Undo the modification of the whole line; u: Undo Last executed Command Ctrl +r: Undo Revocation Section three: Placing class commands
- The input DD will be deleted by a row and will be saved in a register of vim
- P Key: After placing the last deleted content in the cursor
Section Two: Replace class commandsR key: Replace the character at the cursor position Section three: Changing class commandsCe key: Change text until the end of a word (CW key is similar) Third, section Fourth: using C to change moreChange class operator Operation format: c [number] Motion such as: CW; change the word; C $ change the entire line after the cursor Chapter IV: Positioning and Document status
- Ctrl+g: Displays a status line that displays the currently edited file name and the cursor position (line number)
- G key: Causes the current cursor to jump directly to the last line of the file.
GG key: Causes the current cursor to jump directly to the first line of the file.
- Enter the previous line number +g, back to the forward
Section four: Search class commands/+ string: Finds the string in the current file
- N: Finds the same string, which can be found in the same direction;
- N: Find the same string in the opposite direction
- Replace/: Reverse Find string
- Ctrl+o: Back to the previous position;
Ctrl+i: Jump to a newer location After the search reaches the end of the file, it automatically resumes the search from the file header Section IV: Finding pairs of parentheses%: Find pairs of parentheses),],} (The cursor should be in the parentheses where you want to find it) Section Fourth: Replacement commandsReplace the first string in a line with old as the new string, type: s/old/new Replace all strings in a row with old as new string, type: s/old/new/g Replace the first string in two lines with the new string old, enter: #, #s/old/new/g (#, #代表的是替换操作的若干行中收尾的行号) Replace the first string in the file with the old string new, enter:%s/old/new/g Full-text substitution is to ask the user to confirm that each replacement needs to add a C flag:%S/OLD/NEW/GS Section V: Methods for executing external commands within VIM: command: Cursor moves to the bottom of the screen to enter commands then enter! Command: Allow external shell commands to be executed Such as::! ls;:! Dir Section II: More information on saving files: W Test: Save entire file as file name as test :!del Test: Delete the test file under MS-DOS :!rm Test: Delete the test file under Unix Section Five: a Selective Save commandSave part of the file in Visual mode: v motion:w FILENAME
- Move cursor
- Press the V key, move the cursor, highlight the text
- Press: Key, the bottom of the screen appears: ' <, ' >
- Enter W Test (test is a file name that is not used), enter
- Use:! Dir or:! LS View the stored file
Section Fourth: Extracting and merging filesTo insert the contents of another file into the current file, enter: R finename Example: R test Extracts the file named Test that you created earlier, and puts it behind the cursor : R!dir can read the output of the dir command and place it behind the cursor position of the current file Section Sixth: Opening class commandsO: Open a new line above the cursor and enter insert mode O: Open a new line below the cursor and enter insert mode The Sixth section Second: additional class commandsA: Insert text after cursor position A: Inserting text after the end of the line where the cursor is located E: You can move the cursor to the end of the word Section Sixth: Another version of the permutation class commandCapital R goes into replacement mode and can replace multiple characters consecutively until it returns to normal mode Sixth section IV: Copy and paste textUse V to enter visual mode, then use operator y to copy the text and paste with P. Sixth v.: Setting class command optionsInput: Set XXX can set XXX options: ' IC ' ignorecase ' ignores letter case when searching ' Is ' ' incsearch ' shows partial assignment when finding a phrase ' HLs ' hlsearch ' highlights all the matching phrases Option name can be either full version or abbreviated version Disable Ignore case:: Set Noic Remove the highlight of the match:: Nohlsearch Ignore letter case only on one lookup:\c:/ignore\c< carriage return > Section Seventh: Getting Help informationTo start the Help system: 1. 2.<f1> Key 3.help< Carriage Return > Example: Enter help cmd to find the cmd command. Input ctrl-w can jump between windows Enter:q< return > to close the Help window Section Seventh: Creating a startup script
- Start editing vimic file:: Edit ~/.vimic (Unix System)
- Read the contents of the Vimic sample file:: R $VIMRUNTIME/vimic_example.vim
- Save File:: Write
(Get syntax highlighting) The seventh section of the third Lecture: complete functioncommand line completion with ctrl-d and <TAB> Add: 1. Make sure VIM is not running in compatibility mode:: Set NOCP 2. Add a space, and a starting part of an existing file name, and press the <tab> key to complete the file name Part IIGccGNU CC (referred to as GCC) is the GNU project in accordance with the ANSI C standard of the compilation system
- Preprocessing: Gcc–e hello.c–o hello.i;gcc–e Call CPP
- Compilation: Gcc–s hello.i–o hello.s;gcc–s Call CCL
- Compilation: Gcc–c hello.s–o hello.o;gcc-c Call as
- Link: gcc hello.o–o hello; gcc-o call ld
In the first three steps, the GCC parameter is "ESc", and the corresponding input file suffix is "ISO" the GCC section, along with the textbook Learning section, is written on another blog.Part IIIGdbThe basic commands are:
- GdB Programm (Start gdb)
- B Set Breakpoints (4 breakpoints are set: Line breakpoint, function breakpoint, conditional breakpoint, temporary breakpoint)
- Run starts running the program
- BT Print function Call stack
- P View variable values
- C continue running from the current breakpoint to the next breakpoint
- N Single Step operation
- S Single Step operation
- Quit Quit GDB
- A few other debug commands that I think should be mastered are:
-
- Change of display tracking variable value
- Until jump out of the loop
- Finish Jump function
- Help
|