lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quit [now definitely O/T]


From: Carl Sorensen
Subject: Re: Quit [now definitely O/T]
Date: Thu, 12 Nov 2009 16:57:58 -0700



On 11/12/09 3:38 PM, "Frédéric Bron" <address@hidden> wrote:

>> I've been there (had patches rejected because of bad indentation) and I
>> remember the pain it was to completely reindent the file (as part of that
>> process I learned to use the automatic indentation in vim).  But my code is
>> easier to read (which is *really* important for Scheme code IMO), so it's
>> worth the hassle.
> 
> I have been there too but I still do not understand scheme indentation
> which does not help me understand the code (on the contrary it makes
> it harder to read).
> But I know from programming that everybody has its own style of
> indenting and it is good practice that in a project the same
> indentation style be applied. However, I am using vim and .scm code is
> not automatically recognized and indented. Can you provide your method
> to correctly indent with vim?

Here is my .vimrc file (in case you don't know about .vimrc, it's a file in
my home directory with the name of .vimrc (note the preceding period)::

set cindent
set smartindent
set autoindent
set expandtab
set softtabstop=2
set shiftwidth=2
filetype plugin indent on
set incsearch
set ignorecase smartcase
set hlsearch
set confirm
set statusline=%F%m%r%h%w\ %{&ff}\ %Y\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\
%04l,%04v\ %p%%\ [LEN=%L]
set laststatus=2
set number
" Remove trailing whitespace on write
autocmd BufWritePre * :%s/\s\+$//e


With that .vimrc, I simply load up a .scm file.  And I edit it.  And then
before saving, I go to command mode (hit the escape key), type V (to enter
line-based visual mode), use the cursor keys to highlight the lines that
need to be indented, and press the = key.  Voila; the indentation is fixed
automatically.

HTH,

Carl





reply via email to

[Prev in Thread] Current Thread [Next in Thread]