0

I am trying to use the autofilename plugin, but for some reason it replaces me or incorrectly corrects the file path, I think I know that it is because of the options that automatically appear as references when the cursor is inside single or double quotes by example:

enter image description here

As you can see, several options that do not exist such as directory or file names are shown, those names are mostly names that exist in class and id, among other things.

So how can it be avoided that only when the cursor is inside single or double quotes that these options do not appear.

As I mentioned I am trying to use the autofilename plugin but it automatically deletes or corrects me wrong data, I am using sublime text 4113

MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • The problem with this is that you'll no longer have autocomplete for `id` and `class` strings. Do you really want to do that? There isn't a way just to do it for `src` strings. – MattDMo Aug 14 '21 at 15:12
  • @MattDMo It would really be better as you indicate, what happens is that it should only search and give these options: https://forum.sublimetext.com/uploads/default/optimized/3X/f/e/fe9157216b6daffda6b804201c5ca369cbfa8ac3_2_966x748.png and, not the other thing that has nothing to do with linking files or images. –  Aug 14 '21 at 15:51
  • @MattDMo Although there are also other parameters, for example the include of php that is still called a file by means of a path that goes between quotes and, we also have the background images url (). How could it be done? –  Aug 14 '21 at 15:53

1 Answers1

0

Probably the easiest way to do this is by assigning a custom key mapping to the filename autocomplete function. First, select Preferences → Key Bindings and add the following, ensuring that they are inside the outer [ ] characters (the file has to be valid JSON):

    { 
        "keys": ["ctrl+super+alt+a"], 
        "command": "afn_show_filenames",
        "context":
        [
            { 
                "key": "afn_use_keybinding", 
                "operator": "equal", 
                "operand": true 
            }
        ]
    },

You can change the key combo to whatever you wish, just make sure it's not overwriting another Sublime or operating system key binding.

Next, open Preferences → Package Settings → AutoFileName → Settings—User and add the following line:

"afn_use_keybinding": true,

Now, to open the filename autocomplete, simply press CtrlWinAltA (on Windows and Linux) or CtrlAltA (on OSX/macOS).

MattDMo
  • 100,794
  • 21
  • 241
  • 231