Last active
July 29, 2018 09:57
-
-
Save matsub/40e7da7ebb8633bde67dbb3a7f3439b3 to your computer and use it in GitHub Desktop.
IPv4 / IPv6 syntax on Vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax match IPv4 /\v((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])(\/(3[0-2]|[1-2]?[0-9]))?/ | |
syntax match IPv6 /\v([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}/ " 1:2:3:4:5:6:7:8 | |
syntax match IPv6 /\v([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}/ " 1:2:3:4:5:6::8 ~ 1::8 | |
syntax match IPv6 /\v([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}/ " 1:2:3:4:5::8 ~ 1::7:8 | |
syntax match IPv6 /\v([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}/ " 1:2:3:4::8 ~ 1::6:7:8 | |
syntax match IPv6 /\v([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}/ " 1:2:3::8 ~ 1::5:6:7:8 | |
syntax match IPv6 /\v([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}/ " 1:2::8 ~ 1::4:5:6:7:8 | |
syntax match IPv6 /\v[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})/ " 1::8 ~ 1::3:4:5:6:7:8 | |
syntax match IPv6 /\v([0-9a-fA-F]{1,4}:){1,7}:/ " 1:2:3:4:5:6:7::, 1:: | |
syntax match IPv6 /\v:((:[0-9a-fA-F]{1,4}){1,7}|:)/ " ::2:3:4:5:6:7:8, ::2:3:4:5:6:7:8, ::8, :: | |
syntax match IPv6 /\v::(ffff:)?((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3,3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])/ " ::ffff:127.0.0.1 ::127.0.0.1 (IPv4-mapped address) | |
highlight link IPv4 Constant | |
highlight link IPv6 Constant |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment