linux - 如何在最近事件的 Atom 编辑器窗口而不是我第一次打开的 Atom 窗口中打开文件?

标签 linux atom-editor archlinux

在 Linux 上使用 Atom 编辑器时,我似乎无法在最近激活的 Atom 窗口中找到任何用于打开文件的选项(使用我的文件管理器)。相反,它总是在创建的第一个 Atom 窗口中打开。

我该如何解决这个问题?

最佳答案

有一个选项:

-a, --add 在上次使用的窗口中作为新项目打开路径。 [ bool 值]

……但无论如何,它并没有像预期的那样工作。不过,我找到了解决方法。

此代码位于 src/main-process/atom-application.js 的第 862 行附近:

    if (existingWindow == null) {
      if (currentWindow = window != null ? window : this.lastFocusedWindow) {
        if (addToLastWindow || currentWindow.devMode === devMode && (stats.every(function(stat) {
          return typeof stat.isFile === "function" ? stat.isFile() : void 0;
        }) || stats.some(function(stat) {
          return (typeof stat.isDirectory === "function" ? stat.isDirectory() : void 0) && !currentWindow.hasProjectPath();
        }))) {
          existingWindow = currentWindow;
        }
      }
    }

注释掉第一行及其之前的右括号:

//    if (existingWindow == null) {
      if (currentWindow = window != null ? window : this.lastFocusedWindow) {
        if (addToLastWindow || currentWindow.devMode === devMode && (stats.every(function(stat) {
          return typeof stat.isFile === "function" ? stat.isFile() : void 0;
        }) || stats.some(function(stat) {
          return (typeof stat.isDirectory === "function" ? stat.isDirectory() : void 0) && !currentWindow.hasProjectPath();
        }))) {
          existingWindow = currentWindow;
        }
      }
//    }

…aaaand voilà!

毕竟它是一个可破解的文本编辑器^_^

关于linux - 如何在最近事件的 Atom 编辑器窗口而不是我第一次打开的 Atom 窗口中打开文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43526384/

相关文章:

atom-editor - 无法在 Atom 中安装 platformio-ide-terminal

typescript - 如何导入力矩类型定义

ArchLinux中Mongodb无法导出数据

jquery - 文本编辑器选择设置包括 "$"和 "-"?

java - 无法加载 7z-JBinding : no 7-Zip-JBinding in java. 库.path

haskell - 在 GHCi 中设置 vi 为编辑器

c - 如何利用Linux的虚拟串口让C程序与Python程序通信?

java - 在 CHROOT 环境中工作 - 尝试安装 JDK 时出错

c - 将 char** 传递给函数,不会改变它的值,还是会改变?

linux - 在 fedora linux 上访问 localhost