Skip to content

Instantly share code, notes, and snippets.

@Karneades
Created February 2, 2021 22:34
Show Gist options
  • Save Karneades/453fd9b637ed3c5ba6ab7e0f89f65509 to your computer and use it in GitHub Desktop.
Save Karneades/453fd9b637ed3c5ba6ab7e0f89f65509 to your computer and use it in GitHub Desktop.
Phrack folding for Vim - vimrc snippet providing folding to a Phrack article in Vim
func! PhrackLevel(elements)
if getline(v:lnum) =~ '^--[ \d\.\d\.\d .*$'
return ">3"
endif
if getline(v:lnum) =~ '^--[ \d\.\d .*$'
return ">2"
endif
if getline(v:lnum) =~ '^--[ .*$'
return ">1"
endif
return "="
endfunc
func! SetPhrack()
setlocal foldexpr=PhrackLevel(1)
setlocal foldmethod=expr
endfunc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment