LNCD

Table of Contents

  • LNCD Home
  • Administration
  • Notebooks
  • Journal Club Presentations
  • Publications
  • Current Projects
  • Completed Projects
  • Current Grants
  • Datasets by Project
  • Brain ROIs and Measures
  • ️Tools And Methods
  • Big Data
  • RA Homepage
  • Recent Changes
  • Maintenance
  • Site Map
  • Random Page
LNCD
Admin » Vim

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tools:vim [2025/07/30 10:44] – [Vim] vid79tools:vim [2025/10/07 14:35] (current) – [Commands] vid79
Line 3: Line 3:
 ''vim'' is a modal editor (improving on vi). It can run without graphics, is ubiquitous, powerful, and efficient but is an acquired skill. ''vim'' is a modal editor (improving on vi). It can run without graphics, is ubiquitous, powerful, and efficient but is an acquired skill.
  
-  * **MIT's "missing semester" has an excellent summary of vim functions [[https://missing.csail.mit.edu/2020/editors/|video and notes]].** +**MIT's "missing semester" has an excellent summary of vim functions [[https://missing.csail.mit.edu/2020/editors/|video and notes]].** 
 Vim’s design is based on the idea that a lot of programmer time is spent reading, navigating, and making small edits, as opposed to writing long streams of text. For this reason, Vim has multiple operating modes. Vim’s design is based on the idea that a lot of programmer time is spent reading, navigating, and making small edits, as opposed to writing long streams of text. For this reason, Vim has multiple operating modes.
   - Normal: for moving around a file and making edits   - Normal: for moving around a file and making edits
Line 16: Line 16:
  
 ===== Commands ===== ===== Commands =====
- 
-Victoria's review: a minimal vim session experience: 
  
   - ''vim $filename'' -> opens a file in vim. If that file doesn't exist or you opened it in the wrong filepath, you will see an empty blank vim that says ''[NEW]'' at the bottom   - ''vim $filename'' -> opens a file in vim. If that file doesn't exist or you opened it in the wrong filepath, you will see an empty blank vim that says ''[NEW]'' at the bottom
-  - ''i'' -> puts you in **i**nsert mode so you can freely type and move your cursor around. Says ''-- INSERT --'' in bottom left.+  - ''i'' -> puts you in **i**nsert mode so you can freely type and move your cursor around. Says ''-- INSERT --'' in bottom left. {{:tools:pasted:20250915-220039.png}}
   - ''esc'' -> gets you out of insert mode   - ''esc'' -> gets you out of insert mode
 +  - '':set nu'' shows you line numbers
  
 move around move around
-  - ''0'' puts your cursor to the beginning of the line (in command mode) +  - ''0'' or ''Home'' puts your cursor to the beginning of the line (in command mode) 
-  - ''$'' puts your cursor to the end of the line (in command mode)+  - ''$'' or ''End'' puts your cursor to the end of the line (in command mode)
   - ''Shift + i'' puts your cursor to the beginning of the line and opens insert mode   - ''Shift + i'' puts your cursor to the beginning of the line and opens insert mode
   - ''Shift + a'' puts your cursor to the end of the line and opens insert mode   - ''Shift + a'' puts your cursor to the end of the line and opens insert mode
Line 31: Line 30:
   - up and down arrows move you up and down each line but to move between lines click ''g'' then up or down arrow   - up and down arrows move you up and down each line but to move between lines click ''g'' then up or down arrow
   - ''u'' undo last change (in command mode)   - ''u'' undo last change (in command mode)
 +
 +Copy and paste
 +  * Click ''v'' to put you in visual mode
 +  * to cut- move your cursor to highlight the words you want to cut and press ''d''
 +  * to copy- move your cursor to highlight the words you want to copy and press ''y''
 +  * move your cursor to where you want to paste words and press ''p''
 +
 close vim temporarily close vim temporarily
   * ''Ctrl + z'' puts the vim window to "sleep" and brings you back to the terminal   * ''Ctrl + z'' puts the vim window to "sleep" and brings you back to the terminal
   * ''fg'' brings you from the terminal back into the last script in vim you were working on   * ''fg'' brings you from the terminal back into the last script in vim you were working on
 +
 exit exit
     * '':q'' -> quits vim     * '':q'' -> quits vim
     * '':wq'' -> saves what you wrote and quits vim      * '':wq'' -> saves what you wrote and quits vim 
     * '':q!'' -> does not save what you wrote and quits vim     * '':q!'' -> does not save what you wrote and quits vim