Skip to content

Commit 457a251

Browse files
committed
initial experimentation, adding info to docs, playing w/ nvim's api
Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
1 parent 6733204 commit 457a251

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
dist
33

44
*.off
5+
*.log

nvim-git-rebase-todo/README

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,55 @@ could potentially add extra stuff like grouping files by which commits modified
55
need a monorepo setup for this, if nvim's node-client [1] works well
66

77
[1] https://github.com/neovim/node-client
8+
9+
10+
setup
11+
==========
12+
13+
yarn
14+
15+
16+
development
17+
===========
18+
19+
# terminal 1
20+
yarn dev
21+
22+
# terminal 2
23+
NVIM_LISTEN_ADDRESS=/tmp/nvim NVIM_NODE_LOG_FILE=nvim.log nvim ../.git/stacked-rebase/git-rebase-todo
24+
25+
# terminal 3 (potentially vsplit w/ terminal 2)
26+
NVIM_LISTEN_ADDRESS=/tmp/nvim node
27+
28+
let v, w, c
29+
nvim = await require('neovim/scripts/nvim') // comes from https://github.com/neovim/node-client/blob/e01ecaa6ba616738e6fc2b9d1b283f095a84899b/packages/neovim/scripts/nvim.js
30+
v = nvim
31+
w = await v.getWindow()
32+
c = await w.client
33+
// v.command("vsp")
34+
// v.command("q")
35+
await c.line
36+
37+
line = await c.line
38+
commit = line.split(" ")[1]
39+
const cp = require("child_process")
40+
stat = cp.execSync(`git show --stat ${commit}`, { encoding: "utf8" }).split("\n")
41+
42+
# potentially terminal 4
43+
watch cat nvim.log
44+
45+
# upon changes in source code, re-run in nvim
46+
# to update the generated rplugin.vim manifest
47+
:UpdateRemotePlugins
48+
49+
---
50+
51+
see also:
52+
- https://github.com/neovim/node-client
53+
- https://neovim.io/node-client/
54+
- https://neovim.io/node-client/modules.html
55+
- https://neovim.io/node-client/classes/Neovim.html
56+
- https://neovim.io/node-client/classes/NeovimClient.html
57+
- https://neovim.io/node-client/classes/Window.html
58+
- https://neovim.io/doc/user/api.html
59+
- https://neovim.io/doc/user/windows.html#window

nvim-git-rebase-todo/nvim-git-rebase-todo.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,19 @@ export default function nvimGitRebaseTodo(plugin: NvimPlugin): void {
2727
);
2828

2929
plugin.registerAutocmd(
30+
/**
31+
* :help events
32+
*
33+
* CursorMoved?
34+
*/
3035
"BufEnter",
3136
async (_fileName: string) => {
3237
await vim.buffer.append("BufEnter for git-rebase-todo File?");
33-
// await vim.window.
38+
// const w = new vim.Window({});
39+
// w.setOption("width", 10);
40+
const w = await vim.window;
41+
42+
console.log(w);
3443
},
3544
{ sync: false, pattern: "git-rebase-todo", eval: 'expand("<afile>")' }
3645
);

0 commit comments

Comments
 (0)