Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gitGrep command #1081

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions yi-core/src/Yi/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ grepFind (Doc filePattern) (Doc searchedRegex) = withOtherWindow $ do
withCurrentBuffer $ setMode Compilation.mode
return ()

-- | Perform a git+grep operation
gitGrep :: String ::: FilePatternTag -> String ::: RegexTag -> YiM ()
gitGrep (Doc filePattern) (Doc searchedRegex) = withOtherWindow $ do
void $ startSubprocess "git" ["grep","-Hnie",searchedRegex,filePattern] (const $ return ())
withCurrentBuffer $ setMode Compilation.mode
return ()

-----------------------
-- | stack-build

Expand Down
3 changes: 2 additions & 1 deletion yi-core/src/Yi/Config/Default.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Paths_yi_core
import System.FilePath

import Yi.Buffer
import Yi.Command (cabalBuildE, cabalConfigureE, grepFind,
import Yi.Command (cabalBuildE, cabalConfigureE, grepFind, gitGrep,
makeBuild, reloadProjectE, searchSources,
shell)
import Yi.Config
Expand Down Expand Up @@ -50,6 +50,7 @@ defaultPublishedActions = HM.fromList
, ("deleteBlankLinesB" , box deleteBlankLinesB)
, ("getSelectRegionB" , box getSelectRegionB)
, ("grepFind" , box grepFind)
, ("gitGrep" , box gitGrep)
, ("insertB" , box insertB)
, ("leftB" , box leftB)
, ("linePrefixSelectionB" , box linePrefixSelectionB)
Expand Down