<commit_before>" File: swift.vim
" Author: <NAME>
" Description: The indent file for Swift
" Last Modified: June 13, 2014

if exists("b:did_indent")
  finish
endif
let b:did_indent = 1

let s:cpo_save = &cpo
set cpo&vim

setlocal indentexpr=SwiftIndent()

function! SwiftIndent()
  let line = getline(v:lnum)
  let previousNum = prevnonblank(v:lnum - 1)
  let previous = getline(previousNum)

  if previous =~ "{" && previous !~ "}" && line !~ "}" && line !~ ":$"
    return indent(previousNum) + &tabstop
  endif

  if previous =~ "[" && previous !~ "]" && line !~ "]" && line !~ ":$"
    return indent(previousNum) + &tabstop
  endif

  " Indent multi line declarations see #19
  if previous =~ "(" && previous !~ ")"
    let previousParen = match(previous, "(")
    " Indent second line 1 space past above paren
    return previousParen + 1
    " Indent it one tabstop in
    " return indent(previousNum) + &tabstop
  endif

  if previous =~ ":$" && line !~ ":$"
    return indent(previousNum) + &tabstop
  endif

  if line =~ ":$"
    return indent(v:lnum) - &tabstop
  endif

  " Make sure the line has a colon and that the line above isn't blank
  let thisColon = match(line, ":")
  if thisColon > 0
    " && previousNum == v:lnum - 1
    let prevColon = match(previous, ":")
    if prevColon > 0
      let minInd = &tabstop + indent(v:lnum)<commit_msg>Fix previousNum comparison that was commented out<commit_after>" File: swift.vim
" Author: <NAME>
" Description: The indent file for Swift
" Last Modified: June 13, 2014

if exists("b:did_indent")
  finish
endif
let b:did_indent = 1

let s:cpo_save = &cpo
set cpo&vim

setlocal indentexpr=SwiftIndent()

function! SwiftIndent()
  let line = getline(v:lnum)
  let previousNum = prevnonblank(v:lnum - 1)
  let previous = getline(previousNum)

  if previous =~ "{" && previous !~ "}" && line !~ "}" && line !~ ":$"
    return indent(previousNum) + &tabstop
  endif

  if previous =~ "[" && previous !~ "]" && line !~ "]" && line !~ ":$"
    return indent(previousNum) + &tabstop
  endif

  " Indent multi line declarations see #19
  if previous =~ "(" && previous !~ ")"
    let previousParen = match(previous, "(")
    " Indent second line 1 space past above paren
    return previousParen + 1
    " Indent it one tabstop in
    " return indent(previousNum) + &tabstop
  endif

  if previous =~ ":$" && line !~ ":$"
    echom "d"
    return indent(previousNum) + &tabstop
  endif

  if line =~ ":$"
    echom "e"
    return indent(v:lnum) - &tabstop
  endif

  " Make sure the line has a colon and that the line above isn't blank
  let thisColon = match(line, ":")
  if thisColon > 0 && previousNum == v:lnum - 1
    let prevColon = match(previous, ":")
    if prevColon > 0
      let minInd = &tabstop + indent(v:lnum)
{'fraction_non_alphanumeric': 0.1415706051873199, 'fraction_numerical': 0.010806916426512969, 'mean_word_length': 3.393987341772152, 'pattern_counts': {'":': 14, '<': 5, '<?xml version=': 0, '>': 9, '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': '2591523', 'n_tokens_mistral': 1009, 'n_tokens_neox': 935, 'n_words': 285}