linux:vim-editor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
linux:vim-editor [2019/05/07 11:38] michaellinux:vim-editor [2019/05/21 11:20] (current) michael
Line 51: Line 51:
 On the bottom left of the screen, we can see we are in insert mode. Now we can type in our configuration. You will want the following lines in the file: On the bottom left of the screen, we can see we are in insert mode. Now we can type in our configuration. You will want the following lines in the file:
  
-  * <wrap em>syntax on</wrap> +  * ''syntax on'' 
-  * <wrap em>set wrapmargin=8</wrap> +  * ''set wrapmargin=8'' 
-  * <wrap em>set number</wrap>+  * ''set number''
  
 {{linux:differences-vim-to-vi-vimrc3.jpg?nolink&600|}} {{linux:differences-vim-to-vi-vimrc3.jpg?nolink&600|}}
Line 88: Line 88:
 __Some additional movement keys:__ __Some additional movement keys:__
  
-  * **e** will move you forward to the end of a word +  * ''e'' will move you forward to the end of a word 
-  * **w** will move you forward to the beginning of a word +  * ''w'' will move you forward to the beginning of a word 
-  * **b** will move you backward to the beginning of a word +  * ''b'' will move you backward to the beginning of a word 
-  * **$** will move you to the end of a line +  * ''$'' will move you to the end of a line 
-  * **0** (zero) will move you the beginning of a line +  * ''0'' (zero) will move you the beginning of a line 
-  * **G** will move you to the end of a file +  * ''G'' will move you to the end of a file 
-  * **gg** will move you to the start of a file+  * ''gg'' will move you to the start of a file
 </WRAP> </WRAP>
  
Line 109: Line 109:
 In order to search and replace, we use the **:%s/search/replace/** syntax. You will need to enter the colon. In order to search and replace, we use the **:%s/search/replace/** syntax. You will need to enter the colon.
  
-  * <wrap em>:%s/tcpdump/ls/</wrap> will search the entire file and replace every instance of tcpdump with ls. +  * '':%s/tcpdump/ls/'' will search the entire file and replace every instance of tcpdump with ls. 
-  * <wrap em>:%s/myPrivEscalationScript/ls/c</wrap> will search the entire file and replace each instance only if you confirm it.+  * '':%s/myPrivEscalationScript/ls/c'' will search the entire file and replace each instance only if you confirm it.
  
 Vim also supports regular expressions in the same way that [[https://null-byte.wonderhowto.com/how-to/hack-like-pro-linux-basics-for-aspiring-hacker-part-10-manipulating-text-0148539/|grep]] does. Vim also supports regular expressions in the same way that [[https://null-byte.wonderhowto.com/how-to/hack-like-pro-linux-basics-for-aspiring-hacker-part-10-manipulating-text-0148539/|grep]] does.
Line 119: Line 119:
 Exiting Vim is always a problem for people just starting out. In order to exit, use these commands: Exiting Vim is always a problem for people just starting out. In order to exit, use these commands:
  
-  * **:w** will write the file +  * '':w'' will write the file 
-  * **:wq** will write the file and quit +  * '':wq'' will write the file and quit 
-  * <wrap em>:q!</wrap> will exit the editor and discard all changes +  * '':q!'' will exit the editor and discard all changes 
-  * **:w** someFileName will write the changes to a file called someFileName+  * '':w someFileName'' will write the changes to a file called someFileName
  
 In some cases, we might want to escape to a shell to browse directory trees or look at other files. In order to execute a system command in Vim, we use the command: In some cases, we might want to escape to a shell to browse directory trees or look at other files. In order to execute a system command in Vim, we use the command:
  
-  * **:!command**+  * '':!command''
  
-This will execute whatever command we put after the bang. This can be a shell ''**:!bash**'', which we can exit to return to Vim, or we could ''**:!ls /etc**'' to view the contents of the /etc directory.+This will execute whatever command we put after the bang. This can be a shell ''**:!bash**'', which we can exit to return to Vim, or we could '':!ls /etc'' to view the contents of the /etc directory.
  
  
  
  • linux/vim-editor.1557221914.txt.gz
  • Last modified: 2019/05/07 11:38
  • by michael