Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open directories #823

Open
ijt opened this issue Sep 28, 2017 · 9 comments
Open

Open directories #823

ijt opened this issue Sep 28, 2017 · 9 comments

Comments

@ijt
Copy link

ijt commented Sep 28, 2017

I want to be able to open up a directory in micro like I can in vim.

Description of the problem or steps to reproduce

$ micro .
Cannot read . because it is a directory

Specifications

You can use micro -version to get the commit hash.
Version: 1.3.3-dev.11
Compiled on September 28, 2017

Commit hash: a02ae3c
OS: #119~14.04.1-Ubuntu SMP Wed Sep 13 08:40:48 UTC 2017
Terminal: GNOME terminal

@zyedidia
Copy link
Owner

Related to #461, #249

@ghost
Copy link

ghost commented Oct 18, 2017

I am using the this one:
https://github.com/NicolaiSoeborg/filemanager-plugin

Its great.. But cant work out how to navigate the tree or open files with it..

@sum01
Copy link
Contributor

sum01 commented Nov 2, 2017

@gedw99 Once you open it, by typing tree, use Ctrl+W to switch between windows currently open. From there, you can use arrows as normal on the tree view, or even click it with the mouse.

PS: to anyone reading, the filemanager plugin is great 👍

@ipstone
Copy link

ipstone commented Mar 8, 2018

lf is a great file manager (written in go), if there could be ways to integrate lf with micro, it would be very nice. https://github.com/gokcehan/lf

@s-celles
Copy link

s-celles commented Oct 11, 2018

Integrating a file manager to micro "out-of-the-box" will be a nice enhancement.

Especially when trying to open a directory using micro . NicolaiSoeborg/filemanager-plugin#39

@purplesrl
Copy link

purplesrl commented Mar 26, 2019

Actually I managed to do this in a very easy way, by changing the filemanager-openonstart to true, and by adding the below content in init.lua, the code checks if you specified a file and it will close the new tab if you did not, in this way you will end up just with the file manager opened.

function quitNoName()
    local buf = CurView().Buf
    if buf:GetName() == "No name" then
        CurView():Quit(true)
    end
end

quitNoName()

@jdsimcoe
Copy link

jdsimcoe commented Jun 1, 2020

Hey @purplesrl I've added your above code to my init.lua and when I try to open Micro I get this error:

init:2: attempt to call a non-function object
stack traceback:
	init:2: in function 'quitNoName'
	init:8: in main chunk
	[G]: ?

@jdsimcoe
Copy link

jdsimcoe commented Jun 1, 2020

@ipstone With Micro as your default editor (e.g. export EDITOR='micro'), then using lf to launch directories, combined with the e shortcut to open the file, seems to do the trick. It allows you to quickly open any file, and when closed via Micro, you are still where you left off in lf.

@purplesrl
Copy link

Hey @purplesrl I've added your above code to my init.lua and when I try to open Micro I get this error:

init:2: attempt to call a non-function object
stack traceback:
	init:2: in function 'quitNoName'
	init:8: in main chunk
	[G]: ?

I did not use micro for a while, but it may be that the code of Micro has changed and CurView for example is no longer a function or maybe you have a typo, but my best guess is that I made this for 1.4.x and 2.x no longer support it

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

7 participants