diff --git a/ftdetect/ledger.vim b/ftdetect/ledger.vim index ee99947..0172a05 100644 --- a/ftdetect/ledger.vim +++ b/ftdetect/ledger.vim @@ -1 +1 @@ -autocmd BufEnter,BufRead *.ldg,*.ledger setlocal filetype=ledger | compiler ledger +autocmd BufNewFile,BufRead *.ldg,*.ledger setlocal filetype=ledger diff --git a/ftplugin/ledger.vim b/ftplugin/ledger.vim index d0648be..9433648 100644 --- a/ftplugin/ledger.vim +++ b/ftplugin/ledger.vim @@ -13,6 +13,10 @@ let b:undo_ftplugin = "setlocal ". \ "foldtext< ". \ "include< comments< commentstring< omnifunc< formatprg<" +if !exists('current_compiler') + compiler ledger +endif + setl foldtext=LedgerFoldText() setl include=^!\\?include setl comments=b:; @@ -179,7 +183,7 @@ let s:rx_amount = '\('. function! LedgerFoldText() "{{{1 " find amount let amount = "" - let lnum = v:foldstart + let lnum = v:foldstart + 1 while lnum <= v:foldend let line = getline(lnum)