| 
									
										
										
										
											2018-10-04 14:47:55 +01:00
										 |  |  | --- | 
					
						
							|  |  |  | title: Navigation | 
					
						
							|  |  |  | --- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Vim Navigation
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ### Basic movement
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | There are many ways to move the cursor in Vim, but these basic movements will allow | 
					
						
							|  |  |  | new users to get comfortable using normal mode for file navigation.  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * In normal mode, the keys `h`, `j`, `k` , `l` correspond to moving the cursor | 
					
						
							|  |  |  | one character left, down, up, and right, respectively.  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * To navigate one word at a time, the keys `w`, and `b` will move the cursor to | 
					
						
							|  |  |  | the beginning of the next word, or the beginning of the previous word. The `e` | 
					
						
							|  |  |  | key will move the cursor to the end of the current word. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * To move to the beginning of the current line, type `0`, and to move to the end | 
					
						
							|  |  |  | of the current line, type `$`. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * Finally, to move to the first line in the file, type `gg`, and to move to the | 
					
						
							|  |  |  | last line in the file, type `G`. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | In summary:  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```vim | 
					
						
							|  |  |  | h   moves one character left | 
					
						
							|  |  |  | j   moves one row down | 
					
						
							|  |  |  | k   moves one row up | 
					
						
							|  |  |  | l   moves one character right | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | w   moves to the beginning of the next word | 
					
						
							|  |  |  | b   moves to the beginning of the previous word | 
					
						
							|  |  |  | e   moves to the end of the current word | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 0   moves to the beginning of the current line | 
					
						
							|  |  |  | $   moves to the end of the current line | 
					
						
							| 
									
										
										
										
											2018-10-12 04:30:38 +05:30
										 |  |  | :n  moves to line n (ex. :23 moves to line 23) can also use nG | 
					
						
							| 
									
										
										
										
											2018-10-14 21:48:42 +05:30
										 |  |  | ^   moves to the first non blank character of the line. | 
					
						
							| 
									
										
										
										
											2018-10-12 04:30:38 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  | ZZ  moves to the center of the line your on | 
					
						
							|  |  |  | H   moves to the top of the screen | 
					
						
							|  |  |  | M   moves to the middle of the screen | 
					
						
							|  |  |  | L   moves to the bottom of the screen | 
					
						
							| 
									
										
										
										
											2018-10-04 14:47:55 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | gg  moves to the first line in the file | 
					
						
							|  |  |  | G   moves to the last line in the file | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 |