nano is easy to use. vim is powerful but has a learning curve. For quick edits, use nano. For serious text editing, learn vim.
Quick Comparison
| Feature | nano | vim |
|---|---|---|
| Learning curve | Minutes | Days to weeks |
| Power | Basic | Extremely powerful |
| Installed on Mac | Yes | Yes |
| Best for | Quick edits | Serious editing |
| Movement | Arrow keys | hjkl keys |
| Commands shown | Yes (bottom) | No |
nano: Simple and Friendly
Open a file:
nano filename.txt
What you see:
GNU nano 6.0 filename.txt
Your file content here...
^G Help ^O Write Out ^X Exit ^K Cut ^U Paste
The ^ means Control. So ^X means Control + X to exit.
Basic nano Commands
| Action | Keys |
|---|---|
| Save | Control + O, Enter |
| Exit | Control + X |
| Cut line | Control + K |
| Paste | Control + U |
| Search | Control + W |
| Go to line | Control + _ |
That's basically it. You can start using nano in 30 seconds.
vim: Powerful but Different
Open a file:
vim filename.txt
Now you're stuck. vim doesn't work like other editors.
vim Modes
vim has modes - that's what makes it confusing at first:
| Mode | Purpose | Enter with |
|---|---|---|
| Normal | Navigate, commands | Esc |
| Insert | Type text | i |
| Command | Save, quit, etc. | : |
To exit vim:
- Press
Esc(go to Normal mode) - Type
:q!(quit without saving) or:wq(save and quit) - Press Enter
Essential vim Commands
Navigation (in Normal mode):
| Key | Movement |
|---|---|
| h | Left |
| j | Down |
| k | Up |
| l | Right |
| w | Next word |
| b | Previous word |
| 0 | Start of line |
| \$ | End of line |
| gg | Start of file |
| G | End of file |
Editing:
| Key | Action |
|---|---|
| i | Insert before cursor |
| a | Insert after cursor |
| o | New line below |
| O | New line above |
| x | Delete character |
| dd | Delete line |
| yy | Copy line |
| p | Paste |
| u | Undo |
| Ctrl+r | Redo |
Save and quit:
| Command | Action |
|---|---|
| :w | Save |
| :q | Quit |
| :wq | Save and quit |
| :q! | Quit without saving |
When to Use nano
- Quick config file edits
- You just need to change one thing
- You're not comfortable with vim yet
- Simple text editing
nano ~/.zshrc
# Make your change, Control + O to save, Control + X to exit
When to Use vim
- Editing code
- You edit files frequently
- You want efficient text manipulation
- You'll invest time learning it
Once you learn vim, editing is faster because you don't take hands off the keyboard.
Why vim is Worth Learning
vim's power comes from combining commands:
d3w- Delete 3 wordsci"- Change inside quotesyap- Copy a paragraphgg=G- Fix indentation of entire file
These compound commands are why vim users are so fast.
Learning vim
In Terminal:
vimtutor
A built-in tutorial that takes about 30 minutes.
My suggestion:
- Learn to enter text (
i), save (:w), and quit (:q) - Learn basic movement (h, j, k, l)
- Use it for one week
- Gradually learn more commands
It takes time but pays off.
Other Options
| Editor | Notes |
|---|---|
| nano | Simple, great for quick edits |
| vim | Powerful, learning curve |
| neovim | Modern vim |
| emacs | Different philosophy, also powerful |
| micro | Modern nano-like |
My Recommendation
Start with nano for quick edits. It works immediately.
Learn vim when you're ready to invest time. The payoff is huge for frequent editing.
You can use both - nano for quick edits, vim for longer sessions.
The Classic Joke
"How do you generate a random string?"
"Put a first-year developer in front of vim and tell them to exit."
It's funny because vim is genuinely confusing at first. But once you learn it, you'll understand why people love it.
Keep Learning
Knowing a terminal editor makes you more capable. The free course covers essential Terminal skills.
Check it out at Mac Terminal for Humans.