feat(nvim-tree): open README.md on startup

This commit is contained in:
Pihkaal
2024-09-18 10:05:55 +02:00
parent 276b490e37
commit 31ffd809b4

View File

@@ -95,6 +95,10 @@ export const NvimTree = (
} }
useEffect(() => { useEffect(() => {
const readme = files.find((file) => file.name === "README.md") as Child;
props.onOpen(readme);
setSelectedY(files.indexOf(readme));
const onScroll = (event: KeyboardEvent) => { const onScroll = (event: KeyboardEvent) => {
if (activeKitty !== props.id) return; if (activeKitty !== props.id) return;
switch (event.key) { switch (event.key) {
@@ -122,7 +126,7 @@ export const NvimTree = (
return () => { return () => {
window.removeEventListener("keydown", onScroll); window.removeEventListener("keydown", onScroll);
}; };
}); }, []);
return ( return (
<div className="h-full select-none bg-[#0000001a]"> <div className="h-full select-none bg-[#0000001a]">