From mboxrd@z Thu Jan 1 00:00:00 1970 From: gmate.amit@gmail.com (Kumar amit mehta) Date: Fri, 19 Oct 2012 02:00:13 -0700 Subject: Query on CodingStyle: indentation In-Reply-To: <20121019070328.GA6410@adam-laptop> References: <20121019053129.GA2712@gmail.com> <20121019070328.GA6410@adam-laptop> Message-ID: <20121019090013.GA26910@gmail.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Fri, Oct 19, 2012 at 03:03:28PM +0800, Adam Lee wrote: > On Thu, Oct 18, 2012 at 10:31:29PM -0700, Kumar amit mehta wrote: > > Hi, > > > > I've a query regarding the coding style for Linux Kernel code. I'm > > reading the CodingStyle under Documentation and what I've understood is > > that I shouldn't be using spaces for indentation purposes and should use > > tabs of width 8 characters. Quoting from the same document: > > "Outside of comments, documentation and except in Kconfig, spaces are > > never used for indentation, and the above example is deliberately broken." > > However, Is it correct to replace each tab stroke by 8 spaces ? I use vim > > editor and I've put following under $HOME/.vimrc file: > > > > set tabstop=8 > > set shiftwidth=8 > > set expandtab > > > > > > In past I've seen that some application have different interpretation of > > tabs and hence sometimes even If I've done proper indentation using tab, > > the code appears unindented, and therefore In order to make sure that I'm > > moving 8 characters upon hitting tab, I've put the above rules under my > > .vimrc file. Please let me know If I should remove these from my .vimrc > > file and rely on tab instead. > > No, you should not expand tabs. Tabs in CodingStyle mean _hard_ tabs. > > Mine: > > > set tabstop=8 > set noexpandtab > set shiftwidth=8 > set cinoptions=:0,l1,t0,g0 > > Thank you Adam for sharing your vim recipe.