vim mode
Many editors/IDEs have vim editing mode, it would be great to see it in Codelite too.
This is unlikely to happen .. (Pull Request are most welcomed)
I would like to implement this feature. Any clue where I can start this? Any existing plugin who's could I can refer for this?
Create new plugin, capture the event wxEVT_ACTIVE_EDITOR_CHANGED (which is sent when CodeLite sets the focus to a new editor)
In the 'ActiveEditorChanged' event handler, bind the active editor's wxEVT_KEY_DOWN event handler from there you can handle all the user key events
Resources: Create new plugin List of all CodeLite events
I would not mind joining in on getting this plugin up and going. I am new to C++ and want to use CodeLite as my IDE but am lost without VIM bindings. Anyone else working on this?
Hallo, I have forked codelite and started implementing a rudimentary vim-like bindings for codelite https://github.com/StefanoBelloni/codelite It is still in an unripe phase. Actual Issues: - If I close an editor ( typing :q ) via the IManager, no wxEVT_ACTIVE_EDITOR_CHANGED is sent and codelite crashes.
@StefanoBelloni how do you close the editor?
@StefanoBelloni I found this method:
bool VimCommand::OnReturnDown(IEditor **editor, IManager *manager)
which in turn calls for IManager::CloseEditor (which should work), however, I am lacking context here: can you confirm that *editor is not NULL? can you confirm that manager is not NULL? (BTW, you can use this code):
IManager* manager = clGetManager();
IEditor* editor = clGetManager()->GetActiveEditor();
Hallo,
Thanks for the quick replay.
I do not understand, why it is crashing.
If I have two editors-tab open,and a close one with the IManager::CloseEditor method, I get the editor to be closed, but no wxEVT_ACTIVE_EDITOR_CHANGED is sent, and consequentially in the method
void VimManager::OnEditorChanged(wxCommandEvent &event)
the text controller of the new editor is not connected to the events wxEVT_CHAR and wxEVT_KEY_DOWN.
when the other editor is displayed and I press ESCAPE, it crashes
in the method
bool QuickFindBar::DoShow(bool s, const wxString& findWhat, bool replaceBar)
676├───────> m_sci->SetFocus();
I guess because the ESCAPE try to hide the quickfindbar, but its editor has been deleted.
For now as a workaround, when the user pressed :q, I simulate the Ctrl + W with the help of
wxUIActionSimulator. ( I do the same to get the quickfindbar, when pressing '/', since I could not find a why to have a pointer to it).
Till now for now this plug-in, I am still working on
- The repetition of the command when pressing '.'
- copy/paste.
- a setting dialog to make it active/inactive.
why don't you just debug CodeLite?
You should also have log in ~/.codelite/crash.log
Hi, I think there is a bug in the function:
bool MainBook::ClosePage(IEditor* editor, bool prompt)
The boolean variable is not used and the call
m_book->DeletePage(pos, false)
does not leave the event to be propagated.
I guess it has never been found, since the editor is always closed directly with the method
bool Notebook::DeletePage(size_t page, bool notify)
The following should fix it
file: mainbook.cpp:1429
bool MainBook::ClosePage(IEditor* editor, bool prompt)
{
wxWindow* page = dynamic_cast<wxWindow*>(editor->GetCtrl());
if(!page) return false;
int pos = m_book->GetPageIndex(page);
return (pos != wxNOT_FOUND) && (m_book->DeletePage(pos, prompt));
}
I would not close the issue yet, since if someone wants to contribute to this vim-mode implementation might find the actual fork quicker.
This is now merged into CodeLite (mostly works, still needs to be improved, I am working on it)
better if it can support .vimrc as vscode does, so I can use my custom keybindings
This is now merged into CodeLite (mostly works, still needs to be improved, I am working on it)
can I define some keybinding for vim, imap and nmap. thanks.