Monday, April 28, 2014

Vim Editor Commands

Vim ?? What's that ??

 











Vim is an editor to create or edit a text file.
 
There are three modes in vim.
  • Insert mode - Adding text
  • Command mode - Modifying text
  • Last line mode - Save & quit

Insert Mode:

Changing mode from one to another
From command mode to insert mode type a/A/i/I/o/O ( see details below)
From insert mode to command mode type Esc (escape key).


Command Mode:

  1. yy - to copy a line. 
  2. yw - to copy a word. 
  3. yl - to copy a letter. 
  4. dd - to delete a line. 
  5. dw - to delete a word. 
  6. dl - to delete a letter. 
  7. x - to delete a letter. 
  8. D - to delete from cursor location towards end of line. 
  9. cc - to cut a line. 
  10. cw - to cut a word. 
  11. cl - to cut a letter. 
  12. p - to paste below the cursor. 
  13. P - to paste above the cursor. 
  14. u - to undo the changes. 
  15. ctrl + r - to redo the changes. 
  16. G - goto last line of the file. 
  17. gg - goto first line of the file. 
  18. /string - forward search for text. 
  19. ?string - backward search for text. 
  20. zz -  to save & quit. 
  21. d) - delete from cursor location towards end of the file. 
  22. d(  - delete from cursor location towards start of the file.
  23. e - goto end of next word.
  24. b - goto start of previous word.
  25. n - search.


Last Line Mode:

  1. noh - to remove text highlight.
  2. wq / x - save & quit.
  3. wq! / x! - save & quit forcefully.
  4. q - quit.
  5. q! - quit forcefully.
  6. w - to save.
  7. w! - save forcefully.
  8. set nu - to set numbers.
  9. set nonu - to remove numbers.
  10. !pwd - to know path.
  11. !tty - to know terminal.
  12. :w anyname - for save as.
  13. :set ic - search case sensitive.
  14. :set noic - ignores case sensitive.
  15. vim + line number filename - search and go to specific line.
  16. vim + /string filename - search and go to specific string.
  17. vim -o file1 file 2 - modify two files.
  18. nl filename - indicates number lines. 


                                         Short Description Video - Vim Editor command






By Linux-Care



Related Posts:

  • Vim Editor Commands Vim ?? What's that ??   Vim is an editor to create or edit a text file.   There are three modes in vim. Insert mode - Adding text Command mode - Modifying text Last line mode - Save & quit Inse… Read More
  • User Management in Linux This article will try to cover basics of Linux user management through command line tools. Linux provides 5 different alternatives to choose the accessibility. They are as listed below. Super User or … Read More
  • head   head command example Output the first part of files, prints the first part (10 lines by default) of each file. SYNTAX head [options]... [file]... Examples Extract the first 85 lines from a file… Read More
  • jobs   jobs command example Print currently running jobs and their status. Syntax jobs [OPTIONS] [PID] Options: -c --command Print the command name for each process in jobs -g --group Only… Read More
  • nslookup   nslookup Query Internet name servers Syntax: nslookup nslookup host-to-find nslookup server interactive mode: nslookup -server nslookup [-options] [host-to-find ] … Read More

2 comments: