Giter VIP home page Giter VIP logo

autofilename's Introduction

AutoFileName: Autocomplete Filenames in Sublime Text

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.

Usage

If you are looking to autocomplete an image path in an HTML <img> tag:

    <img src="../|" />

Pressing ctrl+space, will activate AutoFileName. I list of available files where be ready to select.

Looking for an even more automatic and seemless completion? Add the following to your User Settings file:

"auto_complete_triggers":
[
  {
     "characters": "<",
     "selector": "text.html"
  },
  {
     "characters": "/",
     "selector": "string.quoted.double.html,string.quoted.single.html, source.css"
  }
]

With this, there's no need to worry about pressing ctrl+space, autocompletion with appear upon pressing /.

autofilename's People

Contributors

flyingeek avatar ivanca avatar longhua avatar rcopera avatar titobouzout avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autofilename's Issues

Support for Jade files

I love this plugin, it's amazing, but in my regular work, I use JADE as the template engine, but I couldn't make this work with it.

Please add support for jade or if there's any configuration that I can do in order to work, please let me know.

Regards.

changing scope

How to change scope, to trigger only when cursor is in value field for src or href attributes, not on class, id..?

Default folder (or filetype)

When I start to type a path, it suggests every file on the project, which is not very useful to me, since I'd like only a fast way to create image links.
Can I set up a starting file path, so it would link automatically to for example /assets/img?

thanks

Latest beta?

Is this working in the latest beta? I can't seem to get it to trigger. Does it work inside SASS/HAML?

Always start from project root

First of all, let me tell you that this is an awesome tool and I use it with S3!

However, something is bothering me and I hope that there is an easy fix for it.

I have this in the AFN settings:

"afn_use_project_root": true,
"afn_proj_root": ""

When I hit "/", it always starts from the root of the folder where the file is located.

I want my paths to always be relative to the project root. For example, like this:

/assets/images/image.jpg
/assets/css/styles.css

So, my questions is, how do I make it to always start from the project root, no matter where the files is located in the folder hierarchy of the project?

Thanks!
Alex

Confusing documentation about key shortcut

This part seems weird to me:
"so no need to learn another pesky shortcut"
When following it is this:
"Pressing control+space, will activate AutoFileName"

That is a key shortcut.

Additionally, it felt implied that I should be able to press control+space at ANY time and AutoFileName will provide a list of file suggestions.
This is not the behavior that occurs, instead the only thing working correctly for me is that I get the AutoFileName menu whenever I am editing the "src" attribute in an HTML file, or when I am outputting to a file in a script via ">" or ">>".

It would be nice if "control+space" actually worked, and in any type of file. Sometimes I'm just editing an SH script or a txt file and I want access to this feature, but it's a bit confusing on how I would achieve this menu on any type of file via a key shortcut.

Some people actually find pesky shortcuts useful :)

not working for me in .less files

not sure whether this is a scope problem or an issue with the less package or something in AutoFileName, but i am not seeing completions in .less files. when i look in the console and try to get the scope where i think completions should be happening, it seems a little confusing.

anyway, in a .less file, using the LESS package for ST2 from here, i get no completions inside the following ( | = cursor):

body {
  background-image: url("|");
}

if i change the syntax to css then i get completions in the same selector/position.

one of the confusing things is that looking at the scope selector in the console with the syntax set to LESS, that selector is not seen as a string even though it is inside double-quotes. that's why i am wondering if it might not be a problem with the less package.

EDIT: i raised an issue in the less package repo.

Option to use path from open folders

Hi all,
AutoFilename is an awesome tool! One item that is a bit different in my workflow than how AFN expects is the project root path for inclusion (so prepending '/' doesn't go from the root of your system). I don't normally create Sublime projects, I just drag the folder into sublime and go at my projects that way. Is there a way to configure AFN to grab the '/' path relative to the current open folder structure instead of project? Thanks!

add width/height in css selector?

I'm not sure if it's supposed to work this way, but when the filename is autocompleted I can see the weight/height in the suggestions, would it be possible once an image is chosen to add the height/weight to the selector too?

Miss AutoFileName in Package Control for ST3

AutoFileName is missing in Package Control for ST3.

Installed plugins:
2

Package Control:
1

Yes, I know that you can download a branch ST3, archive it, rename in AutoFileName.sublime-package. But it's terribly inconvenient.

support .less scope

any way that you could add support for .less files? like sass, less is a superset of css.

Unwanted delete behavior when pressing backspace

In a text file, f.e.

A path: C:\Windows\Foo\Bar

go at the end of the line and press backspace. When cursor reaches backslash it selects whole text in a file and next backspace deletes it. I understand that it might be somewhat wanted when autocompleting paths but it's too intrusive as it is.

Hmm, I'm not sure exactly about the repro steps but it triggers when not wanted.

Wrong basepath on Win8

It doesn't refer to the folder of open file but to the root of system drive ("c:").

I have empty afn_proj_root, and enabled afn_use_project_root.

Sometimes instead of root folder it refers to
"C:\ProgramData\Microsoft\Windows\Start Menu\Programs"

  • Sublime Text 2 shortcut location.

CSS Compiler

Hi,

when writing css I'm often using SASS with compass. Usually the .sass-files are not in the same folder as the compiled css files. This causes AutoFileName to be completely useless, because the filepaths are wrong. When using compass there's a compass.rb file that keeps the path to the generated css files:

css_dir = "public/css"
sass_dir = "sass"

You think it's somehow possible to check the project for a config rb and somehow use the correct path in .sass-files?

Thanks for your trouble and kind regards
Marc

afn_insert_dimensions and afn_use_keybinding settings not working

On ST3 with Package Control installation, I am unable to set these settings.

"afn_insert_dimensions": false

does nothing;

"afn_use_keybinding": true

works but when you hit tab to select the image, it will move focus to the image "alt" proprety and AutoFileName is automatically activated again and I have to hit ESC.

Switch between "/" and "\"

Windows uses backslashes "" for file paths. While CSS or HTML only use the slash version I often want to specify the exact path on my machine (not necessarily in one of these languages). I can use this to open the path directly with another plugin for example, or to copy and paste ist somewhere.
Would be nice if you could detect whether "/" or "" was used and base any following path separator on that.

As a side not, Python (I think; or ST2) uses file paths in a style like /C/path/to/file.ext. Would be nice if that triggered the autocompletition too.

Sublime Text 3 Support

I like your plugin and I use it regularly, when do you plan on supporting Sublime Text 3 ?

Changing trigger

Hi,

Is there a way to change the trigger of AutoFileName? (My Command-space is mapped to an important shortcut in OSX). I didn't see a way to do it in the Default settings, but I'm new to Sublime.

Autocomplete not working correctly for relative paths

I'm using ST3 (various builds) and have seen this behavior on both WinXP and OS X. If I want to enter a full path (with a / at the beginning) each directory is autocompleted properly, just as intended (click for full-size version):
full path
Note how only one directory appears in the popup box at a time.

However, if I try to enter a relative path, and hit Tab after picking the first directory, the full path (with the choices for the next subdirectory) are listed, including the first directory:
relative path

If I then hit Tab again, the first directory is duplicated, resulting in an incorrect path.

Since it's already working correctly in one context, hopefully this won't be too difficult to fix.

Thanks!

Override Sublime Default AutoComplete

When I press quote in a ruby file currently, AutoFileName wil give me a lot of file names, and then I can't see any options given by Sublime Default AutoComplete, which is more frequently needed by me.

Settings not read from user preferences

Main.sublime-menu defines two pref files - one for default settings and one for user settings. The problem is that the plugin always seems to read from default settings.

I would obviously prefer to store my overrides in the user settings so that they are not overridden on update.

option to not append "/" for directories

when using this plugin to dig into subdirs to find an image file, i find that i am putting the cursor inside the " ", then hitting the "/" key to trigger auto-completion, then when i choose a directory from the completion list, in order to trigger completions for the contents of that directory, i either have to hit ctrl-space or backspace over the "/" and then re-type "/". both of those things slow me down.

it would be really cool if there was a way to see the trailing "/" on the directory name in the completion list, but have an option to insert the directory name WITHOUT the trailing "/" when you do the completion so that you can just keeping typing "/" after each insertion to keep triggering the next auto-complete list.

i have never found any documentation for the auto completions api, but i did read here that there is a way to put one thing into the completion list but insert something else when the completion is done.

constructing path bug in beta branch

cool on all the new changes! that was quick.

i just started playing with the new beta and found one issue:

great how the completions list shows the trailing slash for directories but then doesn't include it when you do the completion now. however, when i type the next slash (e.g. "/img/") the completions i get are once again at the root of the project directory instead of being the completions for what's inside the "img" directory.

Overrides default auto completion

When using this plugin it seems to override the default auto completion. For example, when typing <div class=" it will bring up the file name completion, rather than previous class names.

I'm not sure if I'm doing anything wrong, but my set up is pretty much the standard Sublime Text 2 install on Mac with a few plug-ins.

Cheers

Using in markdown files inside HTML-like @import statements

I know it's a rare use case, but I use <!-- @import path/to/file.md --> statements inside markdown files to imitate includes. Is it possible to force AutoFileName to show completions within these statements? I tried to add "markdown" and "comment" to afn_valid_scopes user setting, but this only helped to get completions in markdown images (like ![pic title](../img/pic.png)), but not inside @import statements in the same file.

Thanks!

ignored first "/"

Hi. Sorry, i don't speak english, but i try describe in use 'Google Translate'.

in my project, I use absolute paths "/", example:
background-image: url("/images/bg/bg-pattern.png");

But if I start with the character "/" AutoFileName shows the absolute path of my system, example:

background-image: url("/|
                        root/
                        lib32/
                        usr/
                        bin/
                        media/
                        etc...

how to make that AutoFileName optionally ignore the first "/"?
example:
in autofilename.sublime-settings
{
"ignore_first_slash": true
}
and AutoFileName ignored first "/"

Again, sorry for my english.
Thanks.

Conflict with Derby auto-completion

This package seems to conflict with the auto-completion from the Derby package for Bourbon auto-completion. When I unistall this package, Derby seems to work fine.

Could you please look into this because I think both packages are awesome! Thanks!

Sometimes, I don't want the image height and width added in an image tag

I love this plug-in - thank you for working on it.

Sometimes, I don't want the image height and width attributes added to an image tag. For example, when I'm working on a responsive build and I want the image dimensions to be handled by CSS. I agree that doing so should be the default setting, but I wish that there was a preference I could set to enable or disable this behavior.

Image dimensions are not updated when the image path is updated

Hi there,
I really love this plugin! Just wanted to report an issue I've stumbled upon while using it.

When you use the plugin to insert an image, it puts the dimensions correctly as attributes.

Then, if you update the image with a new one (again, using AutoFileName), the dimensions are not updated even though the new image has different dimensions.

I think updating the dimensions every time you select a new image is the correct behavior.

Any thoughts?

ST3: afn_proj_root not working

With the following settings:

"afn_use_project_root": true,
"afn_proj_root": "/"

I load my project but I sill get my boot drive root when typing / on a path. It should start from my project root, no?

Tested on ST3, Mac OS X 10.7.5.

Can't autocomplete for files in subfolder

Filename autocompletion is a neat feature, but is it possible to autocomplete filenames from a subfolder?
I'd like to use this plugin with LaTeX, where I have code like \includegraphics[]{figs/someIllustration.pdf}, and autocompleting figure name would be awesome.
Tried putting this in my settings file (the scope of the curly braces is meta.group.braces.tex):

"auto_complete_triggers":
    [
      {
         "characters": "figs/",
         "selector": "meta.group.braces.tex"
      },
      {
         "characters": "/",
         "selector": "meta.group.braces.tex"
      }
    ]

User Package Settings Open Wrong File

In Windows on ST2, go to Preferences > Package Settings > AutoFileName > Settings - User

It will open ./Packages/User/Preferences.sublime-settings instead of ./Packages/User/autofilename.sublime-settings

Wrong width/height for jpg ( ST3 )

HTML:
1

when you choose any jpeg, you get:

<img src="images/bg_header.jpg" height="-1" width="-1" alt="">

CSS:
2

For css show width/height may not be important but it is very convenient, you can see from ST what size image.

Custom options

Amazing tool.
It could be even more useful if we could:

  1. choose a default file path such as: /assets/images
  2. option to only get the file name (without the path) โ†’ useful when using with other tools for example that insert the paths automatically on compile (such as Mixture or Hammer)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.