Skip to main content
6 votes
Accepted

How do I enable language-specific syntax inside a heredoc?

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 ...
Rich's user avatar
  • 32k
5 votes
Accepted

Auto indent turns off itself automatically on php files

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 ...
Tumbler41's user avatar
  • 7,746
4 votes
Accepted

How can I format a function declaration to force curly brace at the end of the line?

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 ...
padawin's user avatar
  • 1,333
4 votes
Accepted

How do I stop vim from higlighting uncessary words in PHP

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 ...
Martin Tournoij's user avatar
3 votes

Are there color variables for various programming languages?

A "color scheme" is not language-specific. Every file will use the same color scheme. Here's an old question with some good answers on creating your own color scheme, though, if that's ...
MDeBusk's user avatar
  • 416
3 votes

PHP class name collision with ctags

<C-]> is equivalent to :tag <keyword>, not to :tselect <keyword>, the normal mode equivalent of which would be g]. The end result of $ ctags -R . is a tags file that contains a list ...
romainl's user avatar
  • 40.7k
3 votes
Accepted

How do I run Cakephp's tests (PHPUnit) and output it to QuickRun or other window?

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 ...
muru's user avatar
  • 24.9k
2 votes

Copy current php file classname with namespace?

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 ...
nobe4's user avatar
  • 16.1k
2 votes

Why is my XML filetype configuration overridding my PHP filetype configuration?

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 ...
Martin Tournoij's user avatar
2 votes

Auto indent turns off itself automatically on php files

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 ...
Rich's user avatar
  • 32k
2 votes
Accepted

How to comment html in php file in vim?

I believe your file type is php and your commentstring is /*%s*/ which is reasonable for php files. To solve your problem you could temporarily change commentstring to<!--%s-->: set ...
Vivian De Smedt's user avatar
1 vote

Neovim+PHP basic set up

Neovim is very Vim compatible. Here is the steps for a standard migration: If you are used to use a plugin manager like vim-plug follow the instruction to install it on Neovim Copy ~/.vimrc into ~/....
Vivian De Smedt's user avatar
1 vote

Neovim LSP Phpactor not finding classes

I'd still like to know how to debug this stuff better, but my problem was solved by clearing my ~/.cache/phpactor/.
artfulrobot's user avatar
1 vote

Formatting using BufWritePost ends up with WARNING

I came up with the following solution: " make a tmp file & write buffer content to it let l:tmp = system('mktemp') execute 'write! ' . l:tmp " fix the tmp file let l:cmd = l:fixer_path ....
Jesus_21's user avatar
  • 111
1 vote

Vim plugin for different languages in one webfile

According to Vim syntax documentation, you can define blocks of syntax: syntax include @PHP syntax/php.vim syntax include @CSS syntax/css.vim syntax include @JS syntax/javascript.vim syntax include @...
Yasen's user avatar
  • 491
1 vote

Missing doc comment errors

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 ...
Daniel's user avatar
  • 111
1 vote

How to have the cursor at the right indentation when editing PHP/HTML

Using this plugin solved the issue for me: Plug 'captbaritone/better-indent-support-for-php-with-html', { 'for': 'php' } It is better than switching between php and html file type in my scenario ...
Chin Leung's user avatar
1 vote
Accepted

cannot generate ctags for php traits

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 ...
Rich's user avatar
  • 32k

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