Skip to content

Commit 1a21aac

Browse files
committed
Allow overriding default text width for C files
The default text width for C files is currently set at 100. Allow people who still prefer to operate mostly within 80 column boundary to override the default by setting g:linuxsty_text_width option in their vimrc. Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 2892b86 commit 1a21aac

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugin/linuxsty.vim

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,22 @@
1717
"
1818
" If you want to save the current file's directory and automatically call
1919
" LinuxCodingStyle next time, you can define the following option in your
20-
" vimrc.
20+
" vimrc:
2121
"
2222
" let g:linuxsty_save_path = 1
23+
"
24+
" To override the default text width for C kernel files define the following
25+
" option in your vimrc:
26+
"
27+
" let g:linuxsty_text_width = 80
2328

2429
if exists("g:loaded_linuxsty")
2530
finish
2631
endif
2732
let g:loaded_linuxsty = 1
2833

2934
let g:linuxsty_save_path = get(g:, 'linuxsty_save_path', 0)
35+
let g:linuxsty_text_width = get(g:, 'linuxsty_text_width', 100)
3036

3137
set wildignore+=*.ko,*.mod.c,*.order,modules.builtin
3238

@@ -74,7 +80,7 @@ function s:LinuxFormatting()
7480
setlocal tabstop=8
7581
setlocal shiftwidth=8
7682
setlocal softtabstop=8
77-
setlocal textwidth=100
83+
execute "setlocal textwidth=" . g:linuxsty_text_width
7884
setlocal noexpandtab
7985

8086
setlocal cindent

0 commit comments

Comments
 (0)