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