feat(nvim): display active file in status bar and use url in editor

This commit is contained in:
Pihkaal
2024-06-01 00:26:23 +02:00
parent 96207863a9
commit 5651a42195
6 changed files with 72 additions and 62 deletions

View File

@@ -1,4 +1,23 @@
import { Icon } from "./types";
import { File, Icon } from "./types";
export const getIcon = (file: File | string | undefined): Icon => {
if (file === undefined) return ICONS["UNKNOWN"];
let iconName;
if (typeof file === "string") {
const parts = file.split(".");
iconName = parts[parts.length - 1];
} else {
iconName = file.icon;
if (!iconName) {
const parts = file.name.split(".");
iconName = parts[parts.length - 1];
}
}
if (!ICONS[iconName]) iconName = "UNKNOWN";
return ICONS[iconName];
};
export const ICONS: Record<string, Icon> = {
md: {