Skip to content

Instantly share code, notes, and snippets.

@mhinz
Created October 17, 2019 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhinz/9ec029b4e8ea7ac655b77f09577f9158 to your computer and use it in GitHub Desktop.
Save mhinz/9ec029b4e8ea7ac655b77f09577f9158 to your computer and use it in GitHub Desktop.
function! g:FoldLispTopForm(lnum)
let curr = getline(a:lnum)
let next = getline(a:lnum+1)
if next[0] == '('
return 0
elseif curr[0] == '('
return 1
endif
return '='
endfunction
autocmd FileType clojure,lisp,scheme setlocal foldmethod=expr foldexpr=g:FoldLispTopForm(v:lnum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment