Skip to content
Discussion options

You must be logged in to vote

The best suggestion is to set 'commentstring' option to '// %s' for php buffers. There are two ways to do that:

  • A quick way is to add this line to the 'init.lua': vim.cmd('au FileType php setlocal commentstring=// %s')
  • A more proper way is to create file '~/.config/nvim/after/ftplugin/php.lua' and put the following line inside of it: vim.bo.commentstring = '// %s'.

If for some reason there is a need for a 'commentstring' in php files other what is meant to be used as $LINE_COMMENT (which I'd highly recommend against), there is also a workaround of writing custom config.expand.insert that uses custom LINE_COMMENT value for buffers with php filetype.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@feekApp
Comment options

Answer selected by echasnovski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested mini.snippets
2 participants