Edit Vim mode keybindings

48 views
Skip to first unread message

Andrew Malcolmson

unread,
Feb 23, 2012, 3:48:26 PM2/23/12
to Neutron IDE
Hi,

I've got Neutron IDE working on my Debian squeeze server (the terminal
feature is great!) and I'm try to figure out how to change the Vim
mode bindings in vim.js.

I want to add the standard Vim/vi binding '0' in Normal mode to go to
line beginning. I added 'vimcommand("(0)", "gotolinestart"),' to the
vimStates, start section and reloaded the editor but I get no action.
What am I doing wrong here?

Bye the way, there are two of these files at slightly different paths:
1) static/ide/js/ace/lib/ace/keyboard:
2) ide/static/ide/js/ace/lib/ace/keyboard

Which is the 'real' one? I tried changing both.

Paul Bailey

unread,
Feb 23, 2012, 4:21:28 PM2/23/12
to neutr...@googlegroups.com
If you hit the button with the tools and then go to "editor preferences", you can change the editor key bindings to Vim.

If you can, post how you use the Vim mode or how good it works, because I personally don't use it.  I'm not a Vim or EMacs guy so I stick with the Ace bindings.  Feedback on those modes is much appreciated.

Also if part of your use is defining custom commands, let me know because maybe I can add a better way to add custom commands.

Last on the real javascript location.  For "production" situations it is  static/ide/js/ace/lib/ace/keyboard.  When I'm developing the IDE it is ide/static/ide/js/ace/lib/ace/keyboard.  This is a Django convention.  Most Django apps only store JS in the development location and then expect you to run a command to compile all static files together for production.  Since Neutron IDE is meant to be run out of the box I just go ahead and compile all static files together when releasing, that way you don't have to.

So anything under static/ is what is being served.

If you set DEBUG = True in your settings then ide/static/ is what is served.

Andrew Malcolmson

unread,
Feb 23, 2012, 9:08:18 PM2/23/12
to Neutron IDE
On Feb 23, 4:21 pm, Paul Bailey <paul.m.bai...@gmail.com> wrote:
> If you hit the button with the tools and then go to "editor preferences",
> you can change the editor key bindings to Vim.

I have no problem switching to Vim mode, but many of the standard Vim
key bindings are not implemented.  I'm editing vim.js in hopes of
adding some of the missing ones.

> If you can, post how you use the Vim mode or how good it works, because I
> personally don't use it.  I'm not a Vim or EMacs guy so I stick with the
> Ace bindings.  Feedback on those modes is much appreciated.

Other than missing key bindings, Vim mode works fine.

Just like in regular Vim/vi, the editor is usually in either Normal or
Insert modes.  In Normal mode you use key combinations to move the
insertion point around the editor window and copy & paste text.  For
example, 'w' moves forward to the first letter of the next word and
'b' does the same backwards. In Insert mode your keypresses enter text
like they do in any other editor.  The editor starts in Normal mode
and you enter Insert mode by pressing 'i'.  To return to Normal mode
you press Escape.  There's much more to Vim but that's the basic idea.

> Also if part of your use is defining custom commands, let me know because
> maybe I can add a better way to add custom commands.

I'm not doing that yet, thanks.
>
> Last on the real javascript location.  For "production" situations it is
>  static/ide/js/ace/lib/ace/keyboard.  When I'm developing the IDE it is
> ide/static/ide/js/ace/lib/ace/keyboard.  This is a Django convention.  Most
> Django apps only store JS in the development location and then expect you
> to run a command to compile all static files together for production.
>  Since Neutron IDE is meant to be run out of the box I just go ahead and
> compile all static files together when releasing, that way you don't have
> to.
>
> So anything under static/ is what is being served.
>
> If you set DEBUG = True in your settings then ide/static/ is what is served.

OK, good to know.

In my case, though, I've got DEBUG = True in settings and I can now
see from the debug logs that vim.js is served from /static/ide/js/ace/
build/src.  When I edit that file, my changes now work in the editor,
so that's good.  However, that file is a pain to edit since there are
no line breaks and if I copy in the same file from one of the
locations I gave before that have the line breaks, Vim mode stops
working totally.  What should I do to get the file to be served from
somewhere other than the build/src directory?

Paul Bailey

unread,
Feb 23, 2012, 9:36:42 PM2/23/12
to neutr...@googlegroups.com
When you have an updated vim.js send it over and i'll incorporate the changes.

As for using the uncomrpessed version of vim.js, you could change the path in neutron/ide/templates/ide/master.html to the uncomrpessed version.  That should make life alot easier for you :-) 


Reply all
Reply to author
Forward
0 new messages