Skip to content

Conversation

@btsai
Copy link
Contributor

@btsai btsai commented Nov 15, 2013

Hi,

I love your plugin! There were a few things that I needed to help make it easier for me to use, so I forked and added them, and I've pushed this out as a pull request to you in case you're interested.

I'm a Rails guy, and I just switched to Sublime a few days ago and have been madly trying to get my head around Python, so please excuse any bad code.

Here's what I have added:

  1. When you rename a file, as you use the autocomplete (love that!!!), if you hit enter without typing the file name, nothing happens. However, in the terminal, if you use 'mv', if you specify a directory as the target, it will move the file to the new directory while keeping the same name, so I replicated that behaviour.

I also updated the status message to reflect this behaviour.

  1. I use git (I assume you do too), and so I found that it would be a heck of a lot easier if your plugin could do the git mv command, if the file was tracked by git.

This behaviour has been added, and will run if it finds (a) git is available and (b) the file is tracked by git.

  1. Since your plugin was turning into my main file manager (all from Sublime), I added the last function I needed - deleting the current file.

I didn't have the time to hook it up to your nice autocomplete functionality, but I would imagine a logical UX would be to open your autocomplete but allow files to be pulled in.

  1. Lastly, I thought it would help if I could see the keys I mapped to your functions either in the Command browser or the main menu, so I added your functions to those.

Thanks for a GREAT plugin,

Brian

@skuroda
Copy link
Contributor

skuroda commented Nov 15, 2013

Glad you enjoy the plugin 😄

Good idea mimicking the behavior of mv.

I don't mind adding in the behavior to do some basic VCS management. However, I'll likely put it behind a togglable setting. Since the plugin seems to be pretty wide spread, I don't want to change the end user experience to much. I'm sure you noticed all the settings I added over time to mimic this.

Funny enough, I wrote some delete functionality for another user recently. Though they were working through context menus. I'm confused by what you mean by what you mean by pulling in files. Are you just referring to being able to specify arbitrary files, beyond the project? If that's the case, I can do some work to integrate it into the auto complete behavior. I wasn't sure how much file system management people were doing with the plugin, so I've just been adding things as there seems to be a demand for it. Guess it's time to do delete (well you did the work for that).

With all that being said, I'll take a look at what you've done. If you find more functionality please create more issues. Of course, pull requests are always welcome. 👍

@btsai
Copy link
Contributor Author

btsai commented Nov 15, 2013

Hiya Scott,

Sorry I wasn't clear about the delete functionality. What I did was tap in to the functionality available from the open view. But I can imagine a use case where you'd want to delete a file without having to open it, so you would open up the file by typing in the path with your path completion in the input window. However, your path completion only does folders, so I would imagine that if you were in delete mode, you'd pull in both folders and files.

Having typed that out now, I realize that actually using Sublime's fuzzy logic to open a file would actually be faster, and then after seeing the file content, deleting it with a keyboard shortcut might actually be faster, so I retract that statement. ;-)

Regarding using settings to toggle whether to git mv or not, if you look at btsai@817b916, you'll see that actually that's what I first did, but thought that the automatic method would probably be better as it's one less configuration to do, and if you're using git, I couldn't imagine a use case where you'd chose 'mv' over 'git mv'.

Anyhow, it's your plugin, and it makes my life easier.

I did my first Sublime plugin for Rails and while battling it out with Python, I just gave in and used Python only as a bridge to Rubyland - performance wasn't really an issue.

Kudos to all of you who do it all in Python - I don't have to time to learn it.

Good work!

Cheers,

Brian

@skuroda
Copy link
Contributor

skuroda commented Nov 15, 2013

Honestly, I started playing with ST plugins to learn a bit of python. It's kind of grown from there. Actually, the logic to display files is already there. Just hidden behind one of the toggles (show_files to be precise). Kind of an edge case, but one of the benefits of being able to specify a file is that it doesn't have to be in a project. Though if that were the case, most people would likely use a UI or terminal to do it.

I appreciate the work you put in. What I think I'll end up doing is first merging your stuff into a dev branch, do a bit of clean up (more personal clean up than your stuff), then merge it into master.

@btsai
Copy link
Contributor Author

btsai commented Nov 15, 2013

No worries. I'll keep an eye for your changes.

Cheers,

Brian

@skuroda
Copy link
Contributor

skuroda commented Nov 21, 2013

I've addressed some of the issues I saw with the git stuff (currently in the dev branch). Though I haven't been able to test it thoroughly, so I won't push it out to master yet. That being said, I am working on a bunch of the clean up (really I'm rebuilding the plugin as the plugin has grown more than I expected). I likely won't push the changes out to master until I wrap that up. Things have been a bit hectic for me lately, but I'll try to get everything pushed out soon.

@btsai
Copy link
Contributor Author

btsai commented Nov 22, 2013

thanks for adding in the stuff i couldn't do, like the windows compatibility. i look forward to your release sometime in the future!

@skuroda
Copy link
Contributor

skuroda commented Nov 25, 2013

Still need to do a bit more testing, but if you would like to checkout what I've done, take a look at the refactor branch. If you do decide to try it, let me know if you run into any issues. I decided to remove the Main menu entries (as well as the default side bar context menu entries). However, I've included information on how to set this up yourself here.

@btsai
Copy link
Contributor Author

btsai commented Nov 27, 2013

no worries about the menus - i added them into my user package.
however, move file seems to have hit a bug:

Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 526, in run_ return self.run() File "/Users/btsai/Library/Application Support/Sublime Text 3/Packages/AdvancedNewFile/advanced_new_file/commands/move_file_command.py", line 24, in run self.show_filename_input(path if len(path) > 0 else self.generate_initial_path()) TypeError: generate_initial_path() missing 1 required positional argument: 'initial_path' 

looks like you need to change line 40 of command_base.py from:
def generate_initial_path(self, initial_path):
to
def generate_initial_path(self, initial_path = None):

@btsai
Copy link
Contributor Author

btsai commented Nov 27, 2013

btw, that's a serious refactor.

i think your docs will need to be updated also when you release this branch.

looking at your code, i'm guessing that i needed to add the following setting to get git mv to work.
"vcs_management": true,

after doing this, i confirm that git files are moved with git, non-git files are moved with unix mv. same with delete file.

thanks!

@skuroda
Copy link
Contributor

skuroda commented Nov 27, 2013

Thanks for looking it over. Yup, I need to do some documentation updates. Hopefully, aside from removing/adding a few settings, most the functionality itself remained the same. Yup took to long to track down some issues with the initial pull request (mostly because things were more ugly than they currently are). But now it's easier to see how to hook into the input panel stuff (rather than the if...else stuff I was doing before).

@btsai
Copy link
Contributor Author

btsai commented Dec 2, 2013

hi scott,

totally different issue/question, quite specific to sublime, but i was wondering if you know how to force reloading of sublime-completions files.

right now, you have to quit and then restart sublime in order to see any changes to sublime-completions files reflected in the autocomplete.

i posted something on the sublime forum but only 18 views, no replies:
http://www.sublimetext.com/forum/viewtopic.php?f=3&t=14789&sid=fcb45b7bfd899cdb472f195dc9d4a643

cheers,

brian

@btsai
Copy link
Contributor Author

btsai commented Dec 2, 2013

sorry, i couldn't figure out how to contact you in any other way.

cheers

@skuroda
Copy link
Contributor

skuroda commented Dec 16, 2013

Hey Brian, just thought I'd give you an update. First, I apologize for taking so long. As you saw, a lot of the work was finished a while ago. I'm going to do some testing in ST2, then I'll be ready to push (hopefully this week). Anyways, thanks for your patience and all the work you put in!

@btsai
Copy link
Contributor Author

btsai commented Dec 16, 2013

Hi Scott,

No need for apologies ! I'm using a clone from github, but will be happy to try out through the package plugin when it's ready and give it a test.

I'm sure the whole community appreciates your efforts.

Btw, I was looking for something to allow me to use the keyboard to go to a file location found in the the find-in-files, and bumped into your gist for FindInFilesGoto and tweaked it for my needs. Thanks there too!

Thanks again.
.
Brian

@skuroda
Copy link
Contributor

skuroda commented Dec 22, 2013

Hi Brian,

I've pushed everything (finally) to the master branch! Thanks for the initial work on everything!

@skuroda skuroda closed this Dec 22, 2013
@btsai
Copy link
Contributor Author

btsai commented Dec 22, 2013

looking forward to trying it out!!

best,

brian

@btsai
Copy link
Contributor Author

btsai commented Dec 25, 2013

scott,

merry xmas. i have confirmed that create, move, delete are all working, including files in or out of git.
so far no bugs.

cheers,

brian

@btsai
Copy link
Contributor Author

btsai commented Dec 26, 2013

one nice-to-have tweak would be to automatically add on the file's extension to the rename function, if it's not specified, so that:
house.rb, enter 'houses' => houses.rb
house.rb, enter 'house.yml' => house.yml
house, enter 'home' => home

@skuroda
Copy link
Contributor

skuroda commented Dec 26, 2013

Created #71 if you would like to watch the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants