|
| 1 | +# linuxsty.vim |
| 2 | + |
| 3 | +This plugin is meant to help you respecting the Linux kernel coding style, |
| 4 | +described at: http://www.kernel.org/doc/Documentation/CodingStyle |
| 5 | + |
| 6 | +It will automatically apply known rules to kernel related files, such as .c, |
| 7 | +.h, Kconfig and patch files. The main rules are about indentation and syntax |
| 8 | +error highlighting (like exceeding 80 chars). |
| 9 | + |
| 10 | +If you have any comments, fixes or requests, feel free to contact me or send me |
| 11 | +a patch. The development also takes place on its official [Github |
| 12 | +repository](https://github.com/vivien/vim-linux-coding-style). |
| 13 | + |
| 14 | +The plugin is also available at [vim.org](www.vim.org), script ID |
| 15 | +[4369](http://www.vim.org/scripts/script.php?script_id=4369). |
| 16 | + |
| 17 | +## Installation |
| 18 | + |
| 19 | +You can just drop the linuxsty.vim file in your ~/.vim/plugin directory. |
| 20 | +Alternatively you can use the Git repository with a manager such as |
| 21 | +[Pathogen](https://github.com/tpope/vim-pathogen). |
| 22 | + |
| 23 | +## Usage |
| 24 | + |
| 25 | +By default the Linux coding style is enabled for any file known to the Linux |
| 26 | +project (C files, headers, patches, Kconfig, etc.). |
| 27 | + |
| 28 | +If you prefer a finer control and apply it only on some files, define |
| 29 | +a "g:linuxsty_patterns" array in your vimrc and the style will be applied only |
| 30 | +if the buffer's path matches one of the pattern. For instance, you can match |
| 31 | +only projects under /usr/src/ and /linux with the following: |
| 32 | + |
| 33 | + let g:linuxsty_patterns = [ "/usr/src/", "/linux" ] |
| 34 | + |
| 35 | +If you want to enable the coding style on demand without checking the filetype, |
| 36 | +you can use the :LinuxCodingStyle command. For instance, you can map it with |
| 37 | +the following in your vimrc: |
| 38 | + |
| 39 | + nnoremap <silent> <leader>a :LinuxCodingStyle<cr> |
| 40 | + |
| 41 | +## License |
| 42 | + |
| 43 | +Copyright (c) Vivien Didelot. Distributed under the same terms as Vim itself. |
| 44 | +See :help license. |
0 commit comments