File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,14 @@ git jump grep -i foo_bar
79
79
git config jump.grepCmd "ag --column"
80
80
--------------------------------------------------
81
81
82
+ You can use the optional argument '--stdout' to print the listing to
83
+ standard output instead of feeding it to the editor. You can use the
84
+ argument with M-x grep on Emacs:
85
+
86
+ --------------------------------------------------
87
+ # In Emacs, M-x grep and invoke "git jump --stdout <mode>"
88
+ M-x grep<RET>git jump --stdout diff<RET>
89
+ --------------------------------------------------
82
90
83
91
Related Programs
84
92
----------------
@@ -100,7 +108,7 @@ Limitations
100
108
-----------
101
109
102
110
This script was written and tested with vim. Given that the quickfix
103
- format is the same as what gcc produces, I expect emacs users have a
111
+ format is the same as what gcc produces, I expect other tools have a
104
112
similar feature for iterating through the list, but I know nothing about
105
113
how to activate it.
106
114
Original file line number Diff line number Diff line change 2
2
3
3
usage () {
4
4
cat << \EOF
5
- usage: git jump <mode> [<args>]
5
+ usage: git jump [--stdout] <mode> [<args>]
6
6
7
7
Jump to interesting elements in an editor.
8
8
The <mode> parameter is one of:
@@ -15,6 +15,9 @@ grep: elements are grep hits. Arguments are given to git grep or, if
15
15
configured, to the command in ` jump.grepCmd` .
16
16
17
17
ws: elements are whitespace errors. Arguments are given to diff --check.
18
+
19
+ If the optional argument ` --stdout` is given, print the quickfix
20
+ lines to standard output instead of feeding it to the editor.
18
21
EOF
19
22
}
20
23
@@ -64,11 +67,31 @@ mode_ws() {
64
67
git diff --check " $@ "
65
68
}
66
69
70
+ use_stdout=
71
+ while test $# -gt 0; do
72
+ case " $1 " in
73
+ --stdout)
74
+ use_stdout=t
75
+ ;;
76
+ --* )
77
+ usage >&2
78
+ exit 1
79
+ ;;
80
+ * )
81
+ break
82
+ ;;
83
+ esac
84
+ shift
85
+ done
67
86
if test $# -lt 1; then
68
87
usage >&2
69
88
exit 1
70
89
fi
71
90
mode=$1 ; shift
91
+ if test " $use_stdout " = " t" ; then
92
+ " mode_$mode " " $@ "
93
+ exit 0
94
+ fi
72
95
73
96
trap ' rm -f "$tmp"' 0 1 2 3 15
74
97
tmp=` mktemp -t git-jump.XXXXXX` || exit 1
You can’t perform that action at this time.
0 commit comments