[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] HACKING: add a vim indentation example
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] HACKING: add a vim indentation example |
Date: |
Tue, 19 Jul 2011 10:50:46 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 |
On 19/07/11 04:18, address@hidden wrote:
> +If you use vim (7+ compiled with autocommands), and coreutils working
> +directory name also matches, add the following in ~/.vimrc:
> +
> + " Set GNU style indentation, spaces instead of TABs
> + function! CoreutilsIndent()
> + " Check if 'coreutils' is part of the current working directory
> + if match(getcwd(), "coreutils") > 0
> + " The next 3 lines below set the GNU indentation
> + setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
> + setlocal shiftwidth=2
> + setlocal tabstop=8
> + " Coreutils specific, expand TABs with spaces
> + setlocal expandtab
> + endif
> + endfunction
> +
> + autocmd BufEnter *.c,*.h call CoreutilsIndent()
Thanks!
There is also a plugin available to load .vim files from the dir
http://stackoverflow.com/questions/456792/vim-apply-settings-on-files-in-directory
Matching on the path seems a little hacky, though not too bad.
I'll try these out for a while and will apply soon.
cheers,
Pádraig.