9

Vim doesn't come with PHP syntax folding built-in. However, if all of your code is properly indented (as your example is), you can use a different fold method: :set foldmethod=indent


5

phpfolding.vim provides this. The advantage of this over :set foldmethod=indent is that it's "smarter" because it looks at the actual PHP syntax, and not just the indentation. From the README: It remembers fold settings. If you add functions and execute the script again, your opened folds will not be closed. It will not be confused by brackets in ...


5

From :help ft-php-syntax: There are the following options for the php syntax highlighting. [..] Enable HTML syntax highlighting inside strings: let php_htmlInStrings = 1 You can add that your vimrc.


5

You can use the external program exuberant cTags to help you doing that: It will create a tags file indexing the keywords of your codebase and allow you to navigate through them. (The first steps comes from another answer) Install exuberant cTags: $ sudo apt-get install exuberant-ctags (or the equivalent command for your distribution). Generate the tags ...


4

You can use the new line character is your search (\n for linux): :%s/)\s*\n{/){/c Replaces )\s*\n{ into ){ The c flag at the end will ask you to confirm before each replacement. EDIT: Another solution would be to use the join line feature (J) with the g command: :g/function [^{]\+$/join Which will execute the command join on every line matching the ...


4

It looks like it's highlighting SQL keywords. There is a setting in the PHP syntax highlighter to do that: php_sql_query. This is off by default, so check your vimrc if you added that, or try adding let g:php_sql_query = 1 to your vimrc. Also see :help ft-php-syntax.


4

This is because of vim's internal php settings. If you look in vim##/indent/php.vim, there's the following line: setlocal noautoindent If you want to override this feature, you'll need to use an autocmd in your vimrc. Try this: autocmd FileType php setlocal autoindent This will turn on auto indenting whenever vim detects it's editing a php file. ...


3

TL;DR: It's defined in Vim's PHP and HTML syntax files. To see how to add rules for CSS, jump to the section And how do I add to them? below, or read on for an explanation of how it works. Where are these syntax rules getting defined? The JavaScript heredoc is highlighted using Vim's syntax contains1 feature, which allows syntax groups to contain other ...


3

I'm not familiar with CakePHP, but you could use :make for it: set makeprg=/vagrant/my_project/app/Console/cake\ test\ app\ Console/Command/FeedParseShell Then, if you run :make, the output of this command will be used to populate the quickfix list (which can be useful if the output identifies offending line numbers).


2

Here's a start, it's definitely not perfect but should gives you enough to increment on function! GetNamespaceAndClassFn() " Save some registers let l:r_a = @a let l:r_b = @b " Start at the top of the file :0 " Search for the first "namespace" occurence /namespace " Get the namespace string into the regsiter a normal! f l"ayt; " Search ...


2

The default php ftplugin already does that for you: setlocal include=\\\(require\\\|include\\\)\\\(_once\\\)\\\? Add filetype plugin indent on to your ~/.vimrc if it's not already there to benefit from Vim's filetype detection.


2

The PHP filetype loads the HTML filetype; from $VIMRUNTIME/syntax/php.vim (around like 63): runtime! syntax/html.vim unlet b:current_syntax This is because PHP is layered "on top" of HTML, and you can start/stop with the <?php and ?> tags. That plugin of yours ships with a ftplugin/html.vim file which load the ftplugin/xml.vim syntax file. The only ...


1

Being a beginner of VIM it may be tempting to install plugin candy, but caution is in place. With Pathogen, plugins get installed in ~/vim/bundle First thing I tried is to zip all the plugins and delete their originals. This quick dirty step already fixed the main issue. My first assumption was the Syntastic plugin. Looking up this plugin and the toggle I ...


1

When you press Ctrl-P in normal mode, you are invoking the Ctrl-P plugin, and it is displaying a fuzzy finder for files, (with the first entry being the tags file you've created with ctags). If your cursor is over getClient(), the keystroke you need to use to jump to its definition is Ctrl+]. If this doesn't work, then the first thing to check is whether ...


1

The general mechanism for discovering where a particular Vim option was set is the :verbose command: :verbose set autoindent? The above will inform you that autoindent was most recently unset by the script in location $VIMRUNTIME/indent/php.vim @Tumbler41 has already described how to overrule this with an autocommand, but I'll note that Vim also has more ...


Only top voted, non community-wiki answers of a minimum length are eligible