Monday, June 19, 2006

Indentation Celebration

This tip is how to setup a custom configuration for C# files along with how to setup custom indentation.

First to define a custom hook for C# define your function
(defun my-chsarp-mode-hook ()
--insert custom csharp setings--)
then you need to add the hook
(add-hook 'csharp-mode-hook 'my-csharp-mode-hook)

Here is the settings to have tabs be 4 spaces and have {} line up. Also this will line up argument list even with variable names.

(defun my-csharp-mode-hook()
(setq c-basic-offset 4)
(c-set-offset 'substatement-open 0)
(c-set-offset 'statement-cont 4)
(c-set-offset 'topmost-intro-cont 0)
(c-set-offset 'block-open 0)
(c-set-offset 'arglist-intro c-lineup-arglist-intro-after-paren)
(c-set-offset 'arglist-cont-nonempty 4))

No comments: