Search code examples
vimsyntaxsyntax-highlightingvim-syntax-highlighting

vim syntax: delete a name of a php variable without dollar sign


In Vim, if I press alt+backspace it will delete the word before the cursor.

With default php.vim syntax it deletes a PHP variable like this:

What I need to put in a syntax file to make it work like below?

(I don't mean to install other syntax files with this behavior implemented, I wonder how to control it in my own config.)


Solution

  • Add this snippet to your vimrc:

    augroup PHP
        autocmd!
        autocmd FileType php setlocal iskeyword-=$
    augroup END
    

    See :help 'iskeyword'.