#26
in
Command line interface
#17
in
Command line interface
#70
in
Hacktoberfest
#55
in
Rust
#19
in
Terminal
I've been using bat as a cat replacement for a while now. It includes paging, syntax highlighting, line numbers, and is generally very performant.
Since we're talking alternatives:
Similar to https://github.com/sharkdp/bat but Go instead of Rust
Does not support markdown. ov is a pager, so there is no rendering of specific files.
But it can be used as a bat(https://github.com/sharkdp/bat) pager.
It can also be created using the ov(oviewer) package. Here's a sample: https://github.com/noborus/mdviewer
I have my notes in Dendron which is basically a directory of yaml files. I often need to search through the notes so I made the below
search_notes() { input=$(rg -v '(\-\-)|(^\s*$)' --line-number /home/user/some-dir | fzf --ansi --delimiter : --preview 'batcat --color=always {1} --highlight-line {2}' --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' | choose -f : 0) if [[$input = ""]]; then else less $input fi }
It uses various linux utilities including fzf and batcat(https://github.com/sharkdp/bat) to open a terminal with all the places where my query comes up (supporting fuzzy search). Since the workhorses are fzf and ripgrep its is quite fast even for very large directories.
So i will do `search_notes postgres authentication`. I can select a line and it will open the file in less. Works like a charm!
It looks like bat https://github.com/sharkdp/bat