Adding upstream version 0.20200629.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
86ec2cb15a
commit
fced2a7e75
6 changed files with 122 additions and 0 deletions
22
LICENSE
Normal file
22
LICENSE
Normal file
|
@ -0,0 +1,22 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 nfnty
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
11
README.md
Normal file
11
README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# vim-nftables
|
||||
|
||||
## Installation
|
||||
|
||||
Recommend [NeoBundle](https://github.com/Shougo/neobundle.vim) for installation.
|
||||
|
||||
Add the following to your vimrc:
|
||||
|
||||
```vim
|
||||
NeoBundle 'nfnty/vim-nftables'
|
||||
```
|
11
ftdetect/nftables.vim
Normal file
11
ftdetect/nftables.vim
Normal file
|
@ -0,0 +1,11 @@
|
|||
function! s:DetectFiletype()
|
||||
if getline(1) =~# '^#!\s*\%\(/\S\+\)\?/\%\(s\)\?bin/\%\(env\s\+\)\?nft\>'
|
||||
setfiletype nftables
|
||||
endif
|
||||
endfunction
|
||||
|
||||
augroup nftables
|
||||
autocmd!
|
||||
autocmd BufRead,BufNewFile * call s:DetectFiletype()
|
||||
autocmd BufRead,BufNewFile *.nft,nftables.conf setfiletype nftables
|
||||
augroup END
|
24
ftplugin/nftables.vim
Normal file
24
ftplugin/nftables.vim
Normal file
|
@ -0,0 +1,24 @@
|
|||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:save_cpo = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
setlocal smartindent nocindent
|
||||
setlocal commentstring=#%s
|
||||
setlocal formatoptions-=t formatoptions+=croqnlj
|
||||
|
||||
setlocal comments=b:#
|
||||
|
||||
setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
|
||||
setlocal textwidth=99
|
||||
|
||||
let b:undo_ftplugin = '
|
||||
\ setlocal formatoptions< comments< commentstring<
|
||||
\|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth<
|
||||
\'
|
||||
|
||||
let &cpoptions = s:save_cpo
|
||||
unlet s:save_cpo
|
17
indent/nftables.vim
Normal file
17
indent/nftables.vim
Normal file
|
@ -0,0 +1,17 @@
|
|||
" Only load this indent file when no other was loaded.
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal cindent
|
||||
setlocal cinoptions=L0,(0,Ws,J1,j1,+N
|
||||
setlocal cinkeys=0{,0},!^F,o,O,0[,0]
|
||||
" Don't think cinwords will actually do anything at all... never mind
|
||||
setlocal cinwords=table,chain
|
||||
|
||||
" Some preliminary settings
|
||||
setlocal nolisp " Make sure lisp indenting doesn't supersede us
|
||||
setlocal autoindent " indentexpr isn't much help otherwise
|
||||
" Also do indentkeys, otherwise # gets shoved to column 0 :-/
|
||||
setlocal indentkeys=0{,0},!^F,o,O,0[,0]
|
37
syntax/nftables.vim
Normal file
37
syntax/nftables.vim
Normal file
|
@ -0,0 +1,37 @@
|
|||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
syn match nftablesSet /{.*}/ contains=nftablesSetEntry
|
||||
syn match nftablesSetEntry /[a-zA-Z0-9]\+/ contained
|
||||
hi def link nftablesSet Keyword
|
||||
hi def link nftablesSetEntry Operator
|
||||
|
||||
syn match nftablesNumber "\<[0-9A-Fa-f./:]\+\>" contains=nftablesMask,nftablesDelimiter
|
||||
syn match nftablesHex "\<0x[0-9A-Fa-f]\+\>"
|
||||
syn match nftablesDelimiter "[./:]" contained
|
||||
syn match nftablesMask "/[0-9.]\+" contained contains=nftablesDelimiter
|
||||
hi def link nftablesNumber Number
|
||||
hi def link nftablesHex Number
|
||||
hi def link nftablesDelimiter Operator
|
||||
hi def link nftablesMask Operator
|
||||
|
||||
syn region Comment start=/#/ end=/$/
|
||||
syn region String start=/"/ end=/"/
|
||||
syn keyword Function flush
|
||||
syn keyword Function table chain map
|
||||
syn keyword Statement type hook
|
||||
syn keyword Type ip ip6 inet arp bridge
|
||||
syn keyword Type filter nat route
|
||||
syn keyword Type ether vlan arp ip icmp igmp ip6 icmpv6 tcp udp udplite sctp dccp ah esp comp icmpx
|
||||
syn keyword Type ct
|
||||
syn keyword Type length protocol priority mark iif iifname iiftype oif oifname oiftype skuid skgid rtclassid
|
||||
syn keyword Constant prerouting input forward output postrouting
|
||||
|
||||
syn keyword Special snat dnat masquerade redirect
|
||||
syn keyword Special accept drop reject queue
|
||||
syn keyword Keyword continue return jump goto
|
||||
syn keyword Keyword counter log limit
|
||||
syn keyword Keyword define
|
||||
|
||||
let b:current_syntax = 'nftables'
|
Loading…
Add table
Reference in a new issue