Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Suggestion: Custom quick panel to create file #150

Open
jacobsvante opened this issue Apr 21, 2016 · 8 comments
Open

Suggestion: Custom quick panel to create file #150

jacobsvante opened this issue Apr 21, 2016 · 8 comments

Comments

@jacobsvante
Copy link

Instead of opening up a bar at the bottom to type your entire directory I imagine that a quick panel is opened up when I press the key binding. In that panel all directories are listed and you can quickly filter it down to the directory you want to place the new file in by just typing a few characters (working the same way as Command+T, except it only lists directories). When pressing Enter a new quick panel comes up where you just enter the name of the file you want to create in that directory, and then press Enter once more to create the file.

Quick panels are among the best feature of Sublime and I was surprised that this wasn't the way it worked in this plugin, I guess I just had this image built up in my head before installing it. My schedule is pretty tight atm so I'm just throwing my idea out there in case someone else has some more time on their hands 😉

An example on how to create a quick panel can be found here: https://forum.sublimetext.com/t/example-of-using-custom-quick-panels-popup-lists/10817

@jacobsvante jacobsvante changed the title Suggestion: Custom palette to select directory to create file in Suggestion: Custom quick panel to create file Apr 21, 2016
@skuroda
Copy link
Collaborator

skuroda commented Apr 21, 2016

Hi @jmagnusson, I agree on the the quick panel being a great feature. A bit busy myself, thus minimal updates to the plugins I own. But sounds like what you want fits in pretty well with https://packagecontrol.io/packages/FuzzyFileNav. I've been using it for a few years now and really like it.

@jacobsvante
Copy link
Author

jacobsvante commented Apr 22, 2016

FuzzyFileNav doesn't seem to recurse directories by default, so it would still require a lot of keypresses to get to a directory a number of levels down the hierarchy. (I've only tried Fuzzy Nav Here... so I might be missing something). What I'm looking for is getting to a directory deep down the hierarchy by just pressing a command, say Cmd-Alt-N, and by just three or four keystrokes I would select the directory in which I want to create the file.

I'll see if I can find some time this weekend to implement a prototype of this.

@skuroda
Copy link
Collaborator

skuroda commented Apr 24, 2016

Ah I understand what you want to do. While doable, I don't know how practical it is. The quick panel works by submitting a list of entries. I'd be concerned about about finding an appropriate match if the entire subdirectory file/structure is put into the list. Maybe there's been an API update in ST3 to make this more feasible that I'm not aware of though.

@jacobsvante
Copy link
Author

jacobsvante commented Apr 26, 2016

That's why you have folder_exclude_patterns and file_exclude_patterns in your Sublime project file. The built-in quick panels become immensely powerful when filtering out folders like node_modules and __pycache__ with this feature.

@skuroda
Copy link
Collaborator

skuroda commented Apr 26, 2016

True, I do know how I'd theoretically implement it. But also keep in mind that the quick switch is limited to the files/folders in the project. Additionally, there may be some additional optimizations ST is doing underneath, with regards to leveraging the c++ core of the application.

I apologize if I mislead you, I didn't mean to imply that it couldn't be done, just that performance should be considered. In your theoretical implementation, where does the quick panel tree start from? Project root? Current directory? Or is it configurable similar to the core plugin itself?

@jacobsvante
Copy link
Author

I've never written a Sublime plugin so I wouldn't know if that would be the case. There's only one way to find out 😀

In my mind it would be the project root, with the quick panel filtered to only show directories (if adding a file).

@skuroda
Copy link
Collaborator

skuroda commented Apr 29, 2016

I've written a couple plugins where I've caused Sublime Text to freeze haha. So now it's just something I try to keep in mind. I do like the idea though. Regardless of the root, I do think it's a fair idea. Fill the quick panel with child directories. Upon enter, auto populate the input panel (or just use as the input directory) so the file name can be specified. Auto populate I think is the easiest given how I've written the plugin, though just using that as contextual information and passing it around seems like a much cleaner visual solution as absolute paths can get rather long.

@jacobsvante
Copy link
Author

It would probably look a lot cleaner to just show an empty input box in the second dialog for the user to enter the filename in. The row beneath would show the full filename as it's being typed and the second line in that row would display Create file and open.... Another row could be added such as Create file and add another in the same directory....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants