summaryrefslogtreecommitdiffstats
path: root/indent/kotlin.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2017-09-27 19:57:29 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2017-09-27 19:57:29 +0200
commit8b3418cab8eb5267b3a5743e4d5fe5f698d48bc8 (patch)
tree125734ac66307a962eeda16283355dde0d0fbd2e /indent/kotlin.vim
parent9bfde7574aa89a91b80ed9c993fc000cfc11aae7 (diff)
downloadvim-polyglot-8b3418cab8eb5267b3a5743e4d5fe5f698d48bc8.tar.gz
vim-polyglot-8b3418cab8eb5267b3a5743e4d5fe5f698d48bc8.zip
Update
Diffstat (limited to 'indent/kotlin.vim')
-rw-r--r--indent/kotlin.vim18
1 files changed, 17 insertions, 1 deletions
diff --git a/indent/kotlin.vim b/indent/kotlin.vim
index 20bc1ee9..aacf3edb 100644
--- a/indent/kotlin.vim
+++ b/indent/kotlin.vim
@@ -3,13 +3,14 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
" Vim indent file
" Language: Kotlin
" Maintainer: Alexander Udalov
-" Latest Revision: 27 June 2015
+" Latest Revision: 15 July 2017
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
+setlocal cinoptions& cinoptions+=j1,L0
setlocal indentexpr=GetKotlinIndent()
setlocal indentkeys=0},0),!^F,o,O,e,<CR>
setlocal autoindent " TODO ?
@@ -25,6 +26,21 @@ function! GetKotlinIndent()
let prev_indent = indent(prev_num)
let cur = getline(v:lnum)
+ if cur =~ '^\s*\*'
+ return cindent(v:lnum)
+ endif
+
+ if prev =~ '^\s*\*/'
+ let st = prev
+ while st > 1
+ if getline(st) =~ '^\s*/\*'
+ break
+ endif
+ let st = st - 1
+ endwhile
+ return indent(st)
+ endif
+
let prev_open_paren = prev =~ '^.*(\s*$'
let cur_close_paren = cur =~ '^\s*).*$'