Skip to content
This repository has been archived by the owner on Sep 21, 2019. It is now read-only.

Commit

Permalink
Allow ':Gita grep<CR>'
Browse files Browse the repository at this point in the history
If no pattern is specified, it ask users to fill.
  • Loading branch information
lambdalisue committed Mar 30, 2016
1 parent 0b9b486 commit 4125e3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion autoload/gita/command/grep.vim
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ function! s:get_parser() abort
\ 'patterns', [
\ 'match patterns',
\ ], {
\ 'required': 1,
\ 'type': s:ArgumentParser.types.multiple,
\})
call s:parser.add_argument(
Expand Down
9 changes: 9 additions & 0 deletions autoload/gita/content/grep.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
let s:V = gita#vital()
let s:String = s:V.import('Data.String')
let s:Prompt = s:V.import('Vim.Prompt')
let s:BufferAnchor = s:V.import('Vim.Buffer.Anchor')
let s:Git = s:V.import('Git')
let s:GitParser = s:V.import('Git.Parser')
Expand Down Expand Up @@ -145,7 +146,15 @@ function! gita#content#grep#open(options) abort
let options = extend({
\ 'opener': '',
\ 'window': 'manipulation_window',
\ 'patterns': [],
\}, a:options)
if empty(options.patterns)
let pattern = s:Prompt.ask('Please input a grep pattern: ')
if empty(pattern)
call gita#throw('Cancel')
endif
let options.patterns = [pattern]
endif
let bufname = s:build_bufname(options)
let opener = empty(options.opener)
\ ? g:gita#content#grep#default_opener
Expand Down

0 comments on commit 4125e3b

Please sign in to comment.