summaryrefslogtreecommitdiff
path: root/runtime/indent
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-09-02 21:07:30 +0200
committerBram Moolenaar <Bram@vim.org>2018-09-02 21:07:30 +0200
commit20aac6c1126988339611576d425965a25a777658 (patch)
tree7954ca9025cbef1081a0ea9ad231e5692c6238b0 /runtime/indent
parentacca8df9d475bbfbafc71691ebc3b857ecd2777e (diff)
downloadvim-git-20aac6c1126988339611576d425965a25a777658.tar.gz
Update runtime files.
Diffstat (limited to 'runtime/indent')
-rw-r--r--runtime/indent/dosbatch.vim59
-rw-r--r--runtime/indent/teraterm.vim4
2 files changed, 61 insertions, 2 deletions
diff --git a/runtime/indent/dosbatch.vim b/runtime/indent/dosbatch.vim
new file mode 100644
index 000000000..aea2a184d
--- /dev/null
+++ b/runtime/indent/dosbatch.vim
@@ -0,0 +1,59 @@
+" Vim indent file
+" Language: MSDOS batch file (with NT command extensions)
+" Maintainer: Ken Takata
+" URL: https://github.com/k-takata/vim-dosbatch-indent
+" Last Change: 2017 May 10
+" Filenames: *.bat
+" License: VIM License
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal nosmartindent
+setlocal noautoindent
+setlocal indentexpr=GetDosBatchIndent(v:lnum)
+setlocal indentkeys=!^F,o,O
+setlocal indentkeys+=0=)
+
+if exists("*GetDosBatchIndent")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+function! GetDosBatchIndent(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), '\c^\s*\%(@\s*\)\?rem\>.*$', '', '')
+ let l:thisl = getline(a:lnum)
+ let l:previ = indent(l:prevlnum)
+
+ let l:ind = l:previ
+
+ if l:prevl =~? '^\s*@\=if\>.*(\s*$' ||
+ \ l:prevl =~? '\<do\>\s*(\s*$' ||
+ \ l:prevl =~? '\<else\>\s*\%(if\>.*\)\?(\s*$' ||
+ \ l:prevl =~? '^.*\(&&\|||\)\s*(\s*$'
+ " previous line opened a block
+ let l:ind += shiftwidth()
+ endif
+ if l:thisl =~ '^\s*)'
+ " this line closed a block
+ let l:ind -= shiftwidth()
+ endif
+
+ return l:ind
+endfunction
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: ts=8 sw=2 sts=2
diff --git a/runtime/indent/teraterm.vim b/runtime/indent/teraterm.vim
index 370283c77..35d735429 100644
--- a/runtime/indent/teraterm.vim
+++ b/runtime/indent/teraterm.vim
@@ -1,9 +1,9 @@
" Vim indent file
" Language: Tera Term Language (TTL)
-" Based on Tera Term Version 4.92
+" Based on Tera Term Version 4.100
" Maintainer: Ken Takata
" URL: https://github.com/k-takata/vim-teraterm
-" Last Change: 2017 Jun 13
+" Last Change: 2018-08-31
" Filenames: *.ttl
" License: VIM License