SublimeText / AdvancedNewFile

File creation plugin for Sublime Text
MIT License
829 stars 93 forks source link

Rename should by default put the file in same directory #119

Closed akavel closed 2 years ago

akavel commented 9 years ago

I tried the "rename file" functionality, and it strongly surprised me by moving the renamed file to a different directory (the "working folder" directory?). When I want to rename file, by default I want just to rename it, not move. And even if I want to move, I'd most often want to move it "slightly", i.e. relatively to the original directory (e.g. to ../, or some subdir/), not somewhere totally different. One more problem for me now is such, that I don't remember very well what was the exact original directory of the file, and I can't undo, so now I have to go to significant effort to recreate the file in the original place. I'd be very grateful if you could change this behavior more along "the principle of least surprise".

That said, I very much like the idea of the plugin doing git mv automatically (although I haven't verified if it's working OK yet). That's what made me try ANF first from the answers in http://stackoverflow.com/questions/19122581/how-to-rename-a-file-in-sublime-text-3.

skuroda commented 9 years ago

Hmm, I though i had a setting for that but it appears I do now. In the short term, you can set the rename_default setting to :. The colon, by itself aliases to the current directory.

skuroda commented 9 years ago

So it looks like i had a default setting applied to all commands (default_root). I'll go ahead and make a per command one also. A little late for your use case, but you could have reopened the previous tab (cmd+shift+t in os x and ctrl+shift+t in windows). This would have opened an empty file at the previous location, where you could have copy/pasted the contents of the file back in.

skuroda commented 9 years ago

I've pushed an update in 1.5.1. To maintain previous behavior, the default will be default_root. I'd recommend adding

"rename_file_default_root": "current",
"copy_file_default_root": "current"

to the AdvancedNewFile user settings.