Sublime Forum

Fuzzy filesystem find?

#41

[quote=“C0D312”]
@Facelessuser: any reason you went with on_modified rather than on_query_context + keybindings? I feel like the latter offers more potential… One thing I need to figure out: reloading while keeping the contents of the quickpanel input intact. (i.e. opening the quickpanel with initial text)[/quote]

I am not against on_query_context, I am just exploring. Now that I can grab the quick panel view and process it, I may bring in some on_query_context down the road. I think on_query_context is good for things that specifically work well with keystrokes. but things like the mkdir/mkfile feature don’t work well with keystrokes. The home feature works well with either, so currently I am using on_modified until I have a **need **for on_query_context.

on_query_context is more powerful is some ways, but weak in other ways depending on your task. It also adds a more complexity (require a keymap file etc) that I am purposely avoiding until if/when I need to use it.

[quote=“quodlibet”]
Sorry I was unclear here. I understand why it’s faster than the previous few versions, but it feels faster than the very first version, as well. I couldn’t figure out how go back into a gist’s history to test this, though. And it may just be that I’ve built a bit of muscle memory. At first, it was just weird using enter rather than tab for moving through directories. (I.e., for /home/alex/downloads I’m used to typing cd /h<tab>a<tab>dow<tab>.)[/quote]

With what I have discovered recently, using tabs should not be a problem in the future. I am experimenting with giving it a terminal feel.

0 Likes

#42

[quote=“C0D312”]Okay, so I’m close to figuring out the initial_text thing. I’m using on_activated to populate the window. Unfortunately, it crashes sublime…

EDIT: hmmm… the on_activated method is being called 3 times whenever the panel is opened.[/quote]

Yeah, there is some quirkiness I haven’t completely mapped out yet. It took me a bit to get the on_modified/on_activated to work proper with my flags etc. Currently I have it working in a state I only mostly understand. There are a couple of things I had to do that I don’t quite understand. I am just happy it works :wink:.

0 Likes

#43

Well, I suffered through a lot of this stuff when working on the SMART_snippets plugin, so I’ve gotten pretty familiar with handling views, event_listeners, and the like. So I’ve got some ideas…

0 Likes

#44

[quote=“C0D312”]
Well, I suffered through a lot of this stuff when working on the SMART_snippets plugin, so I’ve gotten pretty familiar with handling views, event_listeners, and the like. So I’ve got some ideas…[/quote]

Cool, I will let you know when the repo is up. I look forward to seeing what you cook up :smile:.

0 Likes

#45

Repo is here: github.com/facelessuser/FuzzyFileNav

I changed the how mkdir and mkfile command work. Now you type file/folder name and the type the respective command :mkfile or :mkdir

0 Likes

#46

I have been away from this thread for a while - wow! Thanks for implementing this. Makes navigating the file system mush easier.

0 Likes

#47

Couple of changes on the repo.

Home directory specification has now been moved to a settings file.
Activating home directory now requires “~/” or “~”. This is to avoid triggering home directory if accessing a file with the “~” character at the beginning.

Added option to create commonly navigated folders in a settings file. You can access them by using the “/" or "” trigger.

I think that is it for now.

0 Likes

#48

-Fix “…” where it would sometimes jump back two
-Add “+[slash]” and “-[slash]” command to show all hidden files (regex excluded files) or hide them again respectively.
-Display folder and file accessibility error message in status bar (error dialog kept quick panel from opening again)
-Display last open folder if file open fails

That is it for today.

0 Likes

#49

Stop pushing out updates. I keep making changes and fixes but you update it before I can share them. :frowning:

In my version, pressing . will show the hidden files, then backspacing will hide them. I also figured out how to repopulate the quickpanel on reload to make it truly dynamic. I like what you did with the favorites but I was thinking about having */ use the glob module to show files within folders (for times when you don’t remember which folder something was it). Just an idea.

0 Likes

#50

Sorry, just had couple of easy things I wanted to knock out today. I should be done for the day though :smile: .

0 Likes

#51

I am kind of shying away from the “.” notation. For one, the exclude regex can hide anything, so if you don’t hide “.” files, using “.” is completely valid. Also, though I favor Unix/Linux systems, this is meant to work on windows as well where “.” does not have the same significance it does in Unix/Linux for hidden items. Currently, I don’t detect if Window’s files are hidden, but down the road I might.

I am interested to see what you mean here.

Know of the shortcuts are set it stone right now. If there is a logical shift to change the shortcuts, I will. Since this is not formally released, I am changing things even if they are dramatic if I think it will help the plugin. Not sure what your application using glob is, but if you come up with a good application of it, do share.

I have a habit of touching a plugin when in alpha/beta development a lot. Once things become stable, I don’t touch them much at all.

0 Likes

#52

[quote=“facelessuser”]

I am kind of shying away from the “.” notation. For one, the exclude regex can hide anything, so if you don’t hide “.” files, using “.” is completely valid. Also, though I favor Unix/Linux systems, this is meant to work on windows as well where “.” does not have the same significance it does in Unix/Linux for hidden items. Currently, I don’t detect if Window’s files are hidden, but down the road I might.[/quote]

Just a couple quick notes (I’m at work):

Because showing or hidden the excluded files is a toggle, it makes more sense to have one keybinding, rather than two (as is the case at the moment). I also rather like using “.” to narrow down the results to files only (assuming they all have an extension and you don’t use dots inside the filename, which happens to be the case with my systems).

Speaking of the regex, I don’t know what the plan is, but for my uses, I just copied the exclusion filter I use to all commands and bookmarks – which would add some overhead, if I decided to change it. Maybe it would be a good idea to enable a “default” exclusion filter, which can then be overridden at the command/bookmark level when necessary.

Thanks again for your amazing work.

Alex

0 Likes

#53

I may make it an actual shortcut that can be configurable. Like maybe “ctrl+.” or something like that. It just doesn’t make sense in windows, windows hides the files completely different, so having the first dot trigger hidden toggle in windows would just be confusing (even if it makes perfect sense in Unix/Linux). But if it was bound like a shortcut with a modifier, I think it would make more sense.

I have been thinking about making the exclude regex global as well.

0 Likes

#54

I figured I’d share my version so you could see what I’ve been working on. github.com/BoundInCode/FuzzyFileNav

I haven’t added the favorites yet since I’ve changed a lot internally, too much to just merge the changes. I added an initial_text arg to the nav command. Regex_exclude is a global variable. Plenty of other things as well.

0 Likes

#55

[quote=“C0D312”]I figured I’d share my version so you could see what I’ve been working on. github.com/BoundInCode/FuzzyFileNav

I haven’t added the favorites yet since I’ve changed a lot internally, too much to just merge the changes. I added an initial_text arg to the nav command. Regex_exclude is a global variable. Plenty of other things as well.[/quote]

I will parse through your code and play around with it. I will see what I can take from it. The root idea vs home is kind of a nice idea. On windows, “” could take you to the root of your current drive which would be different than showing all available drives.

I am still against having “~” as the home target because windows, and even linux some times have files as “~filename.ext” etc. If you want to filter out files that don’t start with “~” the home shortcut will override it. I have used the “~” notation in file names when creating temp files myself. “~” could only be used if it were a shortcut with a modifier I think.

The big problem I have is that I want this plugin to be universal for all OS, not just for 'nix systems, so I will shy away from things that exclusively make since in 'nix and not windows. I have to find something that works common between all OSs. I am trying to account for as many situations up front, so I don’t get a bunch of issues/feature requests after release complaining about the implementation not working for their OS. At home I use Mac, but at work, I have to use Windows, so it is important to me to find something that works intuitively and the same on all systems.

I think you have good ideas and I plan on pulling more of your code. I just need to settle on how I want the user to interface all of this stuff.

0 Likes

#56

Yeah, I understand that you’re trying to keep it cross platform. That’s fine. I was interested in you seeing how I handle the reloading, etc. I changed mine to require “~/” to go home instead of just “~”. I’m still working on finding the best way to hand new files/folders. Currently, typing a name and pressing : will add more completion options. Also, since the “.” is a keybinding, if you want to change it for windows, it’s a quick and easy change.

P.S. Sorry that I don’t comment my code enough.

0 Likes

#57

[quote=“C0D312”]Yeah, I understand that you’re trying to keep it cross platform. That’s fine. I was interested in you seeing how I handle the reloading, etc. I changed mine to require “~/” to go home instead of just “~”. I’m still working on finding the best way to hand new files/folders. Currently, typing a name and pressing : will add more completion options. Also, since the “.” is a keybinding, if you want to change it for windows, it’s a quick and easy change.

P.S. Sorry that I don’t comment my code enough.[/quote]

Cool. I haven’t had time to play with it yet, but I plan to as soon as I have time. I will let you know more after I give it a good run through. Thanks for putting time into this. I think the brainstorming of different ideas will be very beneficial to this.

No biggie with the comments. I don’t usually comment well until later.

0 Likes

#58

Whoops. Ignore my last commit. I had some ugly typos in it that made some very interesting results. Somehow typing in the find window would active the plugin, which was interesting to debug. Anyway, I fixed that. Try creating a new file or folder. The plugin reloads on_modified to display dynamic results. Fun :smile:

There’s still a bug that I haven’t figured out. Somehow in on_modified window() == Nonetype. I’m sure it’s something stupid… Anyway, typing ‘/’ will automatically enter the directory exactly as you typed. So …/ will take you up a dir without pressing enter.

0 Likes

#59

If you can use arbitrary keybindings, then looking for a shortcut that is common, or at least familiar, to some of the OSs Sublime supports would be the ideal way to go. Although in this case there isn’t one that I’m aware of. The Nautilus file manager in Linux uses Ctrl+H (for show/hide “hidden files”); this only what I happen to be used to, but it seems tolerably sane. (Of course, if you want to bind “home” to something other than the tilde, that’s sort of ideal.)

Thank you for this!

I’m still having a couple of issues on my two Windows computers at work. I didn’t have sufficient patience to figure out what is going on, but, roughly:

  • One issue has to with getting to root. (It loops back to where I opened FuzzyNav), which I suspect may have to do with the computers’ network drives (?).
  • The other has to do with setting up relative paths (I run a portable Sublime from Dropbox). Because this also affects projects, I’ll try and figure this out first.

I’m still occasionally taken aback by the fact that nothing happens when I try to run fuzzy_start_from_file from an unsaved file. (I have it bound to Ctrl+O.) A simple and (if I imagine it correctly) acceptable “fix” would be to run fuzzy_bookmarks_load in this case, which would allow you to navigate wherever it is you want to navigate. (And also, “something” would happen.)

I understand that it takes the plugin in a different direction, but a feature I would really like is to be able to save (aside from creating a new file). If I have sufficient understanding, what I am asking for is a command that would allow FuzzyNav to behave roughly like prompt_save_as, and which I can bind to Ctrl+Shift+S, as well as a wrapper to bind to Ctrl+S, which runs the save command if the file already exists, and otherwise opens the previous command.

Oh, also, opening multiple files would be nice. (Ctrl+Enter to open the file and keep the panel open?)

I’ll stop now. I think I have made sufficient demands for one day. Many thanks again!

Alex

0 Likes

#60

Tough to say yet what I will do, but these are good suggestions.

[quote]

Thank you for this![/quote]

Not a problem. I was a little sloppy, but at this stage, that is to be expected.

[quote]I’m still having a couple of issues on my two Windows computers at work. I didn’t have sufficient patience to figure out what is going on, but, roughly:

  • One issue has to with getting to root. (It loops back to where I opened FuzzyNav), which I suspect may have to do with the computers’ network drives (?).
  • The other has to do with setting up relative paths (I run a portable Sublime from Dropbox). Because this also affects projects, I’ll try and figure this out first.[/quote]

Not sure what to say about the first one yet.
Relative paths seems like something I can probably get a fix in for. I will need to understand exactly what you mean by relative paths, so if you could give me an example, that would be very helpful.

Yeah, I should do something there, just haven’t take the time yet. Bookmarks might be fine (if there are some defined), root would be fairly safe though.

Bring this up again when core functionality is in place. Something like this, I will probably hold off on until the first official release. Once the core stuff is out, I will possibly consider stuff like this.

Hmm…I like this idea :smile:.

As always, I appreciate the feedback. Thanks!

0 Likes