Skip to content

Commit

Permalink
feat: adding indent/unindent scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sminez committed Oct 14, 2024
1 parent 864c5f0 commit d120ad6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions data/bin/indent
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
source "$HOME/.ad/lib/ad.sh"

requireAd
id="$(currentBufferId)"
addr="$(bufRead "$id" addr | sed -E 's/(.+):.+,(.+):.+/\1,\2/')"
adEdit '. x/.+/ s/^/ /'
echo "$addr" | bufWrite "$id" addr
8 changes: 8 additions & 0 deletions data/bin/unindent
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
source "$HOME/.ad/lib/ad.sh"

requireAd
id="$(currentBufferId)"
addr="$(bufRead "$id" addr | sed -E 's/(.+):.+,(.+):.+/\1,\2/')"
adEdit '. x/.+/ s/^ //'
echo "$addr" | bufWrite "$id" addr
2 changes: 2 additions & 0 deletions data/init.conf
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ set string-color=#61DCA5
# Key mappings to programs that must be available on $PATH.
# ~/.ad/bin is auto-added to the path
map <space> F => fmt
map > => indent
map < => unindent

0 comments on commit d120ad6

Please sign in to comment.