To change your tab size in Vim, first at the command line, type:
vim $HOME/.vimrc
This will open the user preferences file for Vim, creating it if the files doesn't already exist. You will then be popped into your Vim editor, where you can enter your preferences. Remember to type the letter a to enter insert mode. Otherwise, anything you type will be interpreted as a Vim command. Ready?
Here's where you can paste all those nifty
set tabstop=4
set shiftwidth=4
set expandtab
Press the esc key to re-enter command mode then :wq to save and exit. Re-open Vim and voila! You've just set your tabs to 4 spaces!
My second trick is much shorter, but it's a great little command just the same. When working in Git, before you add any files using git add type
git diff
to see the changes you've made across all of the files in your working repository. If you've already started tracking the files using git add, type
git diff --cached
It gives you lovely output such as:
That's all for now. Happy coding, everyone!
No comments:
Post a Comment
Comments? Questions? Complaints? Coladas?