Javascript indentation in VIM

前端 未结 7 1014
遇见更好的自我
遇见更好的自我 2021-02-02 15:46

I\'m trying to get VIM to indent Javascript with the \'=\' and related commands. When I try to auto indent the following, for example:

   new function($) {
              


        
7条回答
  •  -上瘾入骨i
    2021-02-02 16:19

    I had the same problem some time ago and the solution was the plugin "vim-javascript". It is JavaScript bundle for vim providing syntax and indent plugins.

    https://github.com/pangloss/vim-javascript

    The installation is very simple.

    If you are using pathogen, use the follow steps:

      cd ~/.vim/bundle
      git clone https://github.com/pangloss/vim-javascript.git
    

    If you are using vundle use the follow steps:

    Add the follow line to your vimrc file:

    Plugin "pangloss/vim-javascript"
    

    And install it:

    :so ~/.vimrc
    :PluginInstall
    

提交回复
热议问题