vim-ledger


Ⅰ. 插件描述

Today it's better to use https://github.com/ledger/vim-ledger; This repo is the outdated ledger filetype for vim, extracted from ledger repository with some fixes

Ⅱ. 基本信息

创建日期:  2011-02-26
使用用户:  6
Github星:  5
插件作者:  Vladimir Parfinenko

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'cypok/vim-ledger-state-of-grace'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'cypok/vim-ledger-state-of-grace'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'cypok/vim-ledger-state-of-grace'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/cypok/vim-ledger

Ⅳ. 文档说明

This is the ledger filetype for vim.
Copy each file to the corresponding directory in your ~/.vim directory.
Then include the following line in your .vimrc or in ~/.vim/filetype.vim
au BufNewFile,BufRead .ldg,.ledger setf ledger | comp ledger
You can also use a modeline like this in every ledger file
vim:filetype=ledger

Tips and useful commands

• Try account-completion (as explained below)
• :call LedgerSetDate(line('.'), 'effective')
will set today's date as the effective date of the current

  1. You can use also 'actual' in place of 'effective'
  2. pass in a different date measured as seconds since 1st Jan 1970.

• :call LedgerSetTransactionState(line('.'), '*')
sets the state of the current transaction to '*'. You can
use this in custom mappings.
• :call LedgerToggleTransactionState(line('.'), ' *?!')
will toggle through the provided transaction states.
You can map this to double-clicking for example:
noremap <silent><buffer> <2-LeftMouse>
:call LedgerToggleTransactionState(line('.'), ' *?!')<CR>

Configuration

Include the following let-statements somewhere in your .vimrc
to modify the behaviour of the ledger filetype.

  • Number of colums that will be used to display the foldtext.
    Set this when you think that the amount is too far off to the right.
    let g:ledger_maxwidth = 80
  • String that will be used to fill the space between account name
    and amount in the foldtext. Set this to get some kind of lines

or visual aid.

let g:ledger_fillstring = '    -'

My special tip is to use so-called digraphs:
Press <C-K> followed by the two-characters key sequence below.
(in insert-mode)

'. = ˙ or ': = ¨ --> ˙˙˙˙˙˙ or ¨¨¨¨¨¨
', = ¸           --> ¸¸¸¸¸¸
.M = ·           --> ······
>> = »           --> »»»»»»

All those look rather unobstrusive
and provide a good visual aid to find the correct amount.

  • If you want the account completion to be sorted by level of detail/depth
    instead of alphabetical, include the following line:
    let g:ledger_detailed_first = 1

Completion

Omni completion is currently implemented for account names only.

Accounts

Account names are matched by the start of every sub-level.
When you insert an account name like this:
Asse<C-X><C-O>
You will get a list of top-level accounts that start like this.

Go ahead and try something like:
As:Ban:Che<C-X><C-O>
When you have an account like this, 'Assets:Bank:Checking' should show up.

When you want to complete on a virtual transaction,
it's currently best to keep the cursor in front of the closing bracket.
Of course you can insert the closing bracket after calling the completion, too.

License

Copyright 2011-2009 by Johann Klähn
Copyright 2009 by Stefan Karrmann
Copyright 2005 by Wolfgang Oertl

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.

添加新评论