File: tidyall.vim

package info (click to toggle)
libcode-tidyall-perl 0.55~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 876 kB
  • ctags: 259
  • sloc: perl: 3,882; lisp: 47; makefile: 25
file content (22 lines) | stat: -rw-r--r-- 629 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
" Run tidyall on the current buffer. If an error occurs, show it and leave it
" in tidyall.ERR, and undo any changes.

command! TidyAll :call TidyAll()
function! TidyAll()
    let cur_pos = getpos( '.' )
    let cmdline = ':1,$!tidyall --mode editor --pipe %:p 2> tidyall.ERR'
    execute( cmdline )
    if v:shell_error
        echo "\nContents of tidyall.ERR:\n\n" . system( 'cat tidyall.ERR' )
        silent undo
    else
        call system( 'rm tidyall.ERR' )
    endif
    call setpos( '.', cur_pos )
endfunction

" Uncomment to set leader to ,
" let mapleader = ','

" Bind to ,t (or leader+t)
map <leader>t :TidyAll<cr>