From 0402cfff6e65b6b83e9153c25d645dab924ce953 Mon Sep 17 00:00:00 2001 From: Dane Finlay Date: Thu, 5 Dec 2019 19:33:35 +1100 Subject: [PATCH 1/3] Stop requiring the original dragonfly package This allows vim-grammar to work with dragonfly2. --- gvim.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/gvim.py b/gvim.py index 5b6d6c4..166f0b4 100644 --- a/gvim.py +++ b/gvim.py @@ -7,13 +7,6 @@ from vim.rules import action, motion, object, navigation, buffer, quick_replace, quick_settings, diff, general from vim.plugins import surround, easy_motion, netrw, ctrlp, fugitive, unimpaired, snipmate from vim.vim_config import get_config -try: - import pkg_resources - pkg_resources.require("dragonfly >= 0.6.5beta1.dev-r99") -except ImportError: - pass - -print 'new gVim grammar accessed.' # Saving generally useful info config = get_config() From aa24b2f8c8f8ca46dca6a63081b32ca135121e83 Mon Sep 17 00:00:00 2001 From: Dane Finlay Date: Thu, 5 Dec 2019 19:37:13 +1100 Subject: [PATCH 2/3] Move all vim sub-packages inside a new 'vim' folder vim-grammar wasn't working until I did this. --- __init__.py => vim/__init__.py | 0 {choices => vim/choices}/__init__.py | 0 {choices => vim/choices}/find.py | 0 {choices => vim/choices}/letter.py | 0 {choices => vim/choices}/modifier.py | 0 {choices => vim/choices}/motion.py | 0 {choices => vim/choices}/object.py | 0 {choices => vim/choices}/search.py | 0 {choices => vim/choices}/simple_verb.py | 0 {choices => vim/choices}/surround.py | 0 {choices => vim/choices}/uncountableMotion.py | 0 {choices => vim/choices}/verb.py | 0 {lib => vim/lib}/__init__.py | 0 {lib => vim/lib}/execute_rule.py | 0 {navigation => vim/navigation}/__init__.py | 0 {navigation => vim/navigation}/tabs.py | 0 {plugins => vim/plugins}/__init__.py | 0 {plugins => vim/plugins}/ctrlp.py | 0 {plugins => vim/plugins}/easy_motion.py | 0 {plugins => vim/plugins}/fugitive.py | 0 {plugins => vim/plugins}/netrw.py | 0 {plugins => vim/plugins}/snipmate.py | 0 {plugins => vim/plugins}/surround.py | 0 {plugins => vim/plugins}/unimpaired.py | 0 {rules => vim/rules}/__init__.py | 0 {rules => vim/rules}/action.py | 0 {rules => vim/rules}/buffer.py | 0 {rules => vim/rules}/command_mode.py | 0 {rules => vim/rules}/diff.py | 0 {rules => vim/rules}/general.py | 0 {rules => vim/rules}/insert_mode.py | 0 {rules => vim/rules}/letter.py | 0 {rules => vim/rules}/marks.py | 0 {rules => vim/rules}/motion.py | 0 {rules => vim/rules}/navigation.py | 0 {rules => vim/rules}/object.py | 0 {rules => vim/rules}/quick_replace.py | 0 {rules => vim/rules}/quick_search.py | 0 {rules => vim/rules}/quick_settings.py | 0 {rules => vim/rules}/registers.py | 0 vim_config.py => vim/vim_config.py | 0 41 files changed, 0 insertions(+), 0 deletions(-) rename __init__.py => vim/__init__.py (100%) rename {choices => vim/choices}/__init__.py (100%) rename {choices => vim/choices}/find.py (100%) rename {choices => vim/choices}/letter.py (100%) rename {choices => vim/choices}/modifier.py (100%) rename {choices => vim/choices}/motion.py (100%) rename {choices => vim/choices}/object.py (100%) rename {choices => vim/choices}/search.py (100%) rename {choices => vim/choices}/simple_verb.py (100%) rename {choices => vim/choices}/surround.py (100%) rename {choices => vim/choices}/uncountableMotion.py (100%) rename {choices => vim/choices}/verb.py (100%) rename {lib => vim/lib}/__init__.py (100%) rename {lib => vim/lib}/execute_rule.py (100%) rename {navigation => vim/navigation}/__init__.py (100%) rename {navigation => vim/navigation}/tabs.py (100%) rename {plugins => vim/plugins}/__init__.py (100%) rename {plugins => vim/plugins}/ctrlp.py (100%) rename {plugins => vim/plugins}/easy_motion.py (100%) rename {plugins => vim/plugins}/fugitive.py (100%) rename {plugins => vim/plugins}/netrw.py (100%) rename {plugins => vim/plugins}/snipmate.py (100%) rename {plugins => vim/plugins}/surround.py (100%) rename {plugins => vim/plugins}/unimpaired.py (100%) rename {rules => vim/rules}/__init__.py (100%) rename {rules => vim/rules}/action.py (100%) rename {rules => vim/rules}/buffer.py (100%) rename {rules => vim/rules}/command_mode.py (100%) rename {rules => vim/rules}/diff.py (100%) rename {rules => vim/rules}/general.py (100%) rename {rules => vim/rules}/insert_mode.py (100%) rename {rules => vim/rules}/letter.py (100%) rename {rules => vim/rules}/marks.py (100%) rename {rules => vim/rules}/motion.py (100%) rename {rules => vim/rules}/navigation.py (100%) rename {rules => vim/rules}/object.py (100%) rename {rules => vim/rules}/quick_replace.py (100%) rename {rules => vim/rules}/quick_search.py (100%) rename {rules => vim/rules}/quick_settings.py (100%) rename {rules => vim/rules}/registers.py (100%) rename vim_config.py => vim/vim_config.py (100%) diff --git a/__init__.py b/vim/__init__.py similarity index 100% rename from __init__.py rename to vim/__init__.py diff --git a/choices/__init__.py b/vim/choices/__init__.py similarity index 100% rename from choices/__init__.py rename to vim/choices/__init__.py diff --git a/choices/find.py b/vim/choices/find.py similarity index 100% rename from choices/find.py rename to vim/choices/find.py diff --git a/choices/letter.py b/vim/choices/letter.py similarity index 100% rename from choices/letter.py rename to vim/choices/letter.py diff --git a/choices/modifier.py b/vim/choices/modifier.py similarity index 100% rename from choices/modifier.py rename to vim/choices/modifier.py diff --git a/choices/motion.py b/vim/choices/motion.py similarity index 100% rename from choices/motion.py rename to vim/choices/motion.py diff --git a/choices/object.py b/vim/choices/object.py similarity index 100% rename from choices/object.py rename to vim/choices/object.py diff --git a/choices/search.py b/vim/choices/search.py similarity index 100% rename from choices/search.py rename to vim/choices/search.py diff --git a/choices/simple_verb.py b/vim/choices/simple_verb.py similarity index 100% rename from choices/simple_verb.py rename to vim/choices/simple_verb.py diff --git a/choices/surround.py b/vim/choices/surround.py similarity index 100% rename from choices/surround.py rename to vim/choices/surround.py diff --git a/choices/uncountableMotion.py b/vim/choices/uncountableMotion.py similarity index 100% rename from choices/uncountableMotion.py rename to vim/choices/uncountableMotion.py diff --git a/choices/verb.py b/vim/choices/verb.py similarity index 100% rename from choices/verb.py rename to vim/choices/verb.py diff --git a/lib/__init__.py b/vim/lib/__init__.py similarity index 100% rename from lib/__init__.py rename to vim/lib/__init__.py diff --git a/lib/execute_rule.py b/vim/lib/execute_rule.py similarity index 100% rename from lib/execute_rule.py rename to vim/lib/execute_rule.py diff --git a/navigation/__init__.py b/vim/navigation/__init__.py similarity index 100% rename from navigation/__init__.py rename to vim/navigation/__init__.py diff --git a/navigation/tabs.py b/vim/navigation/tabs.py similarity index 100% rename from navigation/tabs.py rename to vim/navigation/tabs.py diff --git a/plugins/__init__.py b/vim/plugins/__init__.py similarity index 100% rename from plugins/__init__.py rename to vim/plugins/__init__.py diff --git a/plugins/ctrlp.py b/vim/plugins/ctrlp.py similarity index 100% rename from plugins/ctrlp.py rename to vim/plugins/ctrlp.py diff --git a/plugins/easy_motion.py b/vim/plugins/easy_motion.py similarity index 100% rename from plugins/easy_motion.py rename to vim/plugins/easy_motion.py diff --git a/plugins/fugitive.py b/vim/plugins/fugitive.py similarity index 100% rename from plugins/fugitive.py rename to vim/plugins/fugitive.py diff --git a/plugins/netrw.py b/vim/plugins/netrw.py similarity index 100% rename from plugins/netrw.py rename to vim/plugins/netrw.py diff --git a/plugins/snipmate.py b/vim/plugins/snipmate.py similarity index 100% rename from plugins/snipmate.py rename to vim/plugins/snipmate.py diff --git a/plugins/surround.py b/vim/plugins/surround.py similarity index 100% rename from plugins/surround.py rename to vim/plugins/surround.py diff --git a/plugins/unimpaired.py b/vim/plugins/unimpaired.py similarity index 100% rename from plugins/unimpaired.py rename to vim/plugins/unimpaired.py diff --git a/rules/__init__.py b/vim/rules/__init__.py similarity index 100% rename from rules/__init__.py rename to vim/rules/__init__.py diff --git a/rules/action.py b/vim/rules/action.py similarity index 100% rename from rules/action.py rename to vim/rules/action.py diff --git a/rules/buffer.py b/vim/rules/buffer.py similarity index 100% rename from rules/buffer.py rename to vim/rules/buffer.py diff --git a/rules/command_mode.py b/vim/rules/command_mode.py similarity index 100% rename from rules/command_mode.py rename to vim/rules/command_mode.py diff --git a/rules/diff.py b/vim/rules/diff.py similarity index 100% rename from rules/diff.py rename to vim/rules/diff.py diff --git a/rules/general.py b/vim/rules/general.py similarity index 100% rename from rules/general.py rename to vim/rules/general.py diff --git a/rules/insert_mode.py b/vim/rules/insert_mode.py similarity index 100% rename from rules/insert_mode.py rename to vim/rules/insert_mode.py diff --git a/rules/letter.py b/vim/rules/letter.py similarity index 100% rename from rules/letter.py rename to vim/rules/letter.py diff --git a/rules/marks.py b/vim/rules/marks.py similarity index 100% rename from rules/marks.py rename to vim/rules/marks.py diff --git a/rules/motion.py b/vim/rules/motion.py similarity index 100% rename from rules/motion.py rename to vim/rules/motion.py diff --git a/rules/navigation.py b/vim/rules/navigation.py similarity index 100% rename from rules/navigation.py rename to vim/rules/navigation.py diff --git a/rules/object.py b/vim/rules/object.py similarity index 100% rename from rules/object.py rename to vim/rules/object.py diff --git a/rules/quick_replace.py b/vim/rules/quick_replace.py similarity index 100% rename from rules/quick_replace.py rename to vim/rules/quick_replace.py diff --git a/rules/quick_search.py b/vim/rules/quick_search.py similarity index 100% rename from rules/quick_search.py rename to vim/rules/quick_search.py diff --git a/rules/quick_settings.py b/vim/rules/quick_settings.py similarity index 100% rename from rules/quick_settings.py rename to vim/rules/quick_settings.py diff --git a/rules/registers.py b/vim/rules/registers.py similarity index 100% rename from rules/registers.py rename to vim/rules/registers.py diff --git a/vim_config.py b/vim/vim_config.py similarity index 100% rename from vim_config.py rename to vim/vim_config.py From b0c46aeec247184980a59d041829bfcbe060e5a7 Mon Sep 17 00:00:00 2001 From: Dane Finlay Date: Thu, 5 Dec 2019 19:41:47 +1100 Subject: [PATCH 3/3] Fix print statements in two files This makes vim-grammar load in Python 2.7 and 3.x without syntax errors. --- gvim.py | 8 ++++---- vim/lib/execute_rule.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gvim.py b/gvim.py index 166f0b4..f04038f 100644 --- a/gvim.py +++ b/gvim.py @@ -73,7 +73,7 @@ def _process_recognition(self, node, extras): # Note: there are issues with the super call. If you run into them, # do not fret and google for super TypeError order. super(self.__class__, self)._process_recognition(node, extras) - print "\n(INSERT)" + print("\n(INSERT)") class InsertModeDisabler(InsertModeFinishRule): def _process_recognition(self, node, extras): @@ -81,7 +81,7 @@ def _process_recognition(self, node, extras): insertModeBootstrap.enable() normalModeGrammar.enable() super(self.__class__, self)._process_recognition(node, extras) - print "\n(NORMAL)" + print("\n(NORMAL)") ### 3. Command mode from vim.rules.command_mode import CommandModeStartRule, CommandModeFinishRule, CommandModeCommands @@ -92,7 +92,7 @@ def _process_recognition(self, node, extras): normalModeGrammar.disable() commandModeGrammar.enable() super(self.__class__, self)._process_recognition(node, extras) - print "\n(EX MODE)" + print("\n(EX MODE)") class CommandModeDisabler(CommandModeFinishRule): def _process_recognition(self, node, extras): @@ -100,7 +100,7 @@ def _process_recognition(self, node, extras): commandModeBootstrap.enable() normalModeGrammar.enable() super(self.__class__, self)._process_recognition(node, extras) - print "\n(NORMAL)" + print("\n(NORMAL)") ### 4. Prep & activate the requisite grammars gvim_exec_context = AppContext(executable="gvim") diff --git a/vim/lib/execute_rule.py b/vim/lib/execute_rule.py index 253a9d0..39690e0 100644 --- a/vim/lib/execute_rule.py +++ b/vim/lib/execute_rule.py @@ -19,7 +19,7 @@ def _executeRecursive(executable): for item in executable: _executeRecursive(item) else: - print "Neither executable nor a list: ", executable + print("Neither executable nor a list: ", executable) def execute_rule(*rule_names): def _exec_function(**kwargs):