search

Home  >  Q&A  >  body text

Do you use different vimrc configuration files for different programming languages?

How to switch vimrc when switching languages?

怪我咯怪我咯2778 days ago745

reply all(2)I'll reply

  • 迷茫

    迷茫2017-05-16 16:37:13

    Just turn on file type detection, no need to switch vimrc.

    Allow loading of different plug-ins based on different languages ​​(for example, C++’s syntax highlighting plug-in is different from Python’s):

    " 开启文件类型侦测
    filetype on
    " 根据侦测到的不同类型加载对应的插件
    filetype plugin on
    

    Of course you can also pass

    source ~/.config/vim/config/xxxx.vim
    

    This form is used to manage the configuration of multiple languages.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 16:37:13

    Why should I use Vim if this is the case? The main thing I like about Vim is that I can use the same set of configurations no matter what file type or operating system!

    Of course, some adjustments will be made for different situations. You can check it out in Vim :help ftplugin.

    reply
    0
  • Cancelreply