lloeki / ex-mode

Ex mode for Atom
MIT License
169 stars 59 forks source link

:Lex support for the tree view? #189

Closed i5ar closed 7 years ago

i5ar commented 7 years ago

Is it possible to map :Lex to Ctrl+\ so we can toggle the tree view in a vim fashion?

The :Lex command was introduced in vim 8.0:

:[N]Lexplore [dir] toggles a full height Explorer window on the left hand side of the current tab. It will open a netrw window on the current directory if [dir] is omitted; a :Lexplore [dir] will show the specified directory in the left-hand side browser display no matter from which window the command is issued.

Basically :Lex toggles a tree view.

Thanks!

hultberg commented 7 years ago

Indeed we can. You can add the following code to your init.coffee file, and voilá, you have :Lex mapped to toggle tree-view.

# in Atom's init.coffee
atom.packages.onDidActivatePackage (pack) ->
  if pack.name == 'ex-mode'
    Ex = pack.mainModule.provideEx()
    Ex.registerCommand 'Lex', -> atom.commands.dispatch(document.querySelector('atom-workspace'), 'tree-view:toggle')