Skip to content

saifulapm/ast-grep.kak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

ast-grep.kak

Kakoune integration for ast-grep - search and rewrite code using AST patterns.

Installation

Add ast-grep.kak to your autoload dir: ~/.config/kak/autoload/

Or use your plugin manager.

Usage

Basic search:

sg 'console.log($A)'

Search and replace:

sg 'var $A' 'let $A'

Search in specific directory with filetype:

sg 'console.log($A)' '' ./src js

Remove pattern:

sg 'console.log($A)' ''

Commands

  • sg <pattern> [<rewrite>] [<path>] [<filetype>] - search/rewrite code
  • sg-write - apply rewrite changes to all files
  • sg-grep-next-match - jump to next match
  • sg-grep-previous-match - jump to previous match

Press <ret> on any match to jump to that location.

Requirements

  • ast-grep (sg command)
  • jq for JSON parsing

License

MIT

About

AST-based code search and refactoring for Kakoune

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published