Sublime Forum

FuzzyFileNav Plugin (on package control...finally)

#13

Another question for you (well about your plugin this time :smiley: ). I was curious to why you chose to implement the more MS-DOS style auto completes (where you cycle though the options) rather than the more Unix (or at least what I have experienced) auto completes (where tab fills in the longest prefix). Again, if you don’t feel like answering, that’s fine, I was just curious.

Thanks.

0 Likes

#14

[quote=“quodlibet”]
Thanks for keeping it mind. You had asked that I don’t pester you about this until an official release. So, here I am!

In other news . . . I have gotten so used to FuzzyNav – and I spend so much time in Sublime – that I am only aware of it when I’m in Excel or something and I hit Ctrl+O, Ctrl+B, db and stare at my screen wondering why I am not looking at the contents of my Dropbox folder. In case it’s not clear, this is a compliment.

Alex[/quote]

I appreciate the kind words.

Oh, and “save as” functionality is in :smile:. Just open the Fuzzy File Nav Panel as usual and type in a file name and press ctrl+s or super+s for Mac, and it will save your file as the name you entered. You will be prompted to approve overwrites. I am not responsible if you file explodes into a million tiny pieces…but it should work based on the little testing I did :wink:.

[quote=“skuroda”]Another question for you (well about your plugin this time :smiley: ). I was curious to why you chose to implement the more MS-DOS style auto completes (where you cycle though the options) rather than the more Unix (or at least what I have experienced) auto completes (where tab fills in the longest prefix). Again, if you don’t feel like answering, that’s fine, I was just curious.

Thanks.[/quote]

Honestly, some times I feel like MS-DOS, sometimes I don’t. I guess I was feeling MS-DOS. I can do either way…I want to say I started with UNIX style (or close to), but people didn’t quite like it. I use MS-DOS at work, and UNIX at home, so they all bleed together for me.

0 Likes

#15

That was my guess, but thought, hmm maybe there’s some deep philosophical reason that I don’t yet understand. Also, the windows key binding for save is set to “super+s” (which works too) rather than “ctrl+s” like I think you meant.

0 Likes

#16

Thanks, I was working on a Mac at home…like I said it all blurs together sometimes. I fixed the windows and linux keybinding for saving.

I go back and forth sometimes on which path completion style I like better. Maybe I will add back UNIX style and make it an option if enough people care. I can go either way with path completions.

0 Likes

#17

No problem. I agree I have to switch back and forth between the two systems, so it’s not a huge deal. That being said, I’ve added the Unix style auto complete for me. I think I prefer because I can actually see the files that match the pattern. Where as, for example, the AdvancedNewFile plugin you can’t so the Windows style works fine.

So this isn’t quite worth making a pull request either, but I found another bug for you. I believe you WIN_DRIVE regex should be
[pre=#272822]WIN_DRIVE =* r*"(^A-Za-z]{1}:\)"[/pre]

The missing “\” from the group causes the issue. Granted I only tested it when “back_to_root” is called, so you may want to double check it doesn’t break anything else. The problem is the group returns something like “C:” which isn’t resolved as a path on windows. So, when I type “/” in the quick panel, and it took me to the sublime packages directory rather than the root.

0 Likes

#18

[quote=“skuroda”]No problem. I agree I have to switch back and forth between the two systems, so it’s not a huge deal. That being said, I’ve added the Unix style auto complete for me. I think I prefer because I can actually see the files that match the pattern. Where as, for example, the AdvancedNewFile plugin you can’t so the Windows style works fine.

So this isn’t quite worth making a pull request either, but I found another bug for you. I believe you WIN_DRIVE regex should be
[pre=#272822]WIN_DRIVE =* r*"(^A-Za-z]{1}:\)"[/pre]

The missing “\” from the group causes the issue. Granted I only tested it when “back_to_root” is called, so you may want to double check it doesn’t break anything else. The problem is the group returns something like “C:” which isn’t resolved as a path on windows. So, when I type “/” in the quick panel, and it took me to the sublime packages directory rather than the root.[/quote]

I am not sure I understand. You have an issue going back to root after you made changes to the code or before? I use the slash to go back to root of drive on windows quite often, so I am not sure if you are describing an issue that is brought on by changes you made or that are inherent in the code. I will check again tomorrow on windows, but as far as I know, no issues exists with going to root of drive on windows.

0 Likes

#19

So I just did a clean install of the plugin and I still have the issue. Out of curiousity, when you go to the root at work, do you type something like “C:/” or “/”? I’m seeing the incorrect behavior when I do “/”. This machine only has 1 drive, so I have no reason to explicitly choose the drive (also kind of the back and forth between linux and windows). Hopefully you can reproduce it…or there’s just something really odd on my machine (which I suppose is possible too).

So all I’ve added to the code are those two print statements that I boxed in the image (did a clone and diffed to make sure).
(http://i.imgur.com/ogcA2.png)

0 Likes

#20

I will check tomorrow. I am not saying there isn’t a bug, just that I would be surprised. FuzzyFileNav has actually been used by people for months now (it just recently went on Package Control though), so I imagine I would have gotten a bug filed by now for something like this, but you never know.I will double check my system on windows tomorrow and let you know what I find.

I just want to illustrate that the missing slash was intentional and gets added back later. You can see here the get_drive function returns them without slash on purpose. The algorithm expects drives to not have the slash. Hopefully we can get to the bottom of this though.
[pre=#2D2D2D]def get_drives():
# Search through valid drive names and see if they exist.
return unicode(d + “:”) for d in “ABCDEFGHIJKLMNOPQRSTUVWXYZ” if path.exists(d + “:”)][/pre]

0 Likes

#21

I figured it was something like that, as you are very consistent in that regard. I’ve done a quick trace of the methods (because I’m curious too and giving you the most information will probably make the bug, if it exists, easier to fix).

I think the path getting passed to get_files(), well initially the “fuzzy_file_nav” command, is “C:”. os.listdir() is then called on this, which is where things don’t happen like one would expect. When you enter “C:” as the path, the “start” variable already contains the slash (“C:”)

Well with that, I don’t think there is any more information I can think of off the top of my head to help reproduce the issue. I’ll check back tomorrow though, so let me know if there’s anything I can clarify.

0 Likes

#22

There is something wrong. I want to say this is new. Slash took me to the Windows System32 folder which makes no sense.

0 Likes

#23

My notes say slash should show all drives not the root of the drive. You were correct in your assessment that I access the root of the drive via (c:\ or c:/ not / or ); I didn’t realize that :smile:.

I should have a fix soon.

0 Likes

#24

Never mind, it was only supposed to show all drives when the root drive could not be found. I updated the branch to fix this issue. It should now accept / or \ like the windows cmd prompt does. Thanks for reporting this issue @skuroda. get_drives was a different part of the code that generates drives right before I append slashes to all folders/drives. FuzzyFileNav should of accepted the drive with the slash not without.

0 Likes

#25

Nix style path complete is in. To get true nix style path complete, also enable case-sensitivity…but if you are on windows, probably leave that out.

It still isn’t quite there. It only matches a file when only one file matches instead of updating the string with the max shared chars. I will add that later.

0 Likes

#26

Okay, full nix path completion is now in. I have to get some real work done, so that is it for now. Report bugs here, or issue pull requests.

0 Likes

#27

Glad you could reproduce the bug. Also, wow that was faster than I expected. Guess I don’t have to use my hack-y implementation of nix file completion. Thanks for the update. Have fun with your real work! :smiley:

0 Likes

#28

Unix/Linux case_sensitive setting has been removed. If you set the new setting nix_style_path_complete to true the auto-complete will use case sensitivity since this method of auto-complete will not work reliably with insensitive case. And if you use the windows method of auto-complete by setting nix_style_path_complete to false, Linux/Unix will use case insensitive (since you can just tab through the actual files, case sensitivity is a non issue here). This makes it less confusing in the settings file, and more reliable when using.

0 Likes

#29

Hi facelessuser, thank you for your great plugin :smiley: btw, how can I open a folder in nav panel ? (I mean select folder and its content is displayed on the sidebar, I want to add that folder to Project ^^ )

0 Likes

#30

Currently it only does copy, cut, paste, delete, create files and folders. It also can do a “save as” operation on files.

Adding a folder to a project could be added, but Jon has not really provided a reasonable way to access the project file via the ST2 API. You have do some really odd things just to find the project file. I did a little of this in my “Favorite Files” plugin just to locate where the project file was stored so I could store a project specific settings file with the project file…it was ridiculous… That doesn’t even account for adding folders to a project file that does not exist on disk yet. For me to add support for adding the folder to a project, Jon really needs to expose that access in the API first. It is just a big headache to add it with the current API.

0 Likes

#31

Out of curiosity, is this why FuzzyFileNav seems to open a project file as text rather than as a project? I’ve noticed that that’s something my machine does a lot and at seeming random, so it’d be great if there were a way to coerce the plugin to load a complete project when it encountered one. It works so beautifully that I give a tiny, pained little groan every time I find myself back in an OS X file navigation panel.

0 Likes

#32

[quote=“phyllisstein”]

Out of curiosity, is this why FuzzyFileNav seems to open a project file as text rather than as a project? I’ve noticed that that’s something my machine does a lot and at seeming random, so it’d be great if there were a way to coerce the plugin to load a complete project when it encountered one. It works so beautifully that I give a tiny, pained little groan every time I find myself back in an OS X file navigation panel.[/quote]

FuzzyFileNav just sends the file to the ST2 “open file” API command. ST2 always chooses to open project files as text opposed to opening them as actual projects. I haven’t looked into whether there is a way via the API to open a project as a project if you know where the project file is…I may take a look into it, but I won’t promise anything.

0 Likes