Skip to content

Commit

Permalink
🐛 Fix #6, use ~/.lessfilter
Browse files Browse the repository at this point in the history
Fix missing $@ of functions
Add nmcli
  • Loading branch information
Freed-Wu committed May 24, 2023
1 parent 2937334 commit 1354cd7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
9 changes: 4 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
- id: check-toml
- id: check-json
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.4.2
rev: v1.5.1
hooks:
- id: remove-crlf
- repo: https://github.com/codespell-project/codespell
Expand All @@ -45,16 +45,15 @@ repos:
hooks:
- id: check-mailmap
- repo: https://github.com/adrienverge/yamllint
rev: v1.30.0
rev: v1.32.0
hooks:
- id: yamllint
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
args:
- --number
additional_dependencies:
- mdformat-pyproject
- mdformat-gfm
- mdformat-myst
- mdformat-toc
Expand All @@ -63,7 +62,7 @@ repos:
- mdformat-black
- mdformat-config
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.6.0
rev: v0.7.1
hooks:
- id: markdownlint-cli2
additional_dependencies:
Expand Down
16 changes: 10 additions & 6 deletions functions/main.zsh
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# define some functions to avoid any error that these programs don't exist
(($+commands[bat])) || bat() {cat}
(($+commands[mdcat])) || mdcat() {bat}
(($+commands[pygmentize])) || pygmentize() {cat}
(($+commands[delta])) || delta() {cat}
(($+commands[less])) || less() {ls -l}
(($+commands[finger])) || finger() {(($+commands[pinky])) && pinky $@ || whoami}
(($+commands[bat])) || bat() {cat $@}
(($+commands[mdcat])) || mdcat() {bat $@}
(($+commands[pygmentize])) || pygmentize() {cat $@}
(($+commands[delta])) || delta() {cat $@}
# https://github.com/Freed-Wu/fzf-tab-source/issues/6
(($+commands[less])) && [ -x ~/.lessfilter ] &&
less() {~/.lessfilter $@ || less $@} || (($+commands[less])) ||
less() {ls -l $@}
(($+commands[finger])) || (($+commands[pinky])) &&
finger() {pinky $@} || finger() {whoami}
(($+commands[pandoc])) || pandoc() {cat ${@[-1]}}
(($+commands[grc])) || grc() {eval ${@[2,-1]}}
(($+commands[jq])) || jq() {echo ';'}
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tool.mdformat]
number = true
6 changes: 6 additions & 0 deletions sources/nmcli.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# :fzf-tab:complete:(\\|*/|)nmcli:argument-1
case $group in
command)
nmcli $word help
;;
esac

0 comments on commit 1354cd7

Please sign in to comment.