about summary refs log tree commit diff
path: root/pkgs/aszlig/vim/default.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2018-04-23 20:01:56 +0200
committeraszlig <aszlig@nix.build>2018-04-23 20:01:56 +0200
commit45aab49b33ab2cd4c327b996d6924f104b038193 (patch)
treeaaec202e7244c5b35e91845f51421e5bb5050e3b /pkgs/aszlig/vim/default.nix
parent0c722e889da16df441556b7642381f54228370db (diff)
pkgs/vim: Add plugin for Ledger
The plugin really is for Ledger instead of hledger, but both should be
compatible with the syntax. If we use something that's not compatible we
can still patch it in.

I also set the default currency to Euro and added an auto-align after
leaving insert mode because I'm lazy ;-)

Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/aszlig/vim/default.nix')
-rw-r--r--pkgs/aszlig/vim/default.nix21
1 files changed, 20 insertions, 1 deletions
diff --git a/pkgs/aszlig/vim/default.nix b/pkgs/aszlig/vim/default.nix
index 4cbf155d..be9d7c75 100644
--- a/pkgs/aszlig/vim/default.nix
+++ b/pkgs/aszlig/vim/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchurl, fetchFromGitHub, writeText, writeTextFile, writeScript
-, pythonPackages, vim
+, pythonPackages, ledger, vim
 }:
 
 let
@@ -285,6 +285,13 @@ let
         rm -rf "$out/org.ats-lang.toolats.vim"
       '';
     };
+
+    ledger = fetchFromGitHub {
+      owner = "ledger";
+      repo = "vim-ledger";
+      rev = "6eb3bb21aa979cc295d0480b2179938c12b33d0d";
+      sha256 = "0rbwyaanvl2bqk8xm4kq8fkv8y92lpf9xx5n8gw54iij7xxhnj01";
+    };
   };
 
   generic = ''
@@ -324,6 +331,15 @@ let
     let python_highlight_builtins = 1
     let python_highlight_exceptions = 1
     let g:flake8_cmd = '${pythonPackages.flake8}/bin/flake8'
+
+    " ledger
+    let g:ledger_bin = '${ledger}/bin/ledger'
+    let g:ledger_date_format = '%Y-%m-%d'
+    let g:ledger_maxwidth = 79
+    let g:ledger_align_at = 73
+    let g:ledger_default_commodity = 'EUR'
+    let g:ledger_commodity_before = 0
+    let g:ledger_commodity_sep = ' '
   '';
 
   autocmd = ''
@@ -339,6 +355,9 @@ let
     au FileType gitcommit setlocal textwidth=72
     au FileType docbk setlocal tabstop=2 shiftwidth=2 expandtab
 
+    " Autocomplete/align Ledger lines after leaving insert mode
+    au FileType ledger au InsertLeave * call ledger#autocomplete_and_align()
+
     " highlight unnecessary whitespace
     highlight ExtraWhitespace ctermbg=red guibg=red
     match ExtraWhitespace /\s\+$/