diff --git a/internal/fs/entry.go b/internal/fs/entry.go index 6e1d0eb..ce03e53 100644 --- a/internal/fs/entry.go +++ b/internal/fs/entry.go @@ -14,15 +14,51 @@ var ( } textExtensions = map[string]struct{}{ "txt": {}, "md": {}, "rst": {}, "go": {}, "rs": {}, "c": {}, "h": {}, "cpp": {}, "hpp": {}, - "py": {}, "js": {}, "ts": {}, "tsx": {}, "jsx": {}, "java": {}, "kt": {}, "swift": {}, - "html": {}, "css": {}, "scss": {}, "sh": {}, "bash": {}, "zsh": {}, "fish": {}, "sql": {}, - "log": {}, "csv": {}, + "py": {}, "js": {}, "ts": {}, "tsx": {}, "jsx": {}, "java": {}, "kt": {}, "kts": {}, "swift": {}, + "html": {}, "css": {}, "scss": {}, "sass": {}, "less": {}, "styl": {}, + "sh": {}, "bash": {}, "zsh": {}, "fish": {}, "sql": {}, + "log": {}, "csv": {}, "tsv": {}, + "lua": {}, "rb": {}, "pl": {}, "pm": {}, "t": {}, "ps1": {}, "bat": {}, "cmd": {}, + "vue": {}, "svelte": {}, "astro": {}, "ejs": {}, "hbs": {}, "pug": {}, "haml": {}, "php": {}, "twig": {}, + "scala": {}, "groovy": {}, "clj": {}, "ex": {}, "exs": {}, "elm": {}, "hs": {}, "lisp": {}, "cl": {}, "rkt": {}, "scm": {}, "dart": {}, + "tex": {}, "bib": {}, "sty": {}, "cls": {}, + "gradle": {}, "cmake": {}, "mk": {}, "mak": {}, + "asm": {}, "s": {}, "inc": {}, + "patch": {}, "diff": {}, + "proto": {}, "graphql": {}, "gql": {}, + "tf": {}, "hcl": {}, + "r": {}, "m": {}, "mm": {}, + "nim": {}, "zig": {}, "odin": {}, "v": {}, + "cr": {}, "jl": {}, + "erl": {}, "hrl": {}, + } + // textFilenames lists common text files without a meaningful extension + // (like Makefile, Dockerfile, etc.) so they open in the editor. + textFilenames = map[string]struct{}{ + "makefile": {}, "dockerfile": {}, "containerfile": {}, + "readme": {}, "license": {}, "licence": {}, "copying": {}, "changelog": {}, "changes": {}, + "todo": {}, "notes": {}, "authors": {}, "contributors": {}, "maintainers": {}, + "procfile": {}, "gemfile": {}, "rakefile": {}, "snapfile": {}, "fastfile": {}, + "cmakelists": {}, "justfile": {}, "taskfile": {}, + "gitignore": {}, "gitattributes": {}, "gitmodules": {}, "gitkeep": {}, + "gitconfig": {}, "git-blame-ignore-revs": {}, + "editorconfig": {}, "envrc": {}, "hushlogin": {}, + "xsession": {}, "xresources": {}, "xinitrc": {}, + "bashrc": {}, "bash_profile": {}, "bash_logout": {}, + "zshrc": {}, "zprofile": {}, "zlogin": {}, "zlogout": {}, + "profile": {}, "inputrc": {}, "tmux.conf": {}, + "npmrc": {}, "yarnrc": {}, "pnpmrc": {}, + "eslintrc": {}, "prettierrc": {}, "babelrc": {}, + "stylelintrc": {}, "commitlintrc": {}, + "htaccess": {}, "htpasswd": {}, } imageExtensions = map[string]struct{}{ "png": {}, "jpg": {}, "jpeg": {}, "gif": {}, "webp": {}, "bmp": {}, "svg": {}, "ico": {}, + "avif": {}, "heic": {}, "heif": {}, "tiff": {}, "tif": {}, } archiveExtensions = map[string]struct{}{ "zip": {}, "tar": {}, "gz": {}, "tgz": {}, "xz": {}, "bz2": {}, "7z": {}, "rar": {}, + "zst": {}, "lz": {}, "lz4": {}, "lzma": {}, } ) @@ -79,6 +115,8 @@ func (e Entry) Category() string { return "text" case hasExt(archiveExtensions, e.Extension): return "archive" + case hasExt(textFilenames, strings.ToLower(e.Name)): + return "text" default: return "binary" }