6
votes
Accepted
Why doesn't Vim recognize HTML inside PHP?
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
1
vote
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 ...
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 ....
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 @...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
filetype-php × 27syntax-highlighting × 6
indentation × 6
neovim × 3
filetype-html × 3
colorscheme × 2
ctags × 2
ide × 2
vimrc × 1
vimscript × 1
regular-expression × 1
search × 1
autocmd × 1
substitute × 1
functions × 1
external-command × 1
folding × 1
formatting × 1
quickfix × 1
comments × 1
cursor × 1
tags × 1
error × 1
command × 1
filetype-javascript × 1