Code::Blocks

User forums => General (but related to Code::Blocks) => Topic started by: kilgore on June 19, 2007, 07:09:33 pm

Title: Vim plugin?
Post by: kilgore on June 19, 2007, 07:09:33 pm
Greetings all,


I am seriously addicted to vim -- has anyone created a vim plugin for code blocks?  Is it possible?
Thanks!

-kt.
Title: Re: Vim plugin?
Post by: MortenMacFly on June 19, 2007, 08:02:42 pm
I am seriously addicted to vim -- has anyone created a vim plugin for code blocks?
Addicted to vim and working with C::B - how is that possible...?! :lol: ;-)
Anyways - It's not quite clear what you mean. If you mean the key shortcuts than have a look at the keybinder plugin - you can re-assign the shortcuts there easily. If you mean the macros / "additional functionality" with vim then have a look at the KeyMacs plugin - you can create macros and assign them a(nother) shortcut to emulate more complex behaviour.
With regards, Morten.
Title: Re: Vim plugin?
Post by: David Perfors on June 19, 2007, 08:09:01 pm
it is not done yet. and of course it is possible. (I suppose you mean to embed vi in C::B as an editor) But keep in mind that most of the plugins only work with the build in editor (like code completion...)
Title: Re: Vim plugin?
Post by: kilgore on June 19, 2007, 08:14:45 pm
Yes, I meant primarily the key mappings.  Thanks for the reply!  I'm not yet a serious c::b user, just exploring  -- I like what I see, but _really_ want what I already know (and I detest having to use that <expletive> mouse when I could do it with a keystroke or two).

Thanks -- and maybe when I get some time, I'll contribute one... ahem...

-kt.

Title: Re: Vim plugin?
Post by: Andrej08 on August 12, 2010, 01:46:12 am
*El bumpo*

I recently found an autohotkey script which has some very basic VIM key-bindings that can be used in some editors (e.g. scintilla, which is what codeblocks uses).

I started modifying it 2 days ago and I've added a bunch of handy close-to-homerow key shortcuts. I'm not making them 100% vim compatible because emulating everything that VIM has is way too hard + a lot of those key shortcuts depend on VIM features. I'm quite inexperienced with VIM, but I do like some of it's features. I've customized the script to my own style, although anyone is free to modify it to their own style and add/edit/remove features.

The script is here: http://www.autohotkey.com/forum/viewtopic.php?p=375239#375239

You'll need to copy-paste it to a filename.ahk file and download and install AutoHotkey_L, a custom version of AHK from this website:
http://www.autohotkey.net/~Lexikos/AutoHotkey_L/

Then just run the script with AHK_L (double-click should do it). You can use caps-lock to toggle between usual editing and vim-mode (you can change the toggle key as well).

If you need to set a quick exit key, add this on any line:
^!home::ExitApp

That's Ctrl+alt+home to exit the script. Check the documentation of AHK_L. Btw if you're new to AHK, the syntax takes some time getting used to. If you have any ideas for some features then if I'm in a good mood I might try to implement them. I've used AHK for almost a year now, so I'd probably find my way around.

Anyway, hope you have a use for it..

Edit: One more thing, I've only extensively tested the script with Scite, but I've only tried it with CB for a few minutes. Most of the features seem to work fine.
Title: Re: Vim plugin?
Post by: ayheos on January 06, 2012, 12:36:49 pm
 :) Recently, I do some jobs to make codeblocks internal editor works like vim.
 
Try it, any feedback is welcome.

https://code.google.com/p/cbvike/

Thanks to codeblocks group.
Title: Re: Vim plugin?
Post by: ollydbg on September 21, 2013, 08:26:17 am
:) Recently, I do some jobs to make codeblocks internal editor works like vim.
 
Try it, any feedback is welcome.

https://code.google.com/p/cbvike/

Thanks to codeblocks group.
I just build and test this plugin, at least it can switch between vim's normal mode and insert mode, and then I can move caret around by "h,j,k,l" key. I'm just a vim beginner, so I think this plugin is useful, at least it can move caret without the help of mouse. ;)
Title: Re: Vim plugin?
Post by: arthurzmj on October 07, 2013, 04:59:51 pm
:) Recently, I do some jobs to make codeblocks internal editor works like vim.
 
Try it, any feedback is welcome.

https://code.google.com/p/cbvike/

Thanks to codeblocks group.

I've made some improvement of this code.
https://github.com/zmj64351508/cbvike
Thanks to ayheos
Title: Re: Vim plugin?
Post by: scarphin on October 07, 2013, 11:10:39 pm
:) Recently, I do some jobs to make codeblocks internal editor works like vim.
 
Try it, any feedback is welcome.

https://code.google.com/p/cbvike/

Thanks to codeblocks group.
I just build and test this plugin, at least it can switch between vim's normal mode and insert mode, and then I can move caret around by "h,j,k,l" key. I'm just a vim beginner, so I think this plugin is useful, at least it can move caret without the help of mouse. ;)

If you want to move caret without the mouse or arrow keys (which are not practical while typing), you can use autohotkey software to define macros for key combinations, for example I use Right Alt+E,S,D,F to move the caret in corresponding directions.
http://www.autohotkey.com/ (http://www.autohotkey.com/)
Title: Re: Vim plugin?
Post by: ollydbg on October 08, 2013, 01:33:20 am
:) Recently, I do some jobs to make codeblocks internal editor works like vim.
 
Try it, any feedback is welcome.

https://code.google.com/p/cbvike/

Thanks to codeblocks group.

I've made some improvement of this code.
https://github.com/zmj64351508/cbvike
Thanks to ayheos
I suggest not using absolute paths in cbp, instead, you can try my patch:
Code: [Select]
vike.cbp | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/vike.cbp b/vike.cbp
index a4e498d..868fd11 100644
--- a/vike.cbp
+++ b/vike.cbp
@@ -7,12 +7,13 @@
  <Option compiler="gcc" />
  <Build>
  <Target title="default">
- <Option output="..\..\..\devel\share\CodeBlocks\plugins\vike.dll" prefix_auto="0" extension_auto="0" />
- <Option object_output="..\..\..\.objs\plugins\contrib\vike" />
+ <Option output="$(#cb_sdk)/devel/share/CodeBlocks/plugins/vike.dll" prefix_auto="0" extension_auto="0" />
+ <Option object_output="$(#cb_sdk)/.objs/plugins/contrib/vike" />
  <Option type="3" />
  <Option compiler="gcc" />
- <Option parameters="--debug-log -na -ns -nd" />
- <Option host_application="..\..\..\devel\codeblocks.exe" />
+ <Option parameters="--debug-log -na -ns -nd -p debug" />
+ <Option host_application="$(#cb_sdk)/devel/codeblocks.exe" />
+ <Option run_host_application_in_terminal="0" />
  <Compiler>
  <Add option="-Winvalid-pch" />
  <Add option="-pipe" />
@@ -33,8 +34,8 @@
  </Linker>
  </Target>
  <Environment>
- <Variable name="WX_SUFFIX" value="u" />
  <Variable name="WX_CFG" value="" />
+ <Variable name="WX_SUFFIX" value="u" />
  </Environment>
  </Build>
  <VirtualTargets>
@@ -43,23 +44,22 @@
  <Compiler>
  <Add option="-Wall" />
  <Add option="-g" />
- <Add directory="..\..\..\include" />
- <Add directory="..\..\..\sdk\wxscintilla\include" />
+ <Add directory="$(#cb_sdk)/include" />
+ <Add directory="$(#cb_sdk)/sdk/wxscintilla/include" />
  <Add directory="$(#WX.include)" />
- <Add directory="$(#WX.lib)\gcc_dll$(WX_CFG)\msw$(WX_SUFFIX)" />
- <Add directory="$(#WX)\contrib\include" />
+ <Add directory="$(#WX.lib)/gcc_dll$(WX_CFG)/msw$(WX_SUFFIX)" />
+ <Add directory="$(#WX)/contrib/include" />
  </Compiler>
  <Linker>
  <Add library="codeblocks" />
  <Add library="wxmsw28$(WX_SUFFIX)" />
- <Add library="wxscintilla" />
- <Add directory="D:\Prog\CodeBlocks_bak" />
- <Add directory="$(#WX.lib)\gcc_dll$(WX_CFG)" />
- <Add directory="..\..\..\devel" />
+ <Add library="wxscintilla_cb" />
+ <Add directory="$(#WX.lib)/gcc_dll$(WX_CFG)" />
+ <Add directory="$(#cb_sdk)/devel" />
  </Linker>
  <ExtraCommands>
- <Add after="zip -j9 ..\..\..\devel\share\CodeBlocks\vike.zip manifest.xml" />
- <Add after="zip -j9 vike.cbplugin ..\..\..\devel\share\CodeBlocks\plugins\vike.dll ..\..\..\devel\share\CodeBlocks\vike.zip" />
+ <Add after="zip -j9 $(#cb_sdk)\devel\share\CodeBlocks\vike.zip manifest.xml" />
+ <Add after="zip -j9 vike.cbplugin $(#cb_sdk)\devel\share\CodeBlocks\plugins\vike.dll $(#cb_sdk)\devel\share\CodeBlocks\vike.zip" />
  <Mode after="always" />
  </ExtraCommands>
  <Unit filename="cbvike.cpp" />


Note: you can define cb_sdk in C::B's settings->global variables to the root folder of C::B source.

BTW: I have contacted ayheos weeks ago, he said his cbvilike development freezes currently.

@scarphin: thanks, I finally think mouse is still necessary when editing under C::B.  ;)

Title: Re: Vim plugin?
Post by: arthurzmj on October 08, 2013, 12:24:04 pm
I suggest not using absolute paths in cbp, instead, you can try my patch:
Code: [Select]
vike.cbp | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/vike.cbp b/vike.cbp
index a4e498d..868fd11 100644
--- a/vike.cbp
+++ b/vike.cbp
@@ -7,12 +7,13 @@
  <Option compiler="gcc" />
  <Build>
  <Target title="default">
- <Option output="..\..\..\devel\share\CodeBlocks\plugins\vike.dll" prefix_auto="0" extension_auto="0" />
- <Option object_output="..\..\..\.objs\plugins\contrib\vike" />
+ <Option output="$(#cb_sdk)/devel/share/CodeBlocks/plugins/vike.dll" prefix_auto="0" extension_auto="0" />
+ <Option object_output="$(#cb_sdk)/.objs/plugins/contrib/vike" />
  <Option type="3" />
  <Option compiler="gcc" />
- <Option parameters="--debug-log -na -ns -nd" />
- <Option host_application="..\..\..\devel\codeblocks.exe" />
+ <Option parameters="--debug-log -na -ns -nd -p debug" />
+ <Option host_application="$(#cb_sdk)/devel/codeblocks.exe" />
+ <Option run_host_application_in_terminal="0" />
  <Compiler>
  <Add option="-Winvalid-pch" />
  <Add option="-pipe" />
@@ -33,8 +34,8 @@
  </Linker>
  </Target>
  <Environment>
- <Variable name="WX_SUFFIX" value="u" />
  <Variable name="WX_CFG" value="" />
+ <Variable name="WX_SUFFIX" value="u" />
  </Environment>
  </Build>
  <VirtualTargets>
@@ -43,23 +44,22 @@
  <Compiler>
  <Add option="-Wall" />
  <Add option="-g" />
- <Add directory="..\..\..\include" />
- <Add directory="..\..\..\sdk\wxscintilla\include" />
+ <Add directory="$(#cb_sdk)/include" />
+ <Add directory="$(#cb_sdk)/sdk/wxscintilla/include" />
  <Add directory="$(#WX.include)" />
- <Add directory="$(#WX.lib)\gcc_dll$(WX_CFG)\msw$(WX_SUFFIX)" />
- <Add directory="$(#WX)\contrib\include" />
+ <Add directory="$(#WX.lib)/gcc_dll$(WX_CFG)/msw$(WX_SUFFIX)" />
+ <Add directory="$(#WX)/contrib/include" />
  </Compiler>
  <Linker>
  <Add library="codeblocks" />
  <Add library="wxmsw28$(WX_SUFFIX)" />
- <Add library="wxscintilla" />
- <Add directory="D:\Prog\CodeBlocks_bak" />
- <Add directory="$(#WX.lib)\gcc_dll$(WX_CFG)" />
- <Add directory="..\..\..\devel" />
+ <Add library="wxscintilla_cb" />
+ <Add directory="$(#WX.lib)/gcc_dll$(WX_CFG)" />
+ <Add directory="$(#cb_sdk)/devel" />
  </Linker>
  <ExtraCommands>
- <Add after="zip -j9 ..\..\..\devel\share\CodeBlocks\vike.zip manifest.xml" />
- <Add after="zip -j9 vike.cbplugin ..\..\..\devel\share\CodeBlocks\plugins\vike.dll ..\..\..\devel\share\CodeBlocks\vike.zip" />
+ <Add after="zip -j9 $(#cb_sdk)\devel\share\CodeBlocks\vike.zip manifest.xml" />
+ <Add after="zip -j9 vike.cbplugin $(#cb_sdk)\devel\share\CodeBlocks\plugins\vike.dll $(#cb_sdk)\devel\share\CodeBlocks\vike.zip" />
  <Mode after="always" />
  </ExtraCommands>
  <Unit filename="cbvike.cpp" />


Note: you can define cb_sdk in C::B's settings->global variables to the root folder of C::B source.

BTW: I have contacted ayheos weeks ago, he said his cbvilike development freezes currently.

@scarphin: thanks, I finally think mouse is still necessary when editing under C::B.  ;)



Thanks for your advise. I'll patch it later.

I'm going to complete this plugin graually. I'm happy if you can try it and give more suggestion to me.
Title: Re: Vim plugin?
Post by: ollydbg on October 10, 2013, 04:17:25 pm
@arthurzmj, I see you have some commits, good work.

Suggestion:
1, vike.layout should not be put in git, because this is a user preference file.
2, I see you have a "bin" folder which contains some generated dlls, I also think this should be removed, because users can have different compilers, and all the binaries files can be build on their local computer.
3, I'm a very beginner of Vim, I still mainly use mouse, so if you can write a document about what functionality this plugin supplies, that will be better. ;D

Thanks.
Title: Re: Vim plugin?
Post by: ollydbg on October 10, 2013, 05:03:50 pm
Is it Ok to change the license?

I see you said in https://github.com/zmj64351508/cbvike

Quote
cbvike

VIM plugin for Code::Blocks.

It's based on https://code.google.com/p/cbvike/ and improved in my own way. So It still retains the name of cbvike but I change the license file.

The original license is GPLv3 (see https://code.google.com/p/cbvike/), you changed to GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 (see https://github.com/zmj64351508/cbvike/blob/master/LICENSE)
Title: Re: Vim plugin?
Post by: arthurzmj on December 16, 2013, 09:09:43 am
@arthurzmj, I see you have some commits, good work.

Suggestion:
1, vike.layout should not be put in git, because this is a user preference file.
2, I see you have a "bin" folder which contains some generated dlls, I also think this should be removed, because users can have different compilers, and all the binaries files can be build on their local computer.
3, I'm a very beginner of Vim, I still mainly use mouse, so if you can write a document about what functionality this plugin supplies, that will be better. ;D

Thanks.

I'm sorry to be late for the reply. Good suggestions. But I'm now busy with some other work, so I'll improve it when I'm free. As the license problem you mentioned, I made a mistake. Thank you for pointing it out.
Title: Re: Vim plugin?
Post by: ollydbg on December 16, 2013, 09:18:00 am
I'm sorry to be late for the reply. Good suggestions. But I'm now busy with some other work, so I'll improve it when I'm free. As the license problem you mentioned, I made a mistake. Thank you for pointing it out.
Ok, once you make a step in your project, you can add a reply here(I will receive an email notification), so I can test it, thanks for your contribution. :D
Title: Re: Vim plugin?
Post by: arthurzmj on May 12, 2014, 03:58:54 pm
Ok, once you make a step in your project, you can add a reply here(I will receive an email notification), so I can test it, thanks for your contribution. :D
I restarted to develop the project. Welcome to do some test. You can find the source on my Github. Any feedback is welcome.
Title: Re: Vim plugin?
Post by: ollydbg on May 18, 2014, 03:33:11 pm
FYI: the plugin announcement page is here: cbvike -- A VIM like plugin (http://forums.codeblocks.org/index.php/topic,19281.msg131815/topicseen.html#msg131815)