Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ only projects under /usr/src/ and /linux with the following:

let g:linuxsty_patterns = [ "/usr/src/", "/linux" ]

Exclusion patterns can be also be applied. The following example would
exclude anything that had "/foo/" in the path, even if it would match
something in linuxsty_patterns

let g:linuxsty_exclude_patterns = [ "/foo/" ]

If you want to enable the coding style on demand without checking the filetype,
you can use the :LinuxCodingStyle command. For instance, you can map it with
the following in your vimrc:
Expand Down
16 changes: 16 additions & 0 deletions plugin/linuxsty.vim
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
" options will be applied only if "/linux/" or "/kernel" is in buffer's path.
"
" let g:linuxsty_patterns = [ "/linux/", "/kernel/" ]
"
" Exclusion patterns can be also be applied. The following example would
" exclude anything that had "/foo/" in the path, even if it would match
" something in linuxsty_patterns
"
" let g:linuxsty_exclude_patterns = [ "/foo/" ]

if exists("g:loaded_linuxsty")
finish
Expand Down Expand Up @@ -44,6 +50,16 @@ function s:LinuxConfigure()
let apply_style = 1
endif

if exists("g:linuxsty_exclude_patterns")
let path = expand('%:p')
for p in g:linuxsty_exclude_patterns
if path =~ p
let apply_style = 0
break
endif
endfor
endif

if apply_style
call s:LinuxCodingStyle()
endif
Expand Down