atom-shell-commands icon indicating copy to clipboard operation
atom-shell-commands copied to clipboard

Instructions wrong?

Open francispotter opened this issue 8 years ago • 17 comments

It's my first time trying to configure something like this, so maybe I'm missing something obvious.

I have a 100% fresh install of Atom on a 100% fresh install of Ubuntu, latest version of both. I then installed the atom-shell-commands package; the first package I installed on this Atom installation.

The instructions say "File->Open Your Config" but there is no such option on the File menu of Atom.

The instructions say to edit ~/.atom/config.cson, but when I edit that file and save it, it just reverts instantly to its previous condition (which contains "atom-shell-commands": {}) so my newly added commands are lost.

There's an "Array of Commands" entry box under "Settings" in the tab, but whatever I enter there just disappears.

What are the actual steps necessary to configure atom-shell-commands?

francispotter avatar Sep 24 '16 17:09 francispotter

watch out the indent and tab mode in config.cson

skywind3000 avatar Sep 24 '16 17:09 skywind3000

Thanks! It's quite touchy. I did manage to get it to save the cson, and I added a command. But I get an exception when I run it. Very simple command:

  "atom-shell-commands":
    commands:[
      {
        name: "foobar"
        command: "echo 'Hello'"
      }
    ]

And I get this error when I run it:

Uncaught TypeError: Cannot read property 'mode' of undefined

TypeError: Cannot read property 'mode' of undefined
    at execute (/home/francis/.atom/packages/atom-shell-commands/lib/atom-shell-commands.js:339:21)
    at atom-workspace.<anonymous> (/home/francis/.atom/packages/atom-shell-commands/lib/atom-shell-commands.js:52:7)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:260:29)
    at /usr/share/atom/resources/app.asar/src/command-registry.js:3:61
    at CommandPaletteView.module.exports.CommandPaletteView.confirmed (/usr/share/atom/resources/app.asar/node_modules/command-palette/lib/command-palette-view.js:183:32)
    at CommandPaletteView.module.exports.SelectListView.confirmSelection (/usr/share/atom/resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:338:21)
    at space-pen-div.atom.commands.add.core:confirm (/usr/share/atom/resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:109:19)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:260:29)
    at /usr/share/atom/resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/usr/share/atom/resources/app.asar/src/window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (/usr/share/atom/resources/app.asar/src/window-event-handler.js:3:61)

francispotter avatar Sep 24 '16 17:09 francispotter

sorry, it appears that somethings wrong in the latest version, to avoid it,you can add a option named "mode" after "name". And the value of mode is a empty string.

I will check that after as soon as possible

skywind3000 avatar Sep 24 '16 20:09 skywind3000

I have the same issue. What tab mode should I use in config.cson?

hszhsh avatar Sep 29 '16 09:09 hszhsh

@francispotter @hszhsh mode issue has been fixed in the latest version 1.5.0

skywind3000 avatar Oct 07 '16 15:10 skywind3000

I also had the same problem, but I am wondering where should I put the atom-shell-command lines. Here's what my config.cson looks like.

"*":
  "*":
    "atom-terminal":
      app: "C:\\Program Files\\cmder\\Cmder.exe"
    editor:
      fontSize: 12
      tabLength: 4
    "exception-reporting":
      userId: "5ef7ad9d-6df7-5bff-b348-ffee2d2a0a46"
    metrics:
      userId: "8419cce58a83ac8f6e93a8c1656d43f383cf0dff"
    welcome:
      showOnStartup: false
  "atom-shell-commands": {}
  core: {}
  editor:
    invisibles: {}
  "exception-reporting":
    userId: "dba9414e-9dcd-b7e2-86a1-dd46670f7361"
  metrics:
    userId: "8419cce58a83ac8f6e93a8c1656d43f383cf0dff"
  welcome:
    showOnStartup: false

Should I put it on the "root" line, or indented to the first "*"?

FilBot3 avatar Oct 10 '16 17:10 FilBot3

atom-shell-commands is absolutely under the first *, indent (tab/space) in cson is something like python, don't mix up spaces and tabs, the default config.cson is indented in spaces (not tab)

at least you can convert it to json, edit and convert back again.

here is my config.cson:

"*":
  "atom-shell-commands":
    commands: [
      {
        name: "Execute"
        command: "{FileNameNoExt}"
        options:
          cwd: "{FileDir}"
          keymap: "ctrl-1"
          mode: "terminal"
      }
      {
        name: "gcc"
        command: "d:/dev/mingw/bin/gcc.exe"
        arguments: [
          "-O3"
          "-Wall"
          "{FileName}"
          "-o"
          "{FileNameNoExt}.exe"
          "-lstdc++"
          "-lwinmm"
        ]
        options:
          cwd: "{FileDir}"
          keymap: "ctrl-2"
          sound: "D:/ACM/github/vim/tools/samples/sample-7.wav"
      }
    ]
  "autocomplete-clang":
    includePaths: [
      "."
      "d:\\dev\\mingw32\\include"
    ]
  "autocomplete-plus":
    confirmCompletion: "tab"
    minimumWordLength: 2
  core:
    disabledPackages: [
      "minimap"
    ]
    themes: [
      "atom-light-ui"
      "atom-light-syntax"
    ]
  editor:
    fontSize: 13
    softTabs: false
    tabLength: 4
  "exception-reporting":
    userId: "97fd92b1-97de-1dbf-2bda-7bdb262a041f"
  minimap:
    displayCodeHighlights: false
  welcome:
    showOnStartup: false
  whitespace:
    ensureSingleTrailingNewline: false
    removeTrailingWhitespace: false

skywind3000 avatar Oct 10 '16 19:10 skywind3000

For some reason, my cson has two "*"'s, and when I put it under the first one and save the file, the atom-shell-commands section gets removed and placed under the second "*". Then it defaults back to the style as in my comment earlier. Then I also went through and set all of my automatic indentations to soft tabs, and restarted Atom, but its still resetting to the above form. Even when I just edit the "atom-shell-commands": {} then save it. I'm using Atom 1.10.2 if that matters on Windows 10.

FilBot3 avatar Oct 10 '16 19:10 FilBot3

All you need is filling something in {} atom will get rid of empty items before saving

skywind3000 avatar Oct 10 '16 19:10 skywind3000

Its still removing all the additions I make when I save the file and just showing "atom-shell-commands": {}

FilBot3 avatar Oct 10 '16 19:10 FilBot3

have you really filled some data in it ? not just empty {} or emtpy []

skywind3000 avatar Oct 10 '16 20:10 skywind3000

For some reason, now its sticking. I restarted Atom before, and the changes never saved properly. Then I had to restart my OS, and now the config file edits are saving properly. I apologize for wasting your time.

The plugin is working as expected.

FilBot3 avatar Oct 10 '16 20:10 FilBot3

feel free to ask any questions

skywind3000 avatar Oct 12 '16 04:10 skywind3000

It seems the issue is still happening regarding the "atom-shell-commands" reverting back to an empty {}. I tried for a while following the instructions for testing a basic command and even copy pasted a lot of the example here and there but they get erased instantly.

I found a workaround by editing the config file in Notepad++ instead (while atom is closed) and doing my copy/paste here. Then I restarted Atom.

(Running on Atom 1.12.6 (portable mode) and atom-shell-command 1.5.0 on Windows 7)

Froyok avatar Dec 03 '16 21:12 Froyok

I had similar problems (any changes I made were reverted to {} ), but like Froyok, editing the config file in another editor kept the changes. It seems to be fine editing within Atom now. Running Atom 1.13.0 on Ubuntu 14.04.

petern3 avatar Jan 19 '17 21:01 petern3

That was painful but using an external text editor worked for me, too. Seems there must be a config.cson editor or validating plugin somewhere for those of us that lack the required whitespace knowledge.

philip avatar Feb 21 '17 05:02 philip

Sorry, for replying late, This repository is looking for maintainer now, https://github.com/skywind3000/atom-shell-commands/issues/20

skywind3000 avatar Mar 18 '17 10:03 skywind3000