Mercurial > vim
view runtime/indent/teraterm.vim @ 15380:f62d6bd18a49 v8.1.0698
patch 8.1.0698: clearing the window is used too often
commit https://github.com/vim/vim/commit/bf3250a8ad39797e3ccdac82d20c6f19533419e4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 6 17:25:29 2019 +0100
patch 8.1.0698: clearing the window is used too often
Problem: Clearing the window is used too often, causing the command line
to be cleared when opening a tab. (Miroslav Ko?k?r)
Solution: Use NOT_VALID instead of CLEAR. (suggested by Jason Franklin,
closes #630) Also do this for a few other places where clearing
the screen isn't really needed.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 06 Jan 2019 17:30:05 +0100 |
parents | 34fd018452ed |
children | ebedba7a4898 |
line wrap: on
line source
" Vim indent file " Language: Tera Term Language (TTL) " Based on Tera Term Version 4.100 " Maintainer: Ken Takata " URL: https://github.com/k-takata/vim-teraterm " Last Change: 2018-08-31 " 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 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\>' " previous line opened a block let l:ind += shiftwidth() endif if l:prevl =~ '^\s*\%(elseif\|else\|do\|until\|while\|for\)\>' " previous line opened a block let l:ind += shiftwidth() endif if l:thisl =~ '^\s*\%(elseif\|else\|endif\|enduntil\|endwhile\|loop\|next\)\>' " this line closed a block let l:ind -= shiftwidth() endif return l:ind endfunction " vim: ts=8 sw=2 sts=2