Git Bash on Windows typically includes several text editors, either as built-in options or through external installations. Below is a list of editors you can use with Git Bash and how to open them: 1. Nano (Default Editor) Description : A simple terminal-based text editor that's often the default in Git Bash. Command to Open : nano filename 2. Vim Description : A powerful and widely-used terminal-based editor. Command to Open : vim filename If vim  is not installed by default, install it via a package manager like Chocolatey: choco install vim 3. Vi Description : The predecessor to Vim and a simpler terminal editor. Command to Open : vi filename Note : vi  might redirect to vim  in some systems. 4. Emacs Description : A versatile editor often used by developers. Command to Open : emacs filename Note : Emacs is not included by default in Git Bash but can be installed. 5. Notepad Description : The built-in Windows Notepad editor. Command to Open : notepad filename 6. Notepad++ Descri...
Comprehensive list of commands for using the
vi text editor on Linux in the command line.Basic Modes in vi
- Command Mode: The default mode when 
vistarts. Use it to execute commands. - Insert Mode: Used for editing text. Enter this mode with commands like 
i,a, oro. - Visual Mode: Used for selecting text.
 
Starting vi
Switching Modes
Insert Mode:
i: Insert text before the cursor.I: Insert text at the beginning of the line.a: Append text after the cursor.A: Append text at the end of the line.o: Open a new line below the cursor.O: Open a new line above the cursor.
Return to Command Mode:
PressEsc.Visual Mode:
v: Start character-based selection.V: Start line-based selection.Ctrl+v: Start block selection.
Saving and Exiting
:w: Save the file.:w filename: Save as a new file.:q: Quit.:q!: Quit without saving.:wqorZZ: Save and quit.:x: Save and quit.:e!: Discard changes and reload the file.
Navigation
Within a Line:
0: Move to the beginning of the line.^: Move to the first non-blank character of the line.$: Move to the end of the line.
Between Lines:
j: Move down one line.k: Move up one line.H: Move to the top of the screen.M: Move to the middle of the screen.L: Move to the bottom of the screen.
Words:
w: Move to the beginning of the next word.e: Move to the end of the current/next word.b: Move to the beginning of the previous word.
Paragraphs:
{: Move to the beginning of the paragraph.}: Move to the end of the paragraph.
Searching:
/text: Search forward for "text".?text: Search backward for "text".n: Repeat the search forward.N: Repeat the search backward.
Editing
x: Delete the character under the cursor.X: Delete the character before the cursor.dd: Delete the current line.d$: Delete from the cursor to the end of the line.d0: Delete from the cursor to the beginning of the line.yyorY: Copy (yank) the current line.p: Paste after the cursor.P: Paste before the cursor.u: Undo the last change.Ctrl+r: Redo the last undone change.
Advanced Editing
r<char>: Replace the character under the cursor with<char>.R: Enter Replace mode (overwrite).cw: Change (replace) the word under the cursor.C: Change (replace) to the end of the line.~: Toggle the case of the character under the cursor.
Working with Multiple Files
:e filename: Edit another file.:bn: Go to the next file.:bp: Go to the previous file.:b#: Switch to the alternate file.:buffers: List open files.
Split Windows
:split filename: Split window and open a file.Ctrl+w s: Split the current file horizontally.Ctrl+w v: Split the current file vertically.Ctrl+w w: Switch between windows.Ctrl+w q: Close the current window.
Marks
m<char>: Mark the current position with<char>.' <char>: Move to the beginning of the line where<char>was marked.`<char>`: Move to the exact position where<char>was marked.
Macros
q<char>: Start recording a macro into register<char>.q: Stop recording.@<char>: Play the macro stored in register<char>.
Custom Commands
- Find and Replace:
 
Exiting Without Saving
If you're stuck in vi:
This should cover everything you need to work effectively in vi!
Comments
Post a Comment