[yast-devel] Whitespace: Editors and Indentation
This howto should help you follow the [style guide][1]. ruby-mode for Emacs has the defaults right. Plain vim defaults to Tab characters so it needs adjustments in ~/.vimrc . [1]: https://github.com/SUSE/style-guides/blob/master/Ruby.md Rules ----- 1. No Tab Characters emacs: (setq-default indent-tabs-mode nil) vim: set expandtab 2. Existing Tab Characters are 8 Columns Wide emacs: (setq-default tab-width 8) vim: set tabstop=8 A notable offender is GitHub which uses 4. See point 1. The tab *key* is a different matter, see point 3. 3. Ruby Indentation Level is 2 emacs: (setq-default ruby-indent-level 2) vim: set softtabstop=2 set shiftwidth=2 If you disagree with this, please read JWZ's explanation of the concepts first: http://www.jwz.org/doc/tabs-vs-spaces.html Future ------ I have also looked into these things but don't have a recommendation. If you want me to continue, speak up. - trailing whitespace: lesser impact, I haven't nailed down the right config yet - local configuration: file-specific is easy but clutters files directory-specific needs a vim plugin; Emacs just works, as usual ;-) -- Martin Vidner, Cloud & Systems Management Team http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
On Fri, 4 Oct 2013 15:09:42 +0200 Martin Vidner <mvidner@suse.cz> wrote:
This howto should help you follow the [style guide][1]. ruby-mode for Emacs has the defaults right. Plain vim defaults to Tab characters so it needs adjustments in ~/.vimrc .
[1]: https://github.com/SUSE/style-guides/blob/master/Ruby.md
Rules -----
1. No Tab Characters
emacs: (setq-default indent-tabs-mode nil) vim: set expandtab
2. Existing Tab Characters are 8 Columns Wide
emacs: (setq-default tab-width 8) vim: set tabstop=8
A notable offender is GitHub which uses 4. See point 1. The tab *key* is a different matter, see point 3.
3. Ruby Indentation Level is 2
emacs: (setq-default ruby-indent-level 2) vim: set softtabstop=2 set shiftwidth=2
If you disagree with this, please read JWZ's explanation of the concepts first:
http://www.jwz.org/doc/tabs-vs-spaces.html
Future ------
I have also looked into these things but don't have a recommendation. If you want me to continue, speak up.
- trailing whitespace: lesser impact, I haven't nailed down the right config yet - local configuration: file-specific is easy but clutters files directory-specific needs a vim plugin; Emacs just works, as usual ;-)
Well, you can have local configuration depending on file type for vim, see http://stackoverflow.com/questions/1562633/setting-vim-whitespace-preference... I found it quite useful to have vim working with makefiles. http://vim.wikia.com/wiki/Converting_tabs_to_spaces (comment 1) Josef PS. Can you move it somewhere to developer documentation? I think it is quite useful for new developer to have persistent place.
Hello, Am Freitag, 4. Oktober 2013 schrieb Martin Vidner:
- local configuration: file-specific is easy but clutters files directory-specific needs a vim plugin;
No, just a config option ;-) Add the following line in ~/.vimrc (adjust the directory as needed) autocmd BufNewFile,BufRead /home/foo/yast-HEAD/* set expandtab Regards, Christian Boltz -- Nein, das Programm gibt es nicht für Linux. Ich verwende zwar auch Linux, verstehe davon aber zu wenig. Und VisualBasic ist kaum portabel. Also: Sorry, kein Linux ;-) [Ratti im Gästebuch auf www.gesindel.de] -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
participants (3)
-
Christian Boltz
-
Josef Reidinger
-
Martin Vidner