akonwi / git-plus

vim-fugitive like package for atom. make commits and other git things without the terminal
MIT License
537 stars 163 forks source link

[REQUEST] Context menu #777

Closed storm49152 closed 5 years ago

storm49152 commented 5 years ago

In the changelog I read that since 8.3.0: "The tree view context menu has been improved to only show commands that are applicable to the selected items."

That is nice to avoid clutter but, and I don't know about others, it also hides menu items like "commit", "pull" and "push" that I use frequently. I found it quite convenient that I could do that from anywhere in the tree.

Is it an option to bring these 3 (or at least "pull" and "push") back as a fixed menu item?

akonwi commented 5 years ago

Those commands are still there. Pull and Push are just on the repo root now. And any item that is modified, including the repo root, has the 'Add + Commit' options. Part of why I did that was it's simpler, given the current context menu api and it reduces some complexity in handling the commands.

I don't think I'll make those fixed items again at this point. If you really want them, it's easy to setup them up in your init script and I'd be happy to share a snippet you could use.

storm49152 commented 5 years ago

Yes please, I'd like to have that snippet.

akonwi commented 5 years ago

Here you go.

atom.contextMenu.add({
  '.tree-view > .full-menu .file': [
    { type: 'separator' },
    {
      label: 'My-Git', // You need a different label if you don't want to overwrite what git-plus sets as 'Git'
      submenu: [
         {
          label: 'Push',
          'command': 'git-plus-context:push'
        },
        {
          label: 'Pull',
          'command': 'git-plus-context:pull'
        }
      ]
    },
  ]
})