1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| [mo@mos-computer ~]$ sudo yum install vim [mo@mos-computer ~]$ sudo yum install emacs
[mo@mos-computer ~]$ vimtutor
content in myFile (learn some useful commands): [mo@mos-computer ~]$ cat myFile [mo@mos-computer ~]$ cat myFile Hello Linuxers !
I just write some lines here in the Vim for filling the screen. You might feel easier to write things when switched to Insert mode in Vim. :p
You can move cursor here by: h <-, j up, k down, l ->.
to the head of the line: 0 ; to the end of the line: $; move word by word: w.
save file :w [file_name] ; add '!' to force these command to execute. [mo@mos-computer ~]$ vim myFile [mo@mos-computer ~]$ cat myFile Hello Linuxers !
I just write some lines here in the Vim for filling the screen. You might feel easier to write things when switched to Insert mode in Vim. :p
You can move cursor here by: h <-, j up, k down, l ->.
to the head of the line: 0 ; to the end of the line: $; move word by word: w.
save file :w [file_name] ; add '!' to force these command to execute.
': x' has the same effect as [mo@mos-computer ~]$ vim myFile [mo@mos-computer ~]$ vim myFile
[No write since last change] compression htop-2.2.0.tar.gz newly_created_file rarlinux-x64-5.7.0.tar.gz Desktop Music node redirect Documents myFile nohup.out repeat.txt Downloads myFIle number.txt results.txt errors.log name_sorted.txt output_find Templates file-copy.txt name.txt Pictures test grep_log newfile Public unique.txt htop-2.2.0 new_folder rar Videos
Press ENTER or type command to continue [mo@mos-computer ~]$ cat myFile Hello Linuxers !
I just write some lines here in the Vim for filling the screen. You might feel easier to write things when switched to Insert mode in Vim. :p
You can move cursor here by: h <-, j up, k down, l ->.
to the head of the line: 0 ; to the end of the line: $; move word by word: w.
save file :w [file_name] ; add '!' to force these command to execute.
': x' has the same effect as;
======================================================================== Advanced command
1. in Interactive mode, enter [word_num] x to delete designated number of words after the cursor.
2. enter d to delete line or words. [line_num] dd to delete current line. [word_num]dw to delete current word. (d0 -->delete to head,d$ --> delete to tail)
3. enter y to copy. yy copy line to storage. yw copy a word. (y0 and y$ also works)
4. enter [paste_num] p to paste (after cursor).
5. enter r[replace_char] to replace current char. (enter R to enter REPLACE mode where you can replace multiple chars)
6. enter [ops_num]u to undo. (Ctrl+r to redo the command)
7. enter g to go to specific line. (enter ':set nu' to show the line number,use 'set:nonu' to cancel. 'G' jump to the end of file.'gg' to jump to the head of the file.'[num]G' or '[num]gg'to jump to desired line. ) 8. '/' is used for search things. (show 'pattern not found' when nothing found, 'n' next) 9. find the word and replace it: ':s/[string_to_replace]/[new_string]', if you want to replace all word match in current line then use ':s/[string_to_replace]/[new_string]/g' (a special case: replace a word from line 2 to 4: ':2,4 s/[string_to_replace]/[new_string]', if you want to replace all word in this file then we use ':%s/[string_to_replace]/[new_string]/g') 10. :r [file_name] merge current file with another file. 11. :sp split screen into halve. :vsp vertical split. (Ctrl w + o, save only current viewport) 12. run bash cli in vim : ':!' or in current folder ':!ls'
|