From 271b63d71707720ad0d35590b8cb50f8f8f43014 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Mon, 11 May 2015 15:05:13 +0200 Subject: Update --- indent/blade.vim | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ indent/elixir.vim | 7 +++++- indent/gohtmltmpl.vim | 5 +++++ indent/perl.vim | 5 ----- indent/perl6.vim | 5 ----- indent/tex.vim | 12 ++++++++++ indent/typescript.vim | 10 +++++++++ 7 files changed, 95 insertions(+), 11 deletions(-) create mode 100644 indent/blade.vim create mode 100644 indent/gohtmltmpl.vim (limited to 'indent') diff --git a/indent/blade.vim b/indent/blade.vim new file mode 100644 index 00000000..7515a239 --- /dev/null +++ b/indent/blade.vim @@ -0,0 +1,62 @@ +" Language: Blade +" Author: Barry Deeney +" Version: 0.1 +" Description: BLADE indent file based on HTML indentation... + +" Check if this file has already been loaded +if exists("b:did_indent") + finish +endif + +" Include HTML +runtime! indent/html.vim +runtime! indent/php.vim +silent! unlet b:did_indent + +" What function do we need to use to detect indentation? +setlocal indentexpr=BladeIndent() + +" What keys would trigger indentation? +setlocal indentkeys=o,O,,<>>,{,},!^F,0{,0},0),:,!^F,o,O,e,*,=?>,=$' let s:pipeline = '^\s*|>.*$' @@ -59,7 +60,11 @@ function! GetElixirIndent() let ind += opened_symbol * &sw - if current_line =~ '^\s*\(\]\|}\)' + if last_line =~ '^\s*\(' . s:symbols_end . '\)' + let ind += &sw + endif + + if current_line =~ '^\s*\(' . s:symbols_end . '\)' let ind -= &sw endif diff --git a/indent/gohtmltmpl.vim b/indent/gohtmltmpl.vim new file mode 100644 index 00000000..50399f2b --- /dev/null +++ b/indent/gohtmltmpl.vim @@ -0,0 +1,5 @@ +if exists("b:did_indent") + finish +endif + +runtime! indent/html.vim diff --git a/indent/perl.vim b/indent/perl.vim index 3ce3e59a..7d21d219 100644 --- a/indent/perl.vim +++ b/indent/perl.vim @@ -48,11 +48,6 @@ function! GetPerlIndent() return 0 endif - " Don't reindent comments on first column - if cline =~ '^#.' - return 0 - endif - " Get current syntax item at the line's first char let csynid = '' if b:indent_use_syntax diff --git a/indent/perl6.vim b/indent/perl6.vim index 161782e8..564ca81b 100644 --- a/indent/perl6.vim +++ b/indent/perl6.vim @@ -60,11 +60,6 @@ function! GetPerl6Indent() return 0 endif - " Don't reindent coments on first column - if cline =~ '^#' - return 0 - endif - " Get current syntax item at the line's first char let csynid = '' if b:indent_use_syntax diff --git a/indent/tex.vim b/indent/tex.vim index e7653d03..3abc44ba 100644 --- a/indent/tex.vim +++ b/indent/tex.vim @@ -101,9 +101,21 @@ function! Latexbox_CallIndent() let window = getpos('.') call setpos('.', cursor) + " Get first non-whitespace character of current line. + let line_start_char = matchstr(getline('.'), '\S') + + " Get initial tab position. + let initial_tab = stridx(getline('.'), line_start_char) + " Execute the command. execute 'normal! ==' + " Get tab position difference. + let difference = stridx(getline('.'), line_start_char) - initial_tab + + " Set new cursor Y position based on calculated difference. + let cursor[2] = cursor[2] + difference + " Restore the previous window position. call setpos('.', window) normal! zt diff --git a/indent/typescript.vim b/indent/typescript.vim index f498298b..78d04c5c 100644 --- a/indent/typescript.vim +++ b/indent/typescript.vim @@ -3,6 +3,10 @@ " Maintainer: None! Wanna improve this? " Last Change: 2015 Mar 07 +if get(g:, 'typescript_indent_disable') + finish +endif + " Only load this indent file when no other was loaded. if exists("b:did_indent") finish @@ -54,6 +58,12 @@ function GetTypescriptIndent() return indent(prev) endif + " If a variable was declared and the semicolon omitted, do not indent + " the next line + if getline(prev) =~ '^\s*var\s\+\w\+' + return indent(prev) + endif + " Try to find out whether the last `}` ended a ` : {` block if getline(prev) =~ '};\s*$' " jump to matching `{` bracket -- cgit v1.2.3