@aymanbagabas/drift 0.0.0 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +259 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,259 @@
1
+ <p align="center">
2
+ <img src="demo/mascot.svg" alt="drift" width="180">
3
+ </p>
4
+
5
+ <h1 align="center">drift</h1>
6
+
7
+ <p align="center">
8
+ <a href="https://crates.io/crates/drift-diff"><img src="https://img.shields.io/crates/v/drift-diff.svg" alt="Crates.io"></a>
9
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT"></a>
10
+ </p>
11
+
12
+ <p align="center">
13
+ A git diff pager that actually wants to be looked at.
14
+ </p>
15
+
16
+ <p align="center">
17
+ <picture>
18
+ <source srcset="https://github.com/aymanbagabas/drift/blob/main/demo/drift.gif?raw=true" type="image/gif">
19
+ <source srcset="https://raw.githubusercontent.com/aymanbagabas/drift/main/demo/drift.gif" type="image/gif">
20
+ <img width="900" alt="drift in action" src="demo/drift.gif">
21
+ </picture>
22
+ </p>
23
+
24
+ `drift` takes the diff you already know and drops it into a real terminal UI:
25
+ syntax highlighting, word-level change emphasis, split or unified views, a
26
+ file-list modal and a live sidebar you can click and drag to resize,
27
+ jump-to-hunk, in-file search, open-in-`$EDITOR`, and a live mode that repaints
28
+ the moment your index or branch moves. Point it at a commit, your staging area,
29
+ or your working tree, or just pipe a diff into it like any other pager.
30
+
31
+ No config needed to start. Themes, colors, and keys are all yours to bend later.
32
+
33
+ ## Install
34
+
35
+ ### Homebrew (macOS, Linux)
36
+
37
+ ```sh
38
+ brew install aymanbagabas/tap/drift
39
+ ```
40
+
41
+ ### Scoop (Windows)
42
+
43
+ ```sh
44
+ scoop bucket add aymanbagabas https://github.com/aymanbagabas/scoop-bucket
45
+ scoop install drift
46
+ ```
47
+
48
+ ### Cargo
49
+
50
+ ```sh
51
+ cargo install drift-diff
52
+ ```
53
+
54
+ ### npm
55
+
56
+ ```sh
57
+ npm install -g @aymanbagabas/drift
58
+ ```
59
+
60
+ ### Debian / Ubuntu
61
+
62
+ ```sh
63
+ echo 'deb [trusted=yes] https://repo.aymanbagabas.com/apt/ /' | sudo tee /etc/apt/sources.list.d/aymanbagabas.list
64
+ sudo apt update && sudo apt install drift
65
+ ```
66
+
67
+ ### Fedora / RHEL
68
+
69
+ ```sh
70
+ echo '[aymanbagabas]
71
+ name=Ayman Bagabas
72
+ baseurl=https://repo.aymanbagabas.com/yum/
73
+ enabled=1
74
+ gpgcheck=0' | sudo tee /etc/yum.repos.d/aymanbagabas.repo
75
+ sudo yum install drift
76
+ ```
77
+
78
+ ### Arch Linux (AUR)
79
+
80
+ ```sh
81
+ yay -S drift-bin
82
+ ```
83
+
84
+ ### Prebuilt binaries
85
+
86
+ Grab an archive for your platform from the
87
+ [latest release](https://github.com/aymanbagabas/drift/releases/latest) and put
88
+ the `drift` binary on your `PATH`.
89
+
90
+ Every method installs a `drift` binary.
91
+
92
+ ## Use it
93
+
94
+ ```sh
95
+ drift # working tree vs HEAD
96
+ drift -A # ...and untracked files too
97
+ drift --staged # what's staged (alias: --cached)
98
+ drift HEAD~3 # a single commit
99
+ drift main..feature # a range
100
+ drift -w # watch the repo and refresh on every change
101
+ git diff | drift # pager mode: read a diff from stdin
102
+ ```
103
+
104
+ Make it your default git pager for diffs:
105
+
106
+ ```sh
107
+ git config --global pager.diff drift
108
+ git config --global pager.show drift
109
+ ```
110
+
111
+ Some flags worth knowing:
112
+
113
+ | Flag | What it does |
114
+ |------|--------------|
115
+ | `-w`, `--watch` | Refresh when the git index or refs change |
116
+ | `-A`, `--all` | Also show untracked files (working-tree view only) |
117
+ | `-C`, `--directory DIR` | Run as if started in `DIR` (worktrees, bare repos) |
118
+ | `-c`, `--config FILE` | Use a specific config file |
119
+ | `--no-syntax` | Turn off syntax highlighting for this run |
120
+ | `-U`, `--context N` | Lines of context around each change |
121
+ | `--ignore-whitespace` | Ignore whitespace-only changes |
122
+ | `--diff-algorithm ALGO` | `myers`, `minimal`, `patience`, or `histogram` |
123
+ | `-- PATHSPEC...` | Limit to paths, e.g. `drift -- src/ docs/` |
124
+
125
+ ## Keys
126
+
127
+ | Key | Action |
128
+ |-----|--------|
129
+ | `j` `k` / `↑` `↓` | Move the cursor |
130
+ | `h` `l` / `←` `→` | Scroll horizontally (for lines wider than the view) |
131
+ | `0` `$` | Scroll to line start / end |
132
+ | `d` `u` / `^d` `^u` | Half page down / up |
133
+ | `space` `f` `^f` / `b` `^b` | Full page down / up |
134
+ | `^e` `^y` | Scroll one line down / up |
135
+ | `g` `G` | Top / bottom |
136
+ | `H` `M` `L` | Cursor to screen top / middle / bottom |
137
+ | `{` `}` | Previous / next hunk |
138
+ | `[` `]` / `tab` `⇧tab` | Previous / next file |
139
+ | `/` | Search the current file (regex, smart-case) |
140
+ | `n` `N` | Next / previous match |
141
+ | `s` | Toggle split view |
142
+ | `F` | File list modal |
143
+ | `B` | Toggle the file sidebar |
144
+ | `w` | Toggle watch mode |
145
+ | `V` | Start / cancel a line selection; any motion key extends it |
146
+ | `y` | Copy the selection, or the cursor line when nothing is selected |
147
+ | `Y` | Copy the whole current file |
148
+ | `enter` | Expand folded context, or open the file at the cursor |
149
+ | `v` | Open the current file in `$EDITOR` |
150
+ | `r` | Refresh |
151
+ | `?` | Toggle the help footer |
152
+ | `q` | Quit |
153
+
154
+ ## Mouse
155
+
156
+ drift is fully mouse-driven too:
157
+
158
+ - Click a file in the sidebar to jump straight to it in the diff.
159
+ - Click a file in the file modal to select it; the modal stays open until you
160
+ click outside it (or press `enter`).
161
+ - Drag the sidebar's divider to resize it, live.
162
+ - In split view, drag the divider between the two panes to rebalance them.
163
+ - Click the `? help` badge in the status bar to toggle the help footer.
164
+ - Drag across the diff to select text; it lands on your system clipboard (over
165
+ SSH too, via OSC 52). In split view the selection stays within one pane, so
166
+ you copy just the old or just the new side.
167
+ - Scroll wheel moves the page through the diff (the cursor stays put until it
168
+ reaches an edge). Scroll the wheel left/right to pan wide lines horizontally.
169
+
170
+ ## Themes
171
+
172
+ Set `theme = "..."` in your config. Built in and ready:
173
+
174
+ - `onedark`, `onelight` (the defaults, picked by your terminal background)
175
+ - `dracula`
176
+ - `gruvbox-dark`, `gruvbox-light`
177
+ - `nord`
178
+ - `solarized-dark`, `solarized-light`
179
+ - `catppuccin-mocha`, `catppuccin-latte`
180
+ - `tokyonight`
181
+ - `monokai`
182
+ - `ansi`, which borrows your terminal's own 16 colors so drift matches
183
+ whatever palette you already run. It leaves code text and word-diff
184
+ emphasis alone, since 16 colors are too few to layer cleanly over diff
185
+ colors.
186
+
187
+ Any [syntect](https://github.com/trishume/syntect) theme name works too (for
188
+ example `base16-ocean.dark`), it just won't repaint the UI chrome to match.
189
+
190
+ The `themes/` directory has a full, commented config for every built-in theme.
191
+ Copy one and go:
192
+
193
+ ```sh
194
+ mkdir -p ~/.config/drift
195
+ cp themes/dracula.toml ~/.config/drift/config.toml
196
+ ```
197
+
198
+ ## Config
199
+
200
+ drift looks for a config file, in order, at:
201
+
202
+ - `$XDG_CONFIG_HOME/drift/config.{toml,yaml,yml,json}`
203
+ - `~/.config/drift/config.{toml,yaml,yml,json}`
204
+ - `~/.drift.toml`
205
+
206
+ TOML, YAML, and JSON all work. The top-level knobs:
207
+
208
+ ```toml
209
+ theme = "onedark" # any built-in or syntect theme name
210
+ syntax = true # highlight diff content
211
+ intraline = true # word-level change emphasis
212
+ line-numbers = true # old/new line-number gutter
213
+ tab-width = 4
214
+ editor = "" # falls back to $VISUAL, then $EDITOR, then vi
215
+ sidebar = "auto" # "auto" (opens at width >= 150), "always", or "never"
216
+ sidebar-width = 30 # sidebar columns; drag its divider to resize live
217
+ sidebar-side = "left" # "left" or "right"
218
+ ```
219
+
220
+ Colors come in two layers. `[colors]` is a named palette; `[styles]` maps UI
221
+ components to a `fg bg attrs...` spec resolved against that palette. Every color
222
+ token accepts a palette name, a literal `#rrggbb`, a 0-255 index, an ANSI color
223
+ name, or `default`/`none`/`-` for the terminal's own color. See any file in
224
+ `themes/` for the full set with comments.
225
+
226
+ ### From git config
227
+
228
+ Anything you can set in a config file, you can set in git config under the
229
+ `drift` section, which is handy for per-repo overrides. Colors and styles go in
230
+ `colors` and `styles` subsections. Git forbids `_` in a key, so a field like
231
+ `add_emph` becomes `add-emph`:
232
+
233
+ ```sh
234
+ git config drift.theme nord
235
+ git config drift.line-numbers false
236
+ git config drift.colors.add '#00ff00'
237
+ git config drift.colors.add-emph '#003300'
238
+ git config drift.styles.statusbar 'foreground surface bold'
239
+ ```
240
+
241
+ Or in `~/.gitconfig` directly:
242
+
243
+ ```ini
244
+ [drift]
245
+ theme = nord
246
+ line-numbers = false
247
+ [drift "colors"]
248
+ add = "#00ff00"
249
+ add-emph = "#003300"
250
+ [drift "styles"]
251
+ statusbar = "foreground surface bold"
252
+ ```
253
+
254
+ For the full list of every setting, color, component style, and flag, see
255
+ [CONFIG.md](CONFIG.md).
256
+
257
+ ## License
258
+
259
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aymanbagabas/drift",
3
- "version": "0.0.0",
3
+ "version": "0.0.3",
4
4
  "description": "A standalone git diff pager for the terminal.",
5
5
  "bin": {
6
6
  "drift": "bin/drift.js"