summaryrefslogtreecommitdiff
path: root/ar/.config/television/cable/man-pages.toml
diff options
context:
space:
mode:
Diffstat (limited to 'ar/.config/television/cable/man-pages.toml')
-rw-r--r--ar/.config/television/cable/man-pages.toml35
1 files changed, 35 insertions, 0 deletions
diff --git a/ar/.config/television/cable/man-pages.toml b/ar/.config/television/cable/man-pages.toml
new file mode 100644
index 0000000..38c3e67
--- /dev/null
+++ b/ar/.config/television/cable/man-pages.toml
@@ -0,0 +1,35 @@
+[metadata]
+name = "man-pages"
+description = "Browse and preview system manual pages"
+requirements = ["man", "apropos", "col", "bat"]
+
+[source]
+command = "man -k ."
+
+[ui]
+layout = "landscape"
+
+[ui.preview_panel]
+header = "{0}"
+
+[keybindings]
+ctrl-b = "actions:bat"
+ctrl-v = "actions:nvim"
+
+[preview]
+command = "sh -c \"man $(echo {0} | sed -E 's/^([^ ]+) \\(([^)]+)\\).*/\\2 \\1/') | col -bx | bat -l man -p --color=always\""
+
+[preview.env]
+MANWIDTH = "80"
+MANPAGER = "cat"
+PAGER = "cat"
+
+[actions.bat]
+description = "View with bat"
+command = "echo '{0}' | sed -E 's/^([^ ]+) \\(([^)]+)\\).*/\\2 \\1/' | xargs -r man | col -bx | bat -l man -p"
+mode = "fork"
+
+[actions.nvim]
+description = "Open in Neovim"
+command = "echo '{0}' | sed -E 's/^([^ ]+) \\(([^)]+)\\).*/\\2 \\1/' | xargs -r man | nvim -"
+mode = "fork"