Vim icon indicating copy to clipboard operation
Vim copied to clipboard

[Feature-request] ex-mode goto line

Open sethwoodworth opened this issue 12 years ago • 4 comments

: enters vim-like ex-mode. In Vim, :32 would jump to line 32. How would I go about adding this as a command function?

Or would this interfere with the behavior of cmd+l which takes a second argument after cmd+l?

sethwoodworth avatar Jan 14 '14 19:01 sethwoodworth

I agree that :32 should be supported. In the meanwhile, you can use 32G or 32gg to do the same. I actually prefer it.

jiripospisil avatar Jan 14 '14 20:01 jiripospisil

+1 for this

Morgawr avatar Jan 29 '14 16:01 Morgawr

This functionality is available in CodeMirror, LightTable's editor. Try for yourself in this demo. However, LT's current ex-mode only autocompletes to vim LT commands and only processes LT commands.

The latter could be remedied with an ltexec that delegates unknown commands back to CodeMirror:

  (ex-command {:name "ltexec"
               :func (fn [cm info]
                       (let [command (-> (.-args info) first keyword)
                              ex-args (next (.-args info))]
                         (if (cmd/by-id command)
                           (apply cmd/exec! command  ex-args)
                           (when-let [ed (pool/last-active)]
                             (js/CodeMirror.Vim.handleEx (editor/->cm-ed ed)
                                                                            (clojure.string/join " " ex-args))))})

However, the UI would also have to allow this which it currently doesn't.

Alternatively, we could opt for an optional way to disable LT's ex-command UI but I've tried that and LT still causes CodeMirror's showPrompt to get thrown as an alert box.

I'd love to see the latter solution, appearing the same as the above demo.

@ibdknox Any thoughts?

cldwalker avatar Feb 23 '14 22:02 cldwalker

After thinking about this more, I'm happy with 32G. We don't have enough bandwidth to tackle this but if anyone is passionate about this, happy to discuss a pull request.

cldwalker avatar Oct 11 '14 14:10 cldwalker