add vim bindings to split input movement

This commit is contained in:
Rasmus Karlsson 2019-03-02 09:28:54 +01:00
parent 3f41dfeff9
commit 777ac017df

View file

@ -246,6 +246,54 @@ void SplitInput::installKeyPressedEvent()
}
}
}
else if (event->key() == Qt::Key_H &&
event->modifiers() == Qt::AltModifier)
{
// h: vim binding for left
SplitContainer *page = this->split_->getContainer();
event->accept();
if (page != nullptr)
{
page->selectNextSplit(SplitContainer::Left);
}
}
else if (event->key() == Qt::Key_J &&
event->modifiers() == Qt::AltModifier)
{
// j: vim binding for down
SplitContainer *page = this->split_->getContainer();
event->accept();
if (page != nullptr)
{
page->selectNextSplit(SplitContainer::Below);
}
}
else if (event->key() == Qt::Key_K &&
event->modifiers() == Qt::AltModifier)
{
// k: vim binding for up
SplitContainer *page = this->split_->getContainer();
event->accept();
if (page != nullptr)
{
page->selectNextSplit(SplitContainer::Above);
}
}
else if (event->key() == Qt::Key_L &&
event->modifiers() == Qt::AltModifier)
{
// l: vim binding for right
SplitContainer *page = this->split_->getContainer();
event->accept();
if (page != nullptr)
{
page->selectNextSplit(SplitContainer::Right);
}
}
else if (event->key() == Qt::Key_Down)
{
if ((event->modifiers() & Qt::ShiftModifier) != 0)