From 94f72a68c3dccade13ec7203a284620040f930f1 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 11 Mar 2014 00:36:09 +0100 Subject: Update --- ftplugin/csv.vim | 7 +++--- ftplugin/latex-box/folding.vim | 25 ++++++++++++++++--- ftplugin/rust.vim | 55 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 79 insertions(+), 8 deletions(-) (limited to 'ftplugin') diff --git a/ftplugin/csv.vim b/ftplugin/csv.vim index 82ef430e..d824c154 100644 --- a/ftplugin/csv.vim +++ b/ftplugin/csv.vim @@ -2381,11 +2381,12 @@ fu! SubstituteInColumn(command, line1, line2) range "{{{3 endfu fu! ColumnMode() "{{{3 - if mode() =~# 'R' + let mode = mode() + if mode =~# 'R' " (virtual) Replace mode let new_line = (line('.') == line('$') || - \ (synIDattr(synIDtrans(synID(line("."), col("."), 1)), "name") !~# "comment")) - return "\". (new_line ? "o" : "JE".mode()) + \ (synIDattr(synIDtrans(synID(line("."), col("."), 1)), "name") =~? "comment")) + return "\g`[". (new_line ? "o" : "J".mode) else return "\" endif diff --git a/ftplugin/latex-box/folding.vim b/ftplugin/latex-box/folding.vim index 55a975f8..badfc137 100644 --- a/ftplugin/latex-box/folding.vim +++ b/ftplugin/latex-box/folding.vim @@ -31,6 +31,9 @@ endif if !exists('g:LatexBox_fold_envs') let g:LatexBox_fold_envs=1 endif +if !exists('g:LatexBox_fold_envs_force') + let g:LatexBox_fold_envs_force = [] +endif if !exists('g:LatexBox_fold_parts') let g:LatexBox_fold_parts=[ \ "appendix", @@ -159,11 +162,27 @@ function! LatexBox_FoldLevel(lnum) endif " Fold environments - if g:LatexBox_fold_envs == 1 - if line =~# s:envbeginpattern + if line =~# s:envbeginpattern + if g:LatexBox_fold_envs == 1 return "a1" - elseif line =~# s:envendpattern + else + let env = matchstr(line,'\\begin\*\?{\zs\w*\*\?\ze}') + if index(g:LatexBox_fold_envs_force, env) >= 0 + return "a1" + else + return "=" + endif + endif + elseif line =~# s:envendpattern + if g:LatexBox_fold_envs == 1 return "s1" + else + let env = matchstr(line,'\\end\*\?{\zs\w*\*\?\ze}') + if index(g:LatexBox_fold_envs_force, env) >= 0 + return "s1" + else + return "=" + endif endif endif diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index 281a63ef..b70cda9b 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Rust " Maintainer: Chris Morgan -" Last Change: 2013 Jul 10 +" Last Change: 2014 Feb 27 if exists("b:did_ftplugin") finish @@ -42,4 +42,55 @@ if exists("g:loaded_delimitMate") let b:delimitMate_excluded_regions = delimitMate#Get("excluded_regions") . ',rustLifetimeCandidate,rustGenericLifetimeCandidate' endif -let b:undo_ftplugin = "setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< | if exists('b:rust_original_delimitMate_excluded_regions') | let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions | unlet b:rust_original_delimitMate_excluded_regions | elseif exists('b:delimitMate_excluded_regions') | unlet b:delimitMate_excluded_regions | endif" +" Bind motion commands to support hanging indents +nnoremap [[ :call Rust_Jump('n', 'Back') +nnoremap ]] :call Rust_Jump('n', 'Forward') +xnoremap [[ :call Rust_Jump('v', 'Back') +xnoremap ]] :call Rust_Jump('v', 'Forward') +onoremap [[ :call Rust_Jump('o', 'Back') +onoremap ]] :call Rust_Jump('o', 'Forward') + +let b:undo_ftplugin = " + \setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< + \|if exists('b:rust_original_delimitMate_excluded_regions') + \|let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions + \|unlet b:rust_original_delimitMate_excluded_regions + \|elseif exists('b:delimitMate_excluded_regions') + \|unlet b:delimitMate_excluded_regions + \|endif + \|nunmap [[ + \|nunmap ]] + \|xunmap [[ + \|xunmap ]] + \|ounmap [[ + \|ounmap ]] + \" + +if exists('*Rust_Jump') | finish | endif + +function! Rust_Jump(mode, function) range + let cnt = v:count1 + normal! m' + if a:mode ==# 'v' + norm! gv + endif + let foldenable = &foldenable + set nofoldenable + while cnt > 0 + execute "call Rust_Jump_" . a:function . "()" + let cnt = cnt - 1 + endwhile + let &foldenable = foldenable +endfunction + +function! Rust_Jump_Back() + call search('{', 'b') + keepjumps normal! w99[{ +endfunction + +function! Rust_Jump_Forward() + normal! j0 + call search('{', 'b') + keepjumps normal! w99[{% + call search('{') +endfunction -- cgit v1.2.3