Sublime Forum

AutoFileName (ST2/ST3)

#1

Do you ever find yourself sifting through folders in the sidebar trying to remember what you named that file? Can’t remember if it was a jpg or a png? Maybe you just wish you could type filenames faster. No more.

Whether your making a img tag in html, setting a background image in css, or linking a js file to your html (or whatever else people use filename paths for these days…), you can now autocomplete the filename. Plus it uses the built in autocomplete, so no need to learn another pesky shortcut.

You can download it here: https://github.com/BoundInCode/AutoFileName

Enjoy!


Let me know if you have any bugs or feature requests.

0 Likes

#2

This is pretty awesome and useful, thanks!

0 Likes

#3

if not '.' in d:-4]: d += '/'
for .css .png .jpg .xxx all fine.
for .js .xx .x .xxxx extra [size=120]/[/size] in the end.

0 Likes

#4

in CSS background: url( “path” );

path can be unquoted

0 Likes

#5

[quote=“rmaksim”]

if not '.' in d:-4]: d += '/'
for .css .png .jpg .xxx all fine.
for .js .xx .x .xxxx[/quote]

extra / in the end.

Fixed.

0 Likes

#6

Nope, now it is broken (windows).
Also please consider that css url definition might omit quotes.

0 Likes

#7

[quote=“pod”]Nope, now it is broken (windows).
Also please consider that css url definition might omit quotes.[/quote]

Whoops, removed one bug, added another. I know what happened… I’ll fix shortly.

As for unquoted urls, I’m working on that still.

0 Likes

#8

This is extremely cool.
When you’re done with bug smashing please submit it to Sublime Text 2 Community Packages http://wbond.net/sublime_packages/community site so that people like me can install it easily and more importantly get the updates automatically.
can’t wait to use this one!

0 Likes

#9

background: url("../../../image.gif") | ^-cursor
ERROR in string if filedir_files = os.listdir(this_dir)
small fix

if os.path.isdir(this_dir): dir_files = os.listdir(this_dir) ... else: return ]

0 Likes

#10
elif "./" in view.substr(sublime.Region(sel-3,sel)):

the code works fine withbackground: url(../);
but don’t works withbackground: url(../img/);
small fix:

elif "/" in view.substr(sublime.Region(sel-2,sel)):

What are your thoughts on this?

0 Likes

#11

Instead of using hard coded path separators for Linux/MacOS and Windows, instead use os.path.sep

dir_len = this_file.rfind(os.path.sep)
0 Likes

#12

There are plenty of path manipulation functions in the os.path module http://docs.python.org/release/2.6.7/library/os.path.html?module-os.path
Most of them are OS independent.
os.path.split() is probably what you want.

0 Likes

#13

The plugin is now available through Package Control.

If you would like to submit a fix or new feature, pull requests are welcome: https://github.com/BoundInCode/AutoFileName/pulls

0 Likes

#14

Just released a fixed that should appease the complainers…

0 Likes

#15

Just released a fixed that should appease the complainers…

Thanks, now it looks more stable. As for css, autocomplete still doesn’t work for non-quoted url declaration.

0 Likes

#16

It works fine.
Your last char in path must contain backslash /, and only then press CTRL+SPACE
for example:

background: url(./)
background: url(../)
background: url(img/)
background: url(../img/)
                      |
                      ^-cursor after slash
0 Likes

#17

I installed by package manager and can’t really see anything happening when coding in PHP?

0 Likes

#18

Yes, that is how I was testing it. I’m on windows7x64, sublime b2165, installed from package manager and I still having issues.

0 Likes

#19

Hmm… for those of you who are having issues, could you please open your console (control + ` ) and tell me what appears after you press control + space?

Could you give me a sample of your code to test with? I don’t use PHP and it would be helpful for me to see the problem firsthand. Thanks.

0 Likes

#20

Nothing happens, no errors :frowning:

0 Likes