| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e5935ac commit 16b25ba
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | --- | |
| 2 | 2 | layout: post | |
| 3 | - title: "Composer knows the path of class file" | ||
| 4 | - date: 2015-06-03 23:00:00 | ||
| 3 | + title: "Composer knows the path of class file" | ||
| 4 | + date: 2015-06-08 23:00:00 | ||
| 5 | 5 | tags: vim, php, composer, sensorario | |
| 6 | 6 | category: plugin | |
| 7 | 7 | author: sensorario | |
@@ -11,36 +11,30 @@ summary: Open class file witouht pass throuw ctag | |||
| 11 | 11 | ||
| 12 | 12 | <p>I work with vi since late 2014. Starting from that date, I've learned different ways to work with this amazing and customizable editor. Since few weeks ago, I always worked with CtrlP to search a file. But, ... why type everytime class name for CtrlP instead of "grep" directly to composer's auto-generated files?</p> | |
| 13 | 13 | ||
| 14 | - <h2>grep composer to find the path</h2> | ||
| 14 | + <h2>Grep composer to find the path</h2> | ||
| 15 | 15 | <p>First of all, I started to grep a class name in composer folder:</p> | |
| 16 | - | ||
| 17 | 16 | {% highlight bash %} | |
| 18 | 17 | grep ParticularClassName ./vendor/composer -R | awk '{print $6}' | awk -F\\' '{print $2}' | |
| 19 | 18 | {% endhighlight %} | |
| 20 | - | ||
| 21 | 19 | <p>This kind of instruction returns a path like <em>/src/Path/To/ParticularClassName.php</em>.</p> | |
| 22 | 20 | ||
| 23 | - <h2>keep bash output inside a VimL variable</h2> | ||
| 21 | + <h2>Keep bash output inside a VimL variable</h2> | ||
| 24 | 22 | <p>Asking to stackoverflow, ... I discovered the way to retrieve bash output inside a variable:</p> | |
| 25 | - | ||
| 26 | 23 | {% highlight bash %} | |
| 27 | 24 | let l:fileName = system(l:command) | |
| 28 | 25 | {% endhighlight %} | |
| 29 | 26 | ||
| 30 | - <h2>open new tab form VimL</h2> | ||
| 27 | + <h2>Open new tab form VimL</h2> | ||
| 31 | 28 | <p>Finally, I can open in new tab the result.</p> | |
| 32 | - | ||
| 33 | 29 | {% highlight vim %} | |
| 34 | 30 | let l:fileName = system(l:command) | |
| 35 | 31 | let l:openFileCommand = 'tabe .' . l:fileName | |
| 36 | 32 | exec l:openFileCommand | |
| 37 | 33 | {% endhighlight %} | |
| 38 | - | ||
| 39 | 34 | <p>My contribute to this <a href="https://github.com/vim-php/vim-composer">vim-composer</a> plugin is a way to open faslty a file, when we want open it. The principle is "when I see a class name, I want to open source file of that class, and I want ask this to composer".</p> | |
| 40 | 35 | ||
| 41 | - <h2>make plugin useful for custom improvements</h2> | ||
| 36 | + <h2>Make plugin useful for custom improvements</h2> | ||
| 42 | 37 | <p>vim-composer is a specific plugin for composer. This must work even if developers has CtrlP, ctags or other plugin. And also, this plugin can help developers and/or others plugins. For example I work with CtrlP. Someone not (I cant believe but is possible). Someone works with ctags. Probably exists others plugin. I dont care. My contribute aims to help every kind of improvements. With my last pull request. I suggest an intresting improvement. The function "g:ComposerKnowWhereCurrentFileIs()" define some global variables if o or more instance of current word are find in composer aut-generated files. With this improvements developers can create, for example, a map that execute ComposerKnowWhereCurrentFileIs. If the function found one file, will open it. If not, .. CtrlP could be executed with this trick:</p> | |
| 43 | - | ||
| 44 | 38 | {% highlight php %} | |
| 45 | 39 | nnoremap <F6>call s:ComposerOrCtrlP() | |
| 46 | 40 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments