Commit Graph

6 Commits

Author SHA1 Message Date
Johannes Altmanninger
21469c553d rc ledger: don't use region highlighter for simple keywords
As reported in
https://github.com/mawww/kakoune/issues/4685#issuecomment-1200530001
ledger.kak defines a region end that matches every character of
the buffer. This causes performance issues for large buffers.
Since the affected regions are only ever filled with a single color,
just use a regex highlighter instead of a region highlighter.
This improves performance when loading the file for the first time.

Speedup on [example.journal.txt](https://github.com/mawww/kakoune/issues/4685#issuecomment-1193243588)

	$ HOME=$PWD hyperfine -w 1 'git checkout HEAD'{~,}' -- :/rc/filetype/ledger.kak && ./kak.opt example.journal.txt -e "modeline-parse; hook global NormalIdle .* quit" -ui dummy'
	Benchmark 1: git checkout HEAD~ -- :/rc/filetype/ledger.kak && ./kak.opt example.journal.txt -e "modeline-parse; hook global NormalIdle .* quit" -ui dummy
	  Time (mean ± σ):     362.1 ms ±   5.1 ms    [User: 336.6 ms, System: 30.2 ms]
	  Range (min … max):   352.6 ms … 369.1 ms    10 runs
	 
	Benchmark 2: git checkout HEAD -- :/rc/filetype/ledger.kak && ./kak.opt example.journal.txt -e "modeline-parse; hook global NormalIdle .* quit" -ui dummy
	  Time (mean ± σ):     271.2 ms ±  16.7 ms    [User: 252.8 ms, System: 24.0 ms]
	  Range (min … max):   253.9 ms … 305.0 ms    10 runs
	 
	Summary
	  'git checkout HEAD -- :/rc/filetype/ledger.kak && ./kak.opt example.journal.txt -e "modeline-parse; hook global NormalIdle .* quit" -ui dummy' ran
	    1.33 ± 0.08 times faster than 'git checkout HEAD~ -- :/rc/filetype/ledger.kak && ./kak.opt example.journal.txt -e "modeline-parse; hook global NormalIdle .* quit" -ui dummy'
2022-08-28 08:21:57 +02:00
Maxime Coste
ef8a11b3db Make x just select the full lines
`x` is often criticized as hard to predict due to its slightly complex
behaviour of selecting next line if the current one is fully selected.

Change `x` to use the previous `<a-x>` behaviour, and change `<a-x>` to
trim to fully selected lines as `<a-X>` did.

Adapt existing indentation script to the new behaviour
2022-07-05 08:43:40 +10:00
Frank LENORMAND
21614cb06e src: Create a <semicolon> named key
This commit allows using the <semicolon> expansion in commands, instead
of `\;`.

It makes commands look more elegant, and prevents new-comers from
falling into the trap of using <a-;> without escaping the semicolon.
2019-10-22 11:02:06 +02:00
Maxime Coste
e4fb70ebec Replace ModeChange hooks by ModePush and ModePop
Remove deprecated InsertBegin, InsertEnd, NormalBegin, NormalEnd
hooks.

Closes #2545
2019-10-16 20:45:53 +11:00
codesoap
2d15c13c1e ledger.kak: Automatically indent postings in transactions 2019-07-02 09:49:52 +02:00
codesoap
710ebabcb8 Add ledger filetype 2019-07-01 20:49:55 +02:00