Giter Club home page Giter Club logo

symfony-goto.nvim's Introduction

symfony-goto.nvim

This plugin adds vim commands to go to different places in a Symfony project.
Here is the list of handled goto:

  • webpack encore entrypoint
  • route action

Get help with:

:help symfony-goto
" or
:help :SymfonyGoto

Setup

require('symfony-goto').setup()

Configuration

This is the full configuration with default values, no need to keep all of them.

require('symfony-goto').setup {
  -- configuration for :SymfonyGotoEncore command
  encore = {
    -- enable or not :SymfonyGotoEncore command
    enable = true,

    -- open the file event if it doesn't exist
    force_open = true,

    -- lua doesn't support regex, see: https://www.lua.org/pil/20.1.html
    -- This is used to replace encore entrypoint with its real path, it depends on webpack.config.js and Encore.addEntry
    -- example: encore_entry_link_tags('css/example') should open file assets/css/entrypoint/example.scss
    css_pattern = "s#^css#assets/css/entrypoint#",
    js_pattern = "s#^js#assets/js/entrypoint#",

    -- assets extension
    css_extension = ".scss",
    js_extension = ".js",
  },
  route = {
    -- enable or not :SymfonyGotoRoute command
    enable = true,

    route_file = "./var/cache/dev/url_generating_routes.php",
  }
}

Commands

Each commands are made to work without depending on the cursor position on the line.

:SymfonyGoto

Calls specific command depending on what's found on the current line.


:SymfonyGotoEncore

Goes to the entrypoint file of the encore statement. The :SymfonyGoto command checks if encore_entry is on the current line to call :SymfonyGotoEncore.
The line should match one of these:

{{ encore_entry_link_tags('css/example') }}
{{ encore_entry_script_tags('js/example') }}

:SymfonyGotoRoute

Goes to the corresponding controller action. The :SymfonyGoto command calls this command if no other handler was matched, as there can be multiple route generation methods.

This command also accepts one argument to go to a route from anywhere:

:SymfonyGotoRoute app_home

Mapping

There is no default mapping, either map each command:

nnoremap <leader>se <cmd>:SymfonyGotoEncore<cr>
nnoremap <leader>sr <cmd>:SymfonyGotoRoute<cr>

Or map the global command once:

nnoremap <leader>s <cmd>:SymfonyGoto<cr>

Todo

  • handle more places:
    • translations
    • form properties
  • composer PSR-4 for controller namespace

symfony-goto.nvim's People

Contributors

thomas-hiron avatar

Stargazers

Daryl Gubler avatar Yuta Katayama avatar

Watchers

 avatar

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.