Update on-load example in documentation (#2016)
This commit is contained in:
1 parent
44e716d2f1
commit
35b2764e27
3 files changed
+16
-4
No files matched your search
@@ -1729,11 +1729,15 @@ The following example can be used to display git indicators in the info column:
|
|||||||
|
|
||||||
cmd on-load &{{
|
cmd on-load &{{
|
||||||
cd "$(dirname "$1")" || exit 1
|
cd "$(dirname "$1")" || exit 1
|
||||||
git rev-parse >/dev/null 2>&1 || exit 0
|
[ "$(git rev-parse --is-inside-git-dir 2>/dev/null)" = false ] || exit 0
|
||||||
|
|
||||||
cmds=""
|
cmds=""
|
||||||
|
|
||||||
for file in "$@"; do
|
for file in "$@"; do
|
||||||
|
case "$file" in
|
||||||
|
*/.git|*/.git/*) continue;;
|
||||||
|
esac
|
||||||
|
|
||||||
status=$(git status --porcelain --ignored -- "$file" | cut -c1-2 | head -n1)
|
status=$(git status --porcelain --ignored -- "$file" | cut -c1-2 | head -n1)
|
||||||
|
|
||||||
if [ -n "$status" ]; then
|
if [ -n "$status" ]; then
|
||||||
|
|||||||
@@ -1949,11 +1949,15 @@ column:
|
|||||||
|
|
||||||
cmd on-load &{{
|
cmd on-load &{{
|
||||||
cd "$(dirname "$1")" || exit 1
|
cd "$(dirname "$1")" || exit 1
|
||||||
git rev-parse >/dev/null 2>&1 || exit 0
|
[ "$(git rev-parse --is-inside-git-dir 2>/dev/null)" = false ] || exit 0
|
||||||
|
|
||||||
cmds=""
|
cmds=""
|
||||||
|
|
||||||
for file in "$@"; do
|
for file in "$@"; do
|
||||||
|
case "$file" in
|
||||||
|
*/.git|*/.git/*) continue;;
|
||||||
|
esac
|
||||||
|
|
||||||
status=$(git status --porcelain --ignored -- "$file" | cut -c1-2 | head -n1)
|
status=$(git status --porcelain --ignored -- "$file" | cut -c1-2 | head -n1)
|
||||||
|
|
||||||
if [ -n "$status" ]; then
|
if [ -n "$status" ]; then
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.\" Automatically generated by Pandoc 2.11.4
|
.\" Automatically generated by Pandoc 2.11.4
|
||||||
.\"
|
.\"
|
||||||
.TH "LF" "1" "2025-06-20" "" "DOCUMENTATION"
|
.TH "LF" "1" "2025-06-21" "" "DOCUMENTATION"
|
||||||
.hy
|
.hy
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
@@ -2225,11 +2225,15 @@ column:
|
|||||||
\f[C]
|
\f[C]
|
||||||
cmd on-load &{{
|
cmd on-load &{{
|
||||||
cd \[dq]$(dirname \[dq]$1\[dq])\[dq] || exit 1
|
cd \[dq]$(dirname \[dq]$1\[dq])\[dq] || exit 1
|
||||||
git rev-parse >/dev/null 2>&1 || exit 0
|
[ \[dq]$(git rev-parse --is-inside-git-dir 2>/dev/null)\[dq] = false ] || exit 0
|
||||||
|
|
||||||
cmds=\[dq]\[dq]
|
cmds=\[dq]\[dq]
|
||||||
|
|
||||||
for file in \[dq]$\[at]\[dq]; do
|
for file in \[dq]$\[at]\[dq]; do
|
||||||
|
case \[dq]$file\[dq] in
|
||||||
|
*/.git|*/.git/*) continue;;
|
||||||
|
esac
|
||||||
|
|
||||||
status=$(git status --porcelain --ignored -- \[dq]$file\[dq] | cut -c1-2 | head -n1)
|
status=$(git status --porcelain --ignored -- \[dq]$file\[dq] | cut -c1-2 | head -n1)
|
||||||
|
|
||||||
if [ -n \[dq]$status\[dq] ]; then
|
if [ -n \[dq]$status\[dq] ]; then
|
||||||
|
|||||||
Reference in new issue
Block a user