agaskar.com

Apr 14 2008

vim (vi) emulation with viPlugin in FlexBuilder Standalone (Eclipse).

Download a trial here: http://www.satokar.com/viplugin/. You need the one compatible with Eclipse 3.0+. Drop the contents of the ‘features’ and ‘plugins’ directory into the corresponding folders where your FlexBuilder install lives and restart for joy. Read more about downsides and my usage notes after the jump. Two downsides: 1. It’s not free — there is a ‘trial’, but with a nag screen every 30 seconds it’s exactly that — a trial. You can get an idea of what it would be like before dropping your 15 Euro (seemingly well worth it — I suppose I should decide soon before the dollar falls any further) on the license. 2. Ambient (‘a’) and inner (‘i’) move commands aren’t supported, which is too bad — some of my favorite keystrokes are “ci’” and “ci”“, which changes the contents of single quoted and double quoted strings, respectively. It does permit “cw” (change word), which should work just as well in most situations (and is one keystroke shorter!), and ‘ct{char}’ which I also use fairly often. Maybe it’s time to get more familar with Here’s a quick snip from the Help docs (found in one of the plugin folders in the Download) which covers what vi keystrokes are included:

All implemented commands without description ESC, R, r, J, h, j, k, l, i, I, a, A, o, O, s, S, x, X, dd, D, yy, Y, cc, C, guu, gUU, p, P, u, U, n, N, ta, Ta, fa, Fa, “;”, “,”, w, b, E, v, V, ZZ, ZQ, zz, zt, zb, z-Enter, %, *, #, (dot-command), ma, qa, @a, ‘a, “ay, “ap, /abc, ?abc, gg, G, H, M, L, _, +, -, {, }, ENTER, DEL, BACKSPACE, /(Up-Arrow), /(Down-Arrow), ?(Up-Arrow), ?(Down-Arrow), /ENTER, ?ENTER, W, B, ==, ” (2 single ticks), > d, y, c, gu and gU with the following modifiers w,e,E,$,0, $, ^, h, j, k, l, {, }, W, B, gg, G, /xxx, ?xxx, tx, Tx, fx, Fx, (Up-Arrow), (Down-Arrow), (Left-Arrow), (Right-Arrow), ‘a, %, SPACE with the following modifiers ‘a, %, j, k, h, l CTRL-R, CTRL-F, CTRL-B, CTRL-Y, CTRL-D, CTRL-E, CTRL-U, CTRL-T Some of the following extended commands support ranges like: :.,+1d :.,$s/foo/bar/g :1,’ac :w, :wa, :q, :wq, :q!, :100, :$, :u, :(Up-Arrow), :(Down-Arrow), :x, :[%]s/search/replace/[g], :s, :%s, :n, :p, :e!, :d :set, :set ignorecase, :set ic, :set noignorecase, :set noic, :set vimcursor, :set vc, :set novimcursor, :set novc, :set shiftwidth=3, :set sw=3, :set expandtab, :set et, :set noexpandtab, :set noet, :set hlsearch, :set nohlsearch, :set hl, :set nohl, :set incsearch, :set noincsearch, :set ic, :noic
So, not quite the holy grail I’m looking for yet — I’d like FULL vim functionality (especially indent support) for working with AS3 files, while still having the easy build and debugging tools. Maybe this means checking out eclim, which permits vim to ‘call out’ to a headless instance of Eclipse, maybe this means running an external instance of vim and using Eclipse for compiling only. Still, the key bindings are a nice start. I am so glad that my eclipse files don’t have to be littered with ‘dd’ or ‘:w’ fragments any more. Postscript: I tried installing vimplugin, but it threw a nullPointerException in the FlexBuilder standalone. I’ve heard a couple horror stories about trying to get a Eclipse working with multiple plugins (and I’ve never really installed Eclipse successfully), so I’ve decided to forego trying the ‘install Eclipse + Flexbuilder plugin route’, although I may explore that later. From what I’ve read, it seems like vimplugin isn’t so much ‘intergrated’ with Eclipse as much as it lets you launch vim editor instances from Eclipse. However, I haven’t been able to try it yet, so take that description with a grain of salt. UPDATE: I’ve been using this for awhile, and while it’s not vim — not even close — it’s somewhat of a nice in-between — particularly if you’re still making the transition. I can get access to vim delete/search (HUGE)/replace shortcuts by hitting , or I can get pretty much ‘notepad’ behavior in insert mode (cut/copy/paste still follows regular windows-style in this mode). It’s not a bad balance to have. If you want to LEARN vim, this isn’t the way to do it — the way to learn vim is to throw yourself to the wolves and use vim for absolutely everything. If you want to use a little bit of the best from both worlds this isn’t bad. It ‘fixes’ my conceptual problems with vim buffer behavior: as I’m so used to paste being only things I’ve explicitly copied, I still will occasionally have an issue where my previous buffer will be a delete buffer rather than my last yank. With this setup I no longer have to be careful about not deleting anything before I paste. On the other hand, this will only encourage this line of thinking, which I probably need to get over. LATEST UPDATE: I’ve been using this for awhile, and while I love the vi emulation, I cannot recommend it, as it DOES occasionally trash the undo stack. I’m not sure if it’s related to using “CTRL-Z” instead of the vi “u” to undo (which is what I did when I hit the error), but there’s been several complaints about this bug on the author’s site. The author hasn’t been able to replicate it, and thus has not been able to fix it. For me, this meant losing 20/30 minutes of changes. Fortunately, in that particular situation it was not a huge deal, but not having a reliable undo (and thus, potential data loss) is such a major issue that I can’t recommend anyone installs this software until the issue is fixed. I’ll probably be removing this soon and just sucking it up until I can get another workflow going. I look forward to trying out FlashDevelop for my AS3 scripting needs. UPDATE TO THE UPDATE: I’m still using it regardless. Just can’t get enough of those vim key bindings. Tried FlashDevelop and it’s still significantly behind the official Adobe environment in debugging that it doesn’t work for me as I don’t feel I’ve committed enough of the AS3 library to memory to leave behind the extra help and strict debugging notes that Flex Builder provides. Looks like the search for the perfect IDE continues.
Comments (View)
Page 1 of 1
blog comments powered by Disqus