Skip to content

Commit

Permalink
Add IdeaVim actions promoter to promote vim actions
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPl292 committed Feb 1, 2021
1 parent 27293c3 commit de159d6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ usual beta standards.
* [VIM-1799](https://youtrack.jetbrains.com/issue/VIM-1799)
[VIM-1794](https://youtrack.jetbrains.com/issue/VIM-179a)
Special characters are not interpreted on yanking
* [VIM-2218](https://youtrack.jetbrains.com/issue/VIM-2218) Fix some shortcuts for 2021.+

## 0.64, 2020-12-23

Expand Down
2 changes: 2 additions & 0 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
<postStartupActivity implementation="com.maddyhome.idea.vim.PluginStartup" order="first"/>

<editorFloatingToolbarProvider implementation="com.maddyhome.idea.vim.ui.ReloadFloatingToolbar"/>

<actionPromoter implementation="com.maddyhome.idea.vim.key.VimActionsPromoter" order="last"/>
</extensions>

<xi:include href="/META-INF/includes/ApplicationServices.xml" xpointer="xpointer(/idea-plugin/*)"/>
Expand Down
33 changes: 33 additions & 0 deletions src/com/maddyhome/idea/vim/key/VimActionsPromoter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2021 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package com.maddyhome.idea.vim.key

import com.intellij.openapi.actionSystem.ActionPromoter
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.EmptyAction
import com.maddyhome.idea.vim.action.VimShortcutKeyAction

class VimActionsPromoter : ActionPromoter {
override fun promote(actions: MutableList<AnAction>, context: DataContext): List<AnAction> {
return actions.filter {
it is EmptyAction.MyDelegatingAction && it.delegate is VimShortcutKeyAction
}
}
}

0 comments on commit de159d6

Please sign in to comment.