aboutsummaryrefslogtreecommitdiff
path: root/runtime/indent
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-04-10 01:43:07 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-04-10 01:43:07 -0400
commit1bf1ffc7346c0cc8e8ef337fd94badd3a530e90e (patch)
tree5794dcd00d9d1198fbbb1c6e60739bc6b335283d /runtime/indent
parentbf2c2b34cf2314a03236c692b02778eb964dcccb (diff)
parentbeccc3e3a132a401c800e77785f52cb0683bd859 (diff)
downloadrneovim-1bf1ffc7346c0cc8e8ef337fd94badd3a530e90e.tar.gz
rneovim-1bf1ffc7346c0cc8e8ef337fd94badd3a530e90e.tar.bz2
rneovim-1bf1ffc7346c0cc8e8ef337fd94badd3a530e90e.zip
Merge pull request #4505 from watiko/vim-runtimes
vim-patch:86ae720,f913281,dd1616e
Diffstat (limited to 'runtime/indent')
-rw-r--r--runtime/indent/sh.vim4
-rw-r--r--runtime/indent/teraterm.vim67
2 files changed, 70 insertions, 1 deletions
diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim
index 0394ee22e8..29a25a2108 100644
--- a/runtime/indent/sh.vim
+++ b/runtime/indent/sh.vim
@@ -1,6 +1,8 @@
" Vim indent file
" Language: Shell Script
-" Maintainer: Peter Aronoff <telemachus@arpinum.org>
+" Maintainer: Currently unmaintained. If you want to take it, please
+" email Bram
+" Previous Maintainer: Peter Aronoff <telemachus@arpinum.org>
" Original Author: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2014-08-22
diff --git a/runtime/indent/teraterm.vim b/runtime/indent/teraterm.vim
new file mode 100644
index 0000000000..ba24257b02
--- /dev/null
+++ b/runtime/indent/teraterm.vim
@@ -0,0 +1,67 @@
+" Vim indent file
+" Language: Tera Term Language (TTL)
+" Based on Tera Term Version 4.86
+" Maintainer: Ken Takata
+" URL: https://github.com/k-takata/vim-teraterm
+" Last Change: 2015 Jun 4
+" Filenames: *.ttl
+" License: VIM License
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal nosmartindent
+setlocal noautoindent
+setlocal indentexpr=GetTeraTermIndent(v:lnum)
+setlocal indentkeys=!^F,o,O,e
+setlocal indentkeys+==elseif,=endif,=loop,=next,=enduntil,=endwhile
+
+if exists("*GetTeraTermIndent")
+ finish
+endif
+
+" The shiftwidth() function is relatively new.
+" Don't require it to exist.
+if exists('*shiftwidth')
+ function s:sw() abort
+ return shiftwidth()
+ endfunction
+else
+ function s:sw() abort
+ return &shiftwidth
+ endfunction
+endif
+
+function! GetTeraTermIndent(lnum)
+ let l:prevlnum = prevnonblank(a:lnum-1)
+ if l:prevlnum == 0
+ " top of file
+ return 0
+ endif
+
+ " grab the previous and current line, stripping comments.
+ let l:prevl = substitute(getline(l:prevlnum), ';.*$', '', '')
+ let l:thisl = substitute(getline(a:lnum), ';.*$', '', '')
+ let l:previ = indent(l:prevlnum)
+
+ let l:ind = l:previ
+
+ if l:prevl =~ '^\s*if\>.*\<then\s*$'
+ " previous line opened a block
+ let l:ind += s:sw()
+ endif
+ if l:prevl =~ '^\s*\%(elseif\|else\|do\|until\|while\|for\)\>'
+ " previous line opened a block
+ let l:ind += s:sw()
+ endif
+ if l:thisl =~ '^\s*\%(elseif\|else\|endif\|enduntil\|endwhile\|loop\|next\)\>'
+ " this line closed a block
+ let l:ind -= s:sw()
+ endif
+
+ return l:ind
+endfunction
+
+" vim: ts=8 sw=2 sts=2