Skip to main content
added 364 characters in body
Source Link
dalanicolai
  • 8.1k
  • 9
  • 25

SECOND EDIT (in response to you edit)

To format the expression differently, simply modify the string after the :argument keyword in your magit:--grep-expression argument definition (e.g. make it "Expression: ")

To add the prefix to the magit-dispatch popup, simply do it like I explained in the original answer (replace counsel-projectile-rg by magit-grep)

EDIT

To bind a command directly in the magit-status-mode-map, bind it as follows using define-key:

(define-key magit-status-mode-map "G" 'counsel-projectile-rg) 

I have bound it under G as g is already used as a prefix command in the magit-status buffer.

END EDIT

You can add a transient suffix with the following line of code:

(transient-insert-suffix 'magit-dispatch (kbd "h") '("G" "grep" counsel-projectile-rg)) 

read the docstring of transient-insert-suffix for an explanation. There is also the command transient-append-suffix which works similarly.

Here I am adding the command counsel-projectile-rg, which I use myself for this case (well actually I am just using the Spacemacs key-sequence SPC /), and which I can really recommend. There are equally good alternatives for helm, consult and probably more... also for other backends like grep, ag etc...

EDIT

To bind a command directly in the magit-status-mode-map, bind it as follows using define-key:

(define-key magit-status-mode-map "G" 'counsel-projectile-rg) 

I have bound it under G as g is already used as a prefix command in the magit-status buffer.

END EDIT

You can add a transient suffix with the following line of code:

(transient-insert-suffix 'magit-dispatch (kbd "h") '("G" "grep" counsel-projectile-rg)) 

read the docstring of transient-insert-suffix for an explanation. There is also the command transient-append-suffix which works similarly.

Here I am adding the command counsel-projectile-rg, which I use myself for this case (well actually I am just using the Spacemacs key-sequence SPC /), and which I can really recommend. There are equally good alternatives for helm, consult and probably more... also for other backends like grep, ag etc...

SECOND EDIT (in response to you edit)

To format the expression differently, simply modify the string after the :argument keyword in your magit:--grep-expression argument definition (e.g. make it "Expression: ")

To add the prefix to the magit-dispatch popup, simply do it like I explained in the original answer (replace counsel-projectile-rg by magit-grep)

EDIT

To bind a command directly in the magit-status-mode-map, bind it as follows using define-key:

(define-key magit-status-mode-map "G" 'counsel-projectile-rg) 

I have bound it under G as g is already used as a prefix command in the magit-status buffer.

END EDIT

You can add a transient suffix with the following line of code:

(transient-insert-suffix 'magit-dispatch (kbd "h") '("G" "grep" counsel-projectile-rg)) 

read the docstring of transient-insert-suffix for an explanation. There is also the command transient-append-suffix which works similarly.

Here I am adding the command counsel-projectile-rg, which I use myself for this case (well actually I am just using the Spacemacs key-sequence SPC /), and which I can really recommend. There are equally good alternatives for helm, consult and probably more... also for other backends like grep, ag etc...

added 8 characters in body
Source Link
dalanicolai
  • 8.1k
  • 9
  • 25

EDIT

To bind a command directly in the magit-status-mode-map, bind it as follows using define-key:

(define-key magit-status-mode-map "G" 'counsel-projectile-rg) 

I have bound it under G as g is already used as a prefix command in the magit-status buffer.

END EDIT

You can add a transient suffix with the following line of code:

(transient-insert-suffix 'magit-dispatch (kbd "h") '("G" "grep" counsel-projectile-rg)) 

read the docstring of transient-insert-suffix for an explanation. There is also the command transient-append-suffix which works similarly.

Here I am adding the command counsel-projectile-rg, which I use myself for this case (well actually I am just using the Spacemacs key-sequence SPC /), and which I can really recommend. There are equally good alternatives for helm, consult and probably more... also for other backends like grep, ag etc...

EDIT

To bind a command directly in the magit-status-mode-map, bind it as follows using define-key:

(define-key magit-status-mode-map "G" 'counsel-projectile-rg) 

I have bound it under G as g is used as a prefix command in the magit-status buffer.

END EDIT

You can add a transient suffix with the following line of code:

(transient-insert-suffix 'magit-dispatch (kbd "h") '("G" "grep" counsel-projectile-rg)) 

read the docstring of transient-insert-suffix for an explanation. There is also the command transient-append-suffix which works similarly.

Here I am adding the command counsel-projectile-rg, which I use myself for this case (well actually I am just using the Spacemacs key-sequence SPC /), and which I can really recommend. There are equally good alternatives for helm, consult and probably more... also for other backends like grep, ag etc...

EDIT

To bind a command directly in the magit-status-mode-map, bind it as follows using define-key:

(define-key magit-status-mode-map "G" 'counsel-projectile-rg) 

I have bound it under G as g is already used as a prefix command in the magit-status buffer.

END EDIT

You can add a transient suffix with the following line of code:

(transient-insert-suffix 'magit-dispatch (kbd "h") '("G" "grep" counsel-projectile-rg)) 

read the docstring of transient-insert-suffix for an explanation. There is also the command transient-append-suffix which works similarly.

Here I am adding the command counsel-projectile-rg, which I use myself for this case (well actually I am just using the Spacemacs key-sequence SPC /), and which I can really recommend. There are equally good alternatives for helm, consult and probably more... also for other backends like grep, ag etc...

Edit answer in response to the comments
Source Link
dalanicolai
  • 8.1k
  • 9
  • 25

EDIT

To bind a command directly in the magit-status-mode-map, bind it as follows using define-key:

(define-key magit-status-mode-map "G" 'counsel-projectile-rg) 

I have bound it under G as g is used as a prefix command in the magit-status buffer.

END EDIT

You can add a transient suffix with the following line of code:

(transient-insert-suffix 'magit-dispatch (kbd "h") '("G" "grep" counsel-projectile-rg)) 

read the docstring of transient-insert-suffix for an explanation. There is also the command transient-append-suffix which works similarly.

Here I am adding the command counsel-projectile-rg, which I use myself for this case (well actually I am just using the Spacemacs key-sequence SPC /), and which I can really recommend. There are equally good alternatives for helm, consult and probably more... also for other backends like grep, ag etc...

You can add a transient suffix with the following line of code:

(transient-insert-suffix 'magit-dispatch (kbd "h") '("G" "grep" counsel-projectile-rg)) 

read the docstring of transient-insert-suffix for an explanation. There is also the command transient-append-suffix which works similarly.

Here I am adding the command counsel-projectile-rg, which I use myself for this case (well actually I am just using the Spacemacs key-sequence SPC /), and which I can really recommend. There are equally good alternatives for helm, consult and probably more... also for other backends like grep, ag etc...

EDIT

To bind a command directly in the magit-status-mode-map, bind it as follows using define-key:

(define-key magit-status-mode-map "G" 'counsel-projectile-rg) 

I have bound it under G as g is used as a prefix command in the magit-status buffer.

END EDIT

You can add a transient suffix with the following line of code:

(transient-insert-suffix 'magit-dispatch (kbd "h") '("G" "grep" counsel-projectile-rg)) 

read the docstring of transient-insert-suffix for an explanation. There is also the command transient-append-suffix which works similarly.

Here I am adding the command counsel-projectile-rg, which I use myself for this case (well actually I am just using the Spacemacs key-sequence SPC /), and which I can really recommend. There are equally good alternatives for helm, consult and probably more... also for other backends like grep, ag etc...

added 76 characters in body
Source Link
dalanicolai
  • 8.1k
  • 9
  • 25
Loading
Source Link
dalanicolai
  • 8.1k
  • 9
  • 25
Loading