Browse Source

Explorer: support Vim navigation

Le Tan 7 years ago
parent
commit
027c8abd17
2 changed files with 12 additions and 0 deletions
  1. 10 0
      src/vexplorer.cpp
  2. 2 0
      src/vexplorer.h

+ 10 - 0
src/vexplorer.cpp

@@ -12,6 +12,7 @@
 #include "vlineedit.h"
 #include "vhistorylist.h"
 #include "vorphanfile.h"
+#include "utils/vimnavigationforwidget.h"
 
 extern VMainWindow *g_mainWin;
 
@@ -773,3 +774,12 @@ void VExplorer::setRootDirectory(const QString &p_path)
         setCurrentEntry(idx);
     }
 }
+
+void VExplorer::keyPressEvent(QKeyEvent *p_event)
+{
+    if (VimNavigationForWidget::injectKeyPressEventForVim(m_tree, p_event)) {
+        return;
+    }
+
+    QWidget::keyPressEvent(p_event);
+}

+ 2 - 0
src/vexplorer.h

@@ -28,6 +28,8 @@ protected:
 
     void focusInEvent(QFocusEvent *p_event) Q_DECL_OVERRIDE;
 
+    void keyPressEvent(QKeyEvent *p_event) Q_DECL_OVERRIDE;
+
 private slots:
     void handleEntryActivated(int p_idx);