From 22af43acd72ef63d6226a70295850e807594d645 Mon Sep 17 00:00:00 2001 From: vrubelroman Date: Mon, 27 Apr 2026 14:23:29 +0300 Subject: [PATCH] fix: open more text file types in editor (nvim) Expand textExtensions with many missing common text file extensions (.lua, .rb, .vue, .svelte, .dart, .tex, .scala, .lisp, and many more). Add textFilenames list for well-known text files without a meaningful extension (Makefile, Dockerfile, README, LICENSE, .gitignore, etc.) so they open in the editor via handleEdit() instead of falling back to xdg-open via handleOpenExternal(). --- internal/fs/entry.go | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) 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" }