Skip to content

Commit bc1778b

Browse files
authored
chore: improve readme info (#13)
1 parent 756fb2f commit bc1778b

1 file changed

Lines changed: 128 additions & 56 deletions

File tree

README.md

Lines changed: 128 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,129 @@
3030

3131
## 🚀 Installation
3232

33-
### Homebrew (Recommended)
33+
### Homebrew
3434

3535
```bash
3636
brew tap y3owk1n/tap
3737
brew install y3owk1n/tap/govim
3838
```
3939

40+
### Nix Darwin
41+
42+
Add the following file to your overlay:
43+
44+
```nix
45+
{
46+
stdenv,
47+
buildGoModule,
48+
fetchFromGitHub,
49+
installShellFiles,
50+
writableTmpDirAsHomeHook,
51+
lib,
52+
nix-update-script,
53+
}:
54+
buildGoModule (finalAttrs: {
55+
pname = "govim";
56+
version = "1.0.2";
57+
58+
src = fetchFromGitHub {
59+
owner = "y3owk1n";
60+
repo = "govim";
61+
tag = "v${finalAttrs.version}";
62+
hash = "sha256-0iuZsYxND490TWueNxsGNE/0k7g3xVOUNOQD/xkIFs0=";
63+
};
64+
65+
vendorHash = "sha256-x5NB18fP8ERIB5qeMAMyMnSoDEF2+g+NoJKrC+kIj+k=";
66+
67+
ldflags = [
68+
"-s"
69+
"-w"
70+
"-X github.com/y3owk1n/govim/internal/cli.Version=${finalAttrs.version}"
71+
];
72+
73+
# Completions
74+
nativeBuildInputs = [
75+
installShellFiles
76+
writableTmpDirAsHomeHook
77+
];
78+
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
79+
installShellCompletion --cmd govim \
80+
--bash <($out/bin/govim completion bash) \
81+
--fish <($out/bin/govim completion fish) \
82+
--zsh <($out/bin/govim completion zsh)
83+
'';
84+
85+
passthru = {
86+
updateScript = nix-update-script { };
87+
};
88+
})
89+
```
90+
91+
Then, you can add the following to as a custom module package:
92+
93+
```nix
94+
{
95+
config,
96+
lib,
97+
pkgs,
98+
...
99+
}:
100+
101+
let
102+
cfg = config.govim;
103+
104+
configFile = pkgs.writeScript "govim.toml" cfg.config;
105+
in
106+
107+
{
108+
options = {
109+
govim = with lib.types; {
110+
enable = lib.mkEnableOption "Govim keyboard navigation";
111+
112+
package = lib.mkPackageOption pkgs "govim" { };
113+
114+
config = lib.mkOption {
115+
type = types.lines;
116+
default = ''
117+
# Your config here
118+
'';
119+
description = "Config to use for {file} `govim.toml`.";
120+
};
121+
};
122+
};
123+
124+
config = (
125+
lib.mkIf (cfg.enable) {
126+
environment.systemPackages = [ cfg.package ];
127+
128+
launchd.user.agents.govim = {
129+
command =
130+
"${cfg.package}/bin/govim launch"
131+
+ (lib.optionalString (cfg.config != "") " --config ${configFile}");
132+
serviceConfig = {
133+
KeepAlive = false;
134+
RunAtLoad = true;
135+
};
136+
};
137+
}
138+
);
139+
}
140+
```
141+
142+
Then somewhere in your nix config, you can add the following to enable the module:
143+
144+
```nix
145+
{
146+
imports = [
147+
./path-to-govim-module.nix
148+
];
149+
150+
govim = {
151+
enable = true;
152+
};
153+
}
154+
```
155+
40156
### Manual Build
41157

42158
```bash
@@ -47,38 +163,18 @@ cd govim
47163
# Build
48164
just build
49165

50-
# Run
51-
./bin/govim launch
52-
```
53-
54-
### CLI Commands
55-
56-
```bash
57-
# Launch the daemon
58-
govim launch
59-
60-
# Launch the daemon with custom config
61-
govim launch --config /path/to/config.toml
62-
63-
# Show help and available commands
64-
govim help
166+
# Move the binary to a location in your $PATH
167+
mv ./bin/govim /usr/local/bin/govim # Or anywhere else
65168

66-
# Generate shell completions (bash/zsh/fish/powershell)
67-
govim completion [bash|zsh|fish|powershell]
68-
69-
# Show version information
70-
govim version
169+
# Run
170+
govim launch # or without path `./bin/govim launch`
71171

72-
# Control the daemon
73-
govim start # Start navigation features
74-
govim stop # Stop navigation features
75-
govim status # Show current status
76172
```
77173

78174
### Required Permissions
79175

80176
⚠️ Grant Accessibility permissions in:
81-
System Settings → Privacy & Security → Accessibility
177+
`System Settings``Privacy & Security``Accessibility`
82178

83179
## 🎮 Usage
84180

@@ -156,19 +252,12 @@ scroll_speed = 50
156252

157253
See [`configs/default-config.toml`](configs/default-config.toml) for all available options.
158254

159-
### Application Support
160-
161-
GoVim works with:
162-
163-
- Native macOS applications
164-
- Electron-based apps (VS Code, Chrome, etc.)
165-
- Web browsers
166-
- System UI elements
255+
### Include hints on the macOS menu bar and Dock
167256

168-
For app-specific settings, find the bundle ID using:
169-
170-
```bash
171-
osascript -e 'id of app "App Name"'
257+
```toml
258+
[hints]
259+
menubar = true
260+
dock = true
172261
```
173262

174263
### Per-App Role Configuration
@@ -209,13 +298,6 @@ GoVim provides a comprehensive CLI with IPC (Inter-Process Communication) for co
209298
Start the GoVim daemon:
210299

211300
```bash
212-
# Launch daemon (default)
213-
govim
214-
215-
# Launch with custom config
216-
govim --config /path/to/config.toml
217-
218-
# Explicit launch command (same as above)
219301
govim launch
220302
govim launch --config /path/to/config.toml
221303
```
@@ -254,7 +336,7 @@ govim scroll
254336

255337
```bash
256338
# Start GoVim
257-
govim
339+
govim launch
258340

259341
# In another terminal, check status
260342
govim status
@@ -277,16 +359,6 @@ govim stop
277359
govim start
278360
```
279361

280-
### Error Handling
281-
282-
All control and mode commands will fail gracefully if GoVim is not running:
283-
284-
```bash
285-
$ govim status
286-
Error: govim is not running
287-
Start it first with: govim launch
288-
```
289-
290362
### IPC Architecture
291363

292364
The CLI uses Unix domain sockets (`/tmp/govim.sock`) for communication with the daemon. This allows:

0 commit comments

Comments
 (0)