This website recently got a major rebuild; if you're missing something, let Lorna know.

Set Vim Shift Width



I have had a problem with vim for a while. Although I have my tabstop set to 4, when I use >> or << to indent or undent (technical term) my code, it moves the code by 8 characters. As I'm now working with phpcodesniffer, I'm pretty motivated to get my editor set correctly so I don't waste time on formatting.

The setting I want is the shift width. I added this in my .vimrc file:

set sw=4

Hopefully this will help someone else with the same issues. I've been grappling with the tab/space/indentation settings for vim as long as I've been using it and I don't think I'm done yet. Maybe one day I'll solve it and write a big overview but for now, you can read the previous installment and pass on any tips you may have via the comments!

As an aside, I now completely understand why projects have vim settings in their files - I've got different coding standards going on inside different projects so I'm spending a lot of time fiddling with .vimrc these days!


In: tech
Tags: #tech #vim