diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2014-06-08 13:18:33 +0200 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2014-06-08 13:18:33 +0200 | 
| commit | 45273d44d4b1bd9a1be431c1a98f9046ed3a5c79 (patch) | |
| tree | 7b8fa566b3da949b422804c3bb9eaf9c51b9b69e /ftplugin | |
| parent | e961fa80374369c9e299b333639db0dc43d1f126 (diff) | |
| download | vim-polyglot-45273d44d4b1bd9a1be431c1a98f9046ed3a5c79.tar.gz vim-polyglot-45273d44d4b1bd9a1be431c1a98f9046ed3a5c79.zip | |
Major update
Diffstat (limited to '')
| -rw-r--r-- | ftplugin/csv.vim | 52 | ||||
| -rw-r--r-- | ftplugin/go.vim | 4 | ||||
| -rw-r--r-- | ftplugin/html.vim | 7 | ||||
| -rw-r--r-- | ftplugin/latextoc.vim | 5 | ||||
| -rw-r--r-- | ftplugin/mustache.vim | 16 | 
5 files changed, 52 insertions, 32 deletions
| diff --git a/ftplugin/csv.vim b/ftplugin/csv.vim index 0b3eee19..b6414d9f 100644 --- a/ftplugin/csv.vim +++ b/ftplugin/csv.vim @@ -483,7 +483,7 @@ fu! <sid>GetDelimiter(first, last) "{{{3      if !exists("b:csv_fixed_width_cols")          let _cur = getpos('.')          let _s   = @/ -        let Delim= {0: ';', 1:  ',', 2: '|', 3: '	'} +        let Delim= {0: ';', 1:  ',', 2: '|', 3: '	', 4: '\^'}          let temp = {}          " :silent :s does not work with lazyredraw          let _lz  = &lz @@ -525,12 +525,16 @@ fu! <sid>WColumn(...) "{{{3          let fields=(split(line[0:end],b:col.'\zs'))          let ret=len(fields)          if exists("a:1") && a:1 > 0 -            " bang attribute +            " bang attribute: Try to get the column name              let head  = split(getline(1),b:col.'\zs')              " remove preceeding whitespace -            let ret   = substitute(head[ret-1], '^\s\+', '', '') -            " remove delimiter -            let ret   = substitute(ret, b:delimiter. '$', '', '') +            if len(head) < ret +                call <sid>Warn("Header has no field ". ret) +            else +                let ret   = substitute(head[ret-1], '^\s\+', '', '') +                " remove delimiter +                let ret   = substitute(ret, b:delimiter. '$', '', '') +            endif          endif      else          let temp=getpos('.')[2] @@ -1002,7 +1006,8 @@ fu! <sid>MoveCol(forward, line, ...) "{{{3      elseif a:forward < 0          if colnr > 0 || cpos == spos              call search('.\ze'.pat, 'bWe') -            while getpos('.')[2] == cpos +            let stime=localtime() +            while getpos('.')[2] == cpos && <sid>Timeout(stime) " make sure loop terminates                  " cursor didn't move, move cursor one cell to the left                  norm! h                  if colnr > 0 @@ -1208,8 +1213,10 @@ fu! <sid>AddColumn(start, stop, ...) range "{{{3      if exists("a:1")          if a:1 == '$' || a:1 >= max              let pos = max -        elseif a:1 <= 0 +        elseif a:1 < 0              let pos = col +        else +            let pos = a:1          endif      else          let pos = col @@ -1217,7 +1224,7 @@ fu! <sid>AddColumn(start, stop, ...) range "{{{3      let cnt=(exists("a:2") && a:2 > 0 ? a:2 : 1)      " translate 1 based columns into zero based list index -    let pos -= 1 +    "let pos -= 1      let col -= 1      if pos == 0 @@ -1772,7 +1779,7 @@ endfu  fu! <sid>NewRecord(line1, line2, count) "{{{3      if a:count =~ "\D" -        call <sid>WarningMsg("Invalid count specified") +        call <sid>Warn("Invalid count specified")          return      endif @@ -1848,20 +1855,13 @@ fu! <sid>CSVMappings() "{{{3      call <sid>Map('noremap', 'E', ':<C-U>call <SID>MoveCol(-1, line("."))<CR>')      call <sid>Map('noremap', '<C-Left>', ':<C-U>call <SID>MoveCol(-1, line("."))<CR>')      call <sid>Map('noremap', 'H', ':<C-U>call <SID>MoveCol(-1, line("."), 1)<CR>') -    call <sid>Map('noremap', 'K', ':<C-U>call <SID>MoveCol(0, -        \ line(".")-v:count1)<CR>') -    call <sid>Map('noremap', '<Up>', ':<C-U>call <SID>MoveCol(0, -        \ line(".")-v:count1)<CR>') -    call <sid>Map('noremap', 'J', ':<C-U>call <SID>MoveCol(0, -        \ line(".")+v:count1)<CR>') -    call <sid>Map('noremap', '<Down>', ':<C-U>call <SID>MoveCol(0, -        \ line(".")+v:count1)<CR>') -    call <sid>Map('nnoremap', '<CR>', ':<C-U>call <SID>PrepareFolding(1, -        \ 1)<CR>') -    call <sid>Map('nnoremap', '<Space>', ':<C-U>call <SID>PrepareFolding(1, -        \ 0)<CR>') -    call <sid>Map('nnoremap', '<BS>', ':<C-U>call <SID>PrepareFolding(0, -        \ 1)<CR>') +    call <sid>Map('noremap', 'K', ':<C-U>call <SID>MoveCol(0, line(".")-v:count1)<CR>') +    call <sid>Map('noremap', '<Up>', ':<C-U>call <SID>MoveCol(0, line(".")-v:count1)<CR>') +    call <sid>Map('noremap', 'J', ':<C-U>call <SID>MoveCol(0, line(".")+v:count1)<CR>') +    call <sid>Map('noremap', '<Down>', ':<C-U>call <SID>MoveCol(0, line(".")+v:count1)<CR>') +    call <sid>Map('nnoremap', '<CR>', ':<C-U>call <SID>PrepareFolding(1, 1)<CR>') +    call <sid>Map('nnoremap', '<Space>', ':<C-U>call <SID>PrepareFolding(1, 0)<CR>') +    call <sid>Map('nnoremap', '<BS>', ':<C-U>call <SID>PrepareFolding(0, 1)<CR>')      call <sid>Map('imap', '<CR>', '<sid>ColumnMode()', 'expr')      " Text object: Field      call <sid>Map('vnoremap', 'if', ':<C-U>call <sid>MoveOver(0)<CR>') @@ -1937,9 +1937,6 @@ fu! <sid>CommandDefinitions() "{{{3          \ '-nargs=1 -complete=custom,<sid>CompleteColumnNr')      call <sid>LocalCmd('Transpose', ':call <sid>Transpose(<line1>, <line2>)',          \ '-range=%') -    call <sid>LocalCmd('Tabularize', ':call <sid>Tabularize(<bang>0,<line1>,<line2>)', -        \ '-bang -range=%') -    " Alias for :Tabularize, might be taken by Tabular plugin      call <sid>LocalCmd('CSVTabularize', ':call <sid>Tabularize(<bang>0,<line1>,<line2>)',          \ '-bang -range=%')      call <sid>LocalCmd("AddColumn", @@ -2391,6 +2388,9 @@ fu! <sid>ColumnMode() "{{{3          return "\<CR>"      endif  endfu +fu! <sid>Timeout(start) "{{{3 +    return localtime()-a:start < 2 +endfu  " Global functions "{{{2  fu! csv#EvalColumn(nr, func, first, last) range "{{{3 diff --git a/ftplugin/go.vim b/ftplugin/go.vim index 8066733c..532fb172 100644 --- a/ftplugin/go.vim +++ b/ftplugin/go.vim @@ -9,9 +9,11 @@ if exists("b:did_ftplugin")  endif  let b:did_ftplugin = 1 +setlocal formatoptions-=t +  setlocal comments=s1:/*,mb:*,ex:*/,://  setlocal commentstring=//\ %s -let b:undo_ftplugin = "setl com< cms<" +let b:undo_ftplugin = "setl fo< com< cms<"  " vim:ts=4:sw=4:et diff --git a/ftplugin/html.vim b/ftplugin/html.vim new file mode 100644 index 00000000..4c0d9d07 --- /dev/null +++ b/ftplugin/html.vim @@ -0,0 +1,7 @@ +" Maintainer:  	othree <othree@gmail.com> +" URL:		      http://github.com/othree/html5.vim +" Last Change:  2014-05-02 +" License:      MIT +" Changes:      Add - to keyword + +setlocal iskeyword+=- diff --git a/ftplugin/latextoc.vim b/ftplugin/latextoc.vim index 01fd9bb0..d5d7e58c 100644 --- a/ftplugin/latextoc.vim +++ b/ftplugin/latextoc.vim @@ -97,6 +97,10 @@ endfunction  " {{{2 TOCFindMatch  function! s:TOCFindMatch(strsearch,duplicates,files) +    if len(a:files) == 0 +        echoerr "Could not find: " . a:strsearch +        return +    endif      call s:TOCOpenBuf(a:files[0])      let dups = a:duplicates @@ -116,7 +120,6 @@ function! s:TOCFindMatch(strsearch,duplicates,files)      endif      call s:TOCFindMatch(a:strsearch,dups,a:files[1:]) -  endfunction  " {{{2 TOCFoldLevel diff --git a/ftplugin/mustache.vim b/ftplugin/mustache.vim index 38901654..592ed09d 100644 --- a/ftplugin/mustache.vim +++ b/ftplugin/mustache.vim @@ -59,10 +59,18 @@ xnoremap <silent> <buffer> ]] :<C-U>call <SID>sectionmovement('{{','' ,'v',v:cou  " Operator pending mappings -onoremap <silent> <buffer> ie :<C-U>call <SID>wrap_inside()<CR> -onoremap <silent> <buffer> ae :<C-U>call <SID>wrap_around()<CR> -xnoremap <silent> <buffer> ie :<C-U>call <SID>wrap_inside()<CR> -xnoremap <silent> <buffer> ae :<C-U>call <SID>wrap_around()<CR> +" Operators are available by default. Set `let g:mustache_operators = 0` in +" your .vimrc to disable them. +if ! exists("g:mustache_operators") +  let g:mustache_operators = 1 +endif + +if exists("g:mustache_operators") && g:mustache_operators +  onoremap <silent> <buffer> ie :<C-U>call <SID>wrap_inside()<CR> +  onoremap <silent> <buffer> ae :<C-U>call <SID>wrap_around()<CR> +  xnoremap <silent> <buffer> ie :<C-U>call <SID>wrap_inside()<CR> +  xnoremap <silent> <buffer> ae :<C-U>call <SID>wrap_around()<CR> +endif  function! s:wrap_around()    " If the cursor is at the end of the tag element, move back | 
