ex-mode package

December 13, 2018 ยท View on GitHub

ex-mode for Atom's vim-mode

Use

Install both vim-mode-plus (or the deprecated vim-mode) and ex-mode. Type : in command mode. Enter w or write.

Extend

Use the service to register commands, from your own package, or straight from init.coffee:

# in Atom's init.coffee
atom.packages.onDidActivatePackage (pack) ->
  if pack.name == 'ex-mode'
    Ex = pack.mainModule.provideEx()
    Ex.registerCommand 'z', -> console.log("Zzzzzz...")

You can also add aliases:

atom.packages.onDidActivatePackage (pack) ->
  if pack.name == 'ex-mode'
    Ex = pack.mainModule.provideEx()
    Ex.registerAlias 'WQ', 'wq'
    Ex.registerAlias 'Wq', 'wq'

Existing commands

This is the baseline list of commands supported in ex-mode.

CommandOperation
q/quit/tabc/tabcloseClose active tab
qall/quitallClose all tabs
tabe/tabedit/tabnewOpen new tab
e/edit/tabe/tabedit/tabnew <file>Edit given file
tabn/tabnextGo to next tab
tabp/tabpreviousGo to previous tab
tabo/tabonlyClose other tabs
w/writeSave active tab
w/write/saveas <file>Save as
wall/waSave all tabs
sp/splitSplit window
sp/split <file>Open file in split window
s/substituteSubstitute regular expression in active line
vsp/vsplitVertical split window
vsp/vsplit <file>Open file in vertical split window
deleteCut active line
yankCopy active line
set <options>Set options
sortSort all lines in file
sort <line range>Sort lines in line range

See lib/ex.coffee for the implementations of these commands. Contributions are very welcome!

Status

Groundwork is done. More ex commands are easy to add and will be coming as time permits and contributions come in.

License

MIT