Instead of requesting the full tree as a JSON and extracting the focused
window with `jq`, use `kitten-@-ls`'s `--match` flag. This further
improves the performance.
Also remove the commented code using recursive descent because it is not
up-to-date anymore.
kitten-@-ls(1) is unfortunately a bit slow (100ms) which is noticeable
when launching new windows using `get_cwd`. Make `get_cwd` faster (down
to 25ms) by communicating directly with the socket instead of using
`kitten`.
The check if the WinResized event is supported was broken from the
beginning on since I used `has()` instead of `exists()`.
Fixes: 558bb0582e (man.vim: Check if WinResized is supported,
2025-01-29)
Kitty's shell integration uses OSC sequences to mark the prompt and
output in the scrollback buffer. When opening that in vim through less I
want these to be gone as well.
I dislike having the raw escape byte in these scripts. Unfortunately
`sed` does not support interpreting it via an escape sequence, so use
printf for that. To remain POSIX compatible use `\033` and not `\e` or
`\x1b` since I couldn't find these in the printf(1p) manpage.
Unfortunately this brings a second layer of escaping.
I learned just now that neovim added mappings for these by default in
v0.8.0. But instead of checking for neovim, check for the existence of
mappings in case vim adds these in the future too.
I believe I had the problem in the past that the completion wouldn't
automatically select the first entry but simply display the menu. Thus
it would simply insert a new line when pressing return to accept it.
Unfortunately I didn't commit it back then and I can't reproduce it now.
But it doesn't not hurt so I commit it to be safe.
I removed these in 69d0290afd (i3: Remove bindings for stacked and
tabbed layout, 2023-04-20) since I never need them and I always forgot
how to switch back when I pressed these accidentally.
Bring these back as comments, since the comment above still mentions
these and since I can imagine a rare situation where I might want one
these and simply want to comment them in.
Until now the hook only checked newly added symlinks. This patch is a
first draft of also checking the worktree and index for any dangling
symlinks after staging a deletion.
The whole thing probably breaks when file-names contain newlines and
maybe also a mix of quotes. I plan on making this more robust in the
future but see no urgency for it since this repository has pretty simple
filenames.
The `die` in the pipe does not exit the whole script but only the pipe.
This currently works because the pipe is the last thing being executed.
If something would come after the pipe, the hook would happily continue
executing. Properly propagate the exit to prevent this in the future.
Git sets some environment variables when executing a shell command.
Specifically it sets GIT_DIR when called inside a submodule. This makes
git inside the subshell target the main worktree instead of the
temporary one.