Vim Syntax Highlighting does not work

后端 未结 9 755
别那么骄傲
别那么骄傲 2021-01-31 14:45

I\'ve installed a fresh Arch Linux system on my laptop and downloaded the vim package.

I haven\'t altered the .vimrc file, but the syntax highlighting doesn\'t seem to w

相关标签:
9条回答
  • 2021-01-31 15:00

    On my Ubuntu 18.04 system i.e. c-highlighting works but Icinga2 config file highlighting being provided by the vim-icinga2 package does not. Quote from https://packages.debian.org/sid/vim-icinga2:

    As per the Debian vim policy, installed addons are not activated automatically, but the "vim-addon-manager" tool can be used for this purpose.

    Executing vim-addon-manager -w install icinga2 following a regular vim-icinga2 package installation solved the issue. The -w option forces a system wide rather than a just per current user activation. Notice that executing vim-addon-manager without arguments yields a list of 39 modes being disabled by default:

    > vim-addon-manager
    # Name                     User Status  System Status 
    align                       removed       removed       
    alternate                   removed       removed       
                            ...
    icinga2                     removed       installed    # Due to above command
                            ...
    

    If you do miss highlighting chances are your mode is among this list.

    NB: Ubuntu 18.04 seemingly inherits Debian's policy. None of the above answers solved my issue. No ~/.vimrc configuration or manual activation was being required after the above described activation.

    0 讨论(0)
  • 2021-01-31 15:02

    You need to have following settings in .vimrc file as per arch linux documentation

    filetype plugin on
    syntax on
    
    0 讨论(0)
  • 2021-01-31 15:02

    in my case , I changed the term(terminal type) from vt100 to xterm. And it works.

    To change the terminal type:

    in bash:

    export TERM=xterm
    

    in bourne shell or ksh:

    TERM=xterm
    export TERM
    

    in csh or tcsh:

    setenv TERM xterm
    
    0 讨论(0)
  • 2021-01-31 15:06

    I had this problem in Opensuse Leap 42.2 cloud. And solved it by installing vim-data

    sudo zypper install vim-data
    

    or just re-installing vim will include vim-data automatically.

    sudo zypper remove vim
    sudo zypper install vim
    
    0 讨论(0)
  • 2021-01-31 15:10

    This is the absolute minimum you need to put in your ~/.vimrc if you intend to use vim as your primary editor:

    " activates filetype detection
    filetype plugin indent on
    
    " activates syntax highlighting among other things
    syntax on
    
    " allows you to deal with multiple unsaved
    " buffers simultaneously without resorting
    " to misusing tabs
    set hidden
    
    " just hit backspace without this one and
    " see for yourself
    set backspace=indent,eol,start
    

    Anything else depends on your taste, workflow and needs.

    0 讨论(0)
  • 2021-01-31 15:15

    I had a similar problem. I could not have syntax highlighting on. I also found that gvim launched without pulldown menus or toolbar icons. It turned out I did not have the vim-runtime package properly installed. In my case I was on debian jessie with a large set of files missing under /usr/share/vim/vim74/ directory.

    $ ls /usr/share/vim/vim74/
    debian.vim  doc/  rgb.txt
    

    The solution was to run:

    $ sudo aptitude reinstall vim-runtime
    

    That fixed the problem for me, for syntax highlighting and for missing menus/icons in gvim. I'm not sure why my system was in this state, but the reinstall of the above package solved both issues.

    0 讨论(0)
提交回复
热议问题