<commit_before>" Vim indent file
" Language:      Clojure
" Maintainer:    <NAME> <<EMAIL>>
" URL:           http://kotka.de/projects/clojure/vimclojure.html

" Only load this indent file when no other was loaded.
if exists("b:did_indent")
	finish
endif
let b:did_indent = 1

let s:save_cpo = &cpo
set cpo&vim

let b:undo_indent = "setlocal ai< si< lw< et< sts< sw< inde< indk<"

setlocal noautoindent expandtab nosmartindent

setlocal softtabstop=2
setlocal shiftwidth=2

setlocal indentkeys=!,o,O

if exists("*searchpairpos")

function! s:MatchPairs(open, close, stopat)
	" Stop only on vector and map [ resp. {. Ignore the ones in strings and
	" comments.
	return searchpairpos(a:open, '', a:close, 'bWn',
				\ 'vimclojure#util#SynIdName() !~ "clojureParen\\d"',
				\ a:stopat)
endfunction

function! ClojureCheckForStringWorker() dict
	" Check whether there is the last character of the previous line is
	" highlighted as a string. If so, we check whether it's a ". In this
	" case we have to check also the previous character. The " might be the
	" closing one. In case the we are still in the string, we search for the
	" opening ". If this is not found we take the indent of the line.
	let nb = prevnonblank(v:lnum - 1)

	if nb == 0
		return -1
	endif

	call cursor(nb, 0)
	call cursor(0, col("$") - 1)
	if vimclojure#util#SynIdName() != "clojureString"
		return -1
	endif

	" This will not work for a " in the first column...
	if vimclojure#util#Yank('l', 'normal! "lyl') == '"'
		call cursor(0, col("$") - 2)
		if vimclojure#util#SynIdName() != "clojureString"
			return -1
		endif
		if vimclojure#util#Yank('l', 'normal! "lyl') != '\\'
			return -1
		endif
		call cursor(0, col("$") - 1)
	endif

	let p = searchpos('\(^\|[^\\]\)\zs"', 'bW')

	if p != [0, 0]
		return p[1] - 1
	endif

	return indent(".")
endfunction

function! s:CheckForString()
	return vimclojure#util#WithSavedPosition({
				\ 'f' : function("ClojureCheckForStringWorker")
				\ })
endfunction

function! ClojureIsMethodSpecialCaseWorker() dict
	" Find the next enclosing form.
	call vimclojure#util#MoveBackward()

	" Special case: we are at a '(('.
	if vimclojure#util#Yank('l', 'normal! "lyl') == '('
		return 0
	endif
	call cursor(self.pos)

	let nextParen = s:MatchPairs('(', ')', 0)

	" Special case: we are now at toplevel.
	if nextParen == [0, 0]
		return 0
	endif
	call cursor(nextParen)

	call vimclojure#util#MoveForward()
	let keyword = vimclojure#util#Yank('l', 'normal! "lye')
	if index([ 'deftype', 'defrecord', 'reify', 'proxy',
				\ 'extend', 'extend-type', 'extend-protocol',
				\ 'letfn' ], keyword) >= 0
		return 1
	endif

	return 0
endfunction<commit_msg>Remove extend from letfn-style special case indenting<commit_after>" Vim indent file
" Language:      Clojure
" Maintainer:    <NAME> <<EMAIL>>
" URL:           http://kotka.de/projects/clojure/vimclojure.html

" Only load this indent file when no other was loaded.
if exists("b:did_indent")
	finish
endif
let b:did_indent = 1

let s:save_cpo = &cpo
set cpo&vim

let b:undo_indent = "setlocal ai< si< lw< et< sts< sw< inde< indk<"

setlocal noautoindent expandtab nosmartindent

setlocal softtabstop=2
setlocal shiftwidth=2

setlocal indentkeys=!,o,O

if exists("*searchpairpos")

function! s:MatchPairs(open, close, stopat)
	" Stop only on vector and map [ resp. {. Ignore the ones in strings and
	" comments.
	return searchpairpos(a:open, '', a:close, 'bWn',
				\ 'vimclojure#util#SynIdName() !~ "clojureParen\\d"',
				\ a:stopat)
endfunction

function! ClojureCheckForStringWorker() dict
	" Check whether there is the last character of the previous line is
	" highlighted as a string. If so, we check whether it's a ". In this
	" case we have to check also the previous character. The " might be the
	" closing one. In case the we are still in the string, we search for the
	" opening ". If this is not found we take the indent of the line.
	let nb = prevnonblank(v:lnum - 1)

	if nb == 0
		return -1
	endif

	call cursor(nb, 0)
	call cursor(0, col("$") - 1)
	if vimclojure#util#SynIdName() != "clojureString"
		return -1
	endif

	" This will not work for a " in the first column...
	if vimclojure#util#Yank('l', 'normal! "lyl') == '"'
		call cursor(0, col("$") - 2)
		if vimclojure#util#SynIdName() != "clojureString"
			return -1
		endif
		if vimclojure#util#Yank('l', 'normal! "lyl') != '\\'
			return -1
		endif
		call cursor(0, col("$") - 1)
	endif

	let p = searchpos('\(^\|[^\\]\)\zs"', 'bW')

	if p != [0, 0]
		return p[1] - 1
	endif

	return indent(".")
endfunction

function! s:CheckForString()
	return vimclojure#util#WithSavedPosition({
				\ 'f' : function("ClojureCheckForStringWorker")
				\ })
endfunction

function! ClojureIsMethodSpecialCaseWorker() dict
	" Find the next enclosing form.
	call vimclojure#util#MoveBackward()

	" Special case: we are at a '(('.
	if vimclojure#util#Yank('l', 'normal! "lyl') == '('
		return 0
	endif
	call cursor(self.pos)

	let nextParen = s:MatchPairs('(', ')', 0)

	" Special case: we are now at toplevel.
	if nextParen == [0, 0]
		return 0
	endif
	call cursor(nextParen)

	call vimclojure#util#MoveForward()
	let keyword = vimclojure#util#Yank('l', 'normal! "lye')
	if index([ 'deftype', 'defrecord', 'reify', 'proxy',
				\ 'extend-type', 'extend-protocol',
				\ 'letfn' ], keyword) >= 0
		return 1
	endif

	return 0
endfunction
{'fraction_non_alphanumeric': 0.14093457943925233, 'fraction_numerical': 0.010467289719626169, 'mean_word_length': 3.877848678213309, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '477726', 'n_tokens_mistral': 2130, 'n_tokens_neox': 1981, 'n_words': 608}