1414# flags — comma-separated modifiers (optional):
1515# "workspace" — pass .code-workspace file instead of directory
1616# "background" — launch with & (for terminal editors that fork)
17+ # "dot" — cd to directory and pass "." instead of full path
1718#
1819# Loading: file override (adapters/editor/<name>.sh) → registry → generic PATH fallback
1920_EDITOR_REGISTRY="
20- antigravity|agy|standard|Antigravity 'agy' command not found. Install from https://antigravity.google|workspace
21+ antigravity|agy|standard|Antigravity 'agy' command not found. Install from https://antigravity.google|workspace,dot
2122atom|atom|standard|Atom not found. Install from https://atom.io|
2223cursor|cursor|standard|Cursor not found. Install from https://cursor.com or enable the shell command.|workspace
2324emacs|emacs|terminal|Emacs not found. Install from https://www.gnu.org/software/emacs/|background
@@ -86,13 +87,17 @@ _load_from_editor_registry() {
8687 _EDITOR_ERR_MSG=" $err_msg "
8788 _EDITOR_WORKSPACE=0
8889 _EDITOR_BACKGROUND=0
90+ _EDITOR_DOT=0
8991
9092 case " ,$flags ," in
9193 * ,workspace,* ) _EDITOR_WORKSPACE=1 ;;
9294 esac
9395 case " ,$flags ," in
9496 * ,background,* ) _EDITOR_BACKGROUND=1 ;;
9597 esac
98+ case " ,$flags ," in
99+ * ,dot,* ) _EDITOR_DOT=1 ;;
100+ esac
96101
97102 case " $type " in
98103 terminal) _editor_define_terminal ;;
@@ -207,7 +212,7 @@ _ai_define_standard() {
207212}
208213
209214# Standard editor adapter builder — used by adapter files that follow the common pattern
210- # Sets globals then call this: _EDITOR_CMD, _EDITOR_ERR_MSG, _EDITOR_WORKSPACE (optional, 0 or 1)
215+ # Sets globals then call this: _EDITOR_CMD, _EDITOR_ERR_MSG, _EDITOR_WORKSPACE (optional, 0 or 1), _EDITOR_DOT (optional, 0 or 1)
211216_editor_define_standard () {
212217 # shellcheck disable=SC2317 # Functions are called indirectly via adapter dispatch
213218 editor_can_open () {
@@ -224,6 +229,8 @@ _editor_define_standard() {
224229 fi
225230 if [ " ${_EDITOR_WORKSPACE:- 0} " = " 1" ] && [ -n " $workspace " ] && [ -f " $workspace " ]; then
226231 " $_EDITOR_CMD " " $workspace "
232+ elif [ " ${_EDITOR_DOT:- 0} " = " 1" ]; then
233+ (cd " $path " && " $_EDITOR_CMD " .)
227234 else
228235 " $_EDITOR_CMD " " $path "
229236 fi
0 commit comments