Skip to content
sagold edited this page Nov 26, 2014 · 2 revisions

In addition to automatic filepath suggestions, keybindings may be set to trigger filepath completions, independent of the current scope. While scope rules will be applied

  • the type of the requested path (relative, absolute) may be set explicitly
  • the replacements in replace_on_insert may be overriden
  • the base directory for path resolution may be adjusted by base_directory and
  • extensions are adjusted by extensions

In Sublime Text | Preferences | KeyBinding - User or
Sublime Text | Preferences | Package Settings | FuzzyFilePath | KeyBinding - Default add an object like

{
	"keys": ["ctrl+alt+i"],
	"command": "insert_path"
}

This will trigger filepath suggestions on ctrl+alt+i, with the current scope rules defined in settings. To override the type of the path add an arguments object like:

{
	"keys": ["ctrl+alt+i"],
	"command": "insert_path",
	"args": {
	    "type": "relative"
	}
}

To override replacements set

{
    "keys": ["ctrl+shift+space"],
    "command": "insert_path",
    "args": {
        "replace_on_insert": [
        	["^[\\.\\./]*/bower_components/", ""]
        ]
    }
}

Examples

See Sublime Text | Preferences | Package Settings | FuzzyFilePath | KeyBinding - Default for an up to date version

[
    {
        "keys": ["ctrl+alt+space"],
        "command": "insert_path",
        "args": {
            "type": "relative",
            "base_directory": "dev/src",
            "extensions": ["css", "sass", "less", "png", "gif", "jpg", "svg"]
        }
    },
    {
        "keys": ["ctrl+shift+space"],
        "command": "insert_path",
        "args": {
            "type": "absolute",
            "replace_on_insert": [
            	["^[\\.\\./]*/bower_components/", ""]
            ]
        }
    }
]
Clone this wiki locally