vim. use ledger print as 'formatprg'
You can now try to select some lines using V (visual mode) and have them automatically formatted using gq
This commit is contained in:
parent
0570c9c416
commit
04f564f01c
2 changed files with 18 additions and 7 deletions
|
|
@ -12,13 +12,9 @@ if exists(":CompilerSet") != 2
|
||||||
command -nargs=* CompilerSet setlocal <args>
|
command -nargs=* CompilerSet setlocal <args>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" default value will be set in ftplugin
|
||||||
if ! exists("g:ledger_bin") || empty(g:ledger_bin) || ! executable(split(g:ledger_bin, '\s')[0])
|
if ! exists("g:ledger_bin") || empty(g:ledger_bin) || ! executable(split(g:ledger_bin, '\s')[0])
|
||||||
if executable('ledger')
|
finish
|
||||||
let g:ledger_bin = 'ledger'
|
|
||||||
else
|
|
||||||
echoerr "ledger command not found. Set g:ledger_bin or extend $PATH."
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" %-G throws away blank lines, everything else is assumed to be part of a
|
" %-G throws away blank lines, everything else is assumed to be part of a
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ let b:did_ftplugin = 1
|
||||||
|
|
||||||
let b:undo_ftplugin = "setlocal ".
|
let b:undo_ftplugin = "setlocal ".
|
||||||
\ "foldmethod< foldtext< ".
|
\ "foldmethod< foldtext< ".
|
||||||
\ "include< comments< omnifunc< "
|
\ "include< comments< omnifunc< formatprg<"
|
||||||
|
|
||||||
" don't fill fold lines --> cleaner look
|
" don't fill fold lines --> cleaner look
|
||||||
setl fillchars="fold: "
|
setl fillchars="fold: "
|
||||||
|
|
@ -22,6 +22,21 @@ setl include=^!include
|
||||||
setl comments=b:;
|
setl comments=b:;
|
||||||
setl omnifunc=LedgerComplete
|
setl omnifunc=LedgerComplete
|
||||||
|
|
||||||
|
" set location of ledger binary for checking and auto-formatting
|
||||||
|
if ! exists("g:ledger_bin") || empty(g:ledger_bin) || ! executable(split(g:ledger_bin, '\s')[0])
|
||||||
|
if executable('ledger')
|
||||||
|
let g:ledger_bin = 'ledger'
|
||||||
|
else
|
||||||
|
unlet g:ledger_bin
|
||||||
|
echoerr "ledger command not found. Set g:ledger_bin or extend $PATH ".
|
||||||
|
\ "to enable error checking and auto-formatting."
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("g:ledger_bin")
|
||||||
|
exe 'setl formatprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ -\ print'
|
||||||
|
endif
|
||||||
|
|
||||||
" You can set a maximal number of columns the fold text (excluding amount)
|
" You can set a maximal number of columns the fold text (excluding amount)
|
||||||
" will use by overriding g:ledger_maxwidth in your .vimrc.
|
" will use by overriding g:ledger_maxwidth in your .vimrc.
|
||||||
" When maxwidth is zero, the amount will be displayed at the far right side
|
" When maxwidth is zero, the amount will be displayed at the far right side
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue