← Back to team overview

sslug-teknik team mailing list archive

Re: vim syntax highlight mangler

 

Michael Rasmussen wrote:
On Mon, 10 Jan 2005 21:15:48 +0100, Ole Hansen wrote:


Jeg har desuden prøvet at afinstallere og installere igen.

Det afhjælper sjældent problemerne:-)

Er der nogen der har en idé?


Har du en .vimrc liggende i dit hjemmekatalog? Ifald du har, vil den have
præcedens for global vimrc.

Hvordan ser din /etc/vim/vimrc ud?
Min ser ud på følgende måde:

Du mangler ikke vim samt udvidelser?
Jeg har installeret følgende:
" Configuration file for vim
set runtimepath=~/.vim,/etc/vim,/usr/share/vim/vimfiles,/usr/share/vim/addons,/usr/share/vim/vim63,/usr/share/vim/vimfiles,/usr/share/vim/addons/after,~/.vim/after

" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible	" Use Vim defaults instead of 100% vi compatibility
set backspace=indent,eol,start	" more powerful backspacing

" Now we set some defaults for the editor set autoindent " always set autoindenting on
" set linebreak		" Don't wrap words by default
set textwidth=0 " Don't wrap lines by default set nobackup " Don't keep a backup file
set viminfo='20,\"50	" read/write a .viminfo file, don't store more than
			" 50 lines of registers
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time

" Suffixes that get lower priority when doing tab completion for filenames.
" These are files we are not likely to want to edit or read.
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc

" We know xterm-debian is a color terminal
if &term =~ "xterm-debian" || &term =~ "xterm-xfree86"
  set t_Co=16
  set t_Sf=[3%dm
  set t_Sb=[4%dm
endif

" Make p in Visual mode replace the selected text with the "" register.
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
" set background=dark

if has("autocmd")
 " Enabled file type detection
 " Use the default filetype settings. If you also want to load indent files
 " to automatically do language-dependent indenting add 'indent' as well.
 filetype plugin on

endif " has ("autocmd")

" Some Debian-specific things
augroup filetype
  au BufRead reportbug.*		set ft=mail
  au BufRead reportbug-*		set ft=mail
augroup END

" Set paper size from /etc/papersize if available (Debian-specific)
if filereadable('/etc/papersize')
  let s:papersize = matchstr(system('/bin/cat /etc/papersize'), '\p*')
  if strlen(s:papersize)
    let &printoptions = "paper:" . s:papersize
  endif
  unlet! s:papersize
endif

" The following are commented out as they cause vim to behave a lot
" different from regular vi. They are highly recommended though.
set showcmd		" Show (partial) command in status line.
set showmatch		" Show matching brackets.
"set ignorecase		" Do case insensitive matching
"set incsearch		" Incremental search
"set autowrite		" Automatically save before commands like :next and :make

" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif
set tabstop=4
set softtabstop=4
set expandtab
set smartindent

Hvis du har installeret vim i gnome, har du en tilsvarende
konfigureationsfil med navn gvimrc.

loke:~$ dpkg --get-selections |grep vim
vim
             install vim-common
install vim-gnome                                       install
vim-scripts                                     install vimpart
                             install


Har netop prøvet din vimrc ved at placere den både i /etc/vimrc, /etc/vim/vimrc og ~/.vimrc. Det gav ingen syntax highlight. Jeg er bange for, at det er et helt andet sted jeg skal kigge. Kan bare ikke finde ud af hvor. Men således ser min vimrc ud på Gentoo:

" Default configuration file for Vim
" Written by Aron Griffis <agriffis@xxxxxxxxxx>
" Modified by Ryan Phillips <rphillips@xxxxxxxxxx>
" Modified some more by Ciaran McCreesh <ciaranm@xxxxxxxxxx>
" Added Redhat's vimrc info by Seemant Kulleen <seemant@xxxxxxxxxx>

" The following are some sensible defaults for Vim for most users.
" We attempt to change as little as possible from Vim's defaults,
" deviating only where it makes sense
set nocompatible        " Use Vim defaults (much better!)
set bs=2                " Allow backspacing over everything in insert mode
set ai                  " Always set auto-indenting on
"set backup             " Keep a backup file
set viminfo='20,\"500 " read/write a .viminfo file -- limit regs to 500 lines
set history=50          " keep 50 lines of command history
set ruler               " Show the cursor position all the time

" We don't allow modelines by default. See bug #14088 and bug #73715.
" If you're not concerned about these, you can enable them on a per-user
" basis by adding "set modeline" to your ~/.vimrc file.
set nomodeline

if v:lang =~ "^ko"
  set fileencodings=euc-kr
  set guifontset=-*-*-medium-r-normal--16-*-*-*-*-*-*-*
elseif v:lang =~ "^ja_JP"
  set fileencodings=euc-jp
  set guifontset=-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*
elseif v:lang =~ "^zh_TW"
  set fileencodings=big5
set guifontset=-sony-fixed-medium-r-normal--16-150-75-75-c-80-iso8859-1,-taipei-fixed-medium-r-normal--16-150-75-75-c-160-big5-0
elseif v:lang =~ "^zh_CN"
  set fileencodings=gb2312
  set guifontset=*-r-*
endif
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
  set fileencodings=utf-8,latin1
endif

" Don't use Ex mode, use Q for formatting
map Q gq

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

if &term=="xterm"
" Previously we would unset t_RV to prevent gnome-terminal from beeping as " vim started. These days it appears that gnome-terminal has been repaired,
  " so re-enable this, and don't restrict t_Co=8.  (21 Jun 2004 agriffis)
  "set t_RV=                    " don't check terminal version
  "set t_Co=8
  set t_Sb=^[4%dm
  set t_Sf=^[3%dm
  set ttymouse=xterm2   " only works for >=xfree86-3.3.3, should be okay
endif

" Enable plugin-provided filetype settings
filetype plugin on

" Uncomment the next line (or copy to your ~/.vimrc) for plugin-provided
" indent settings. Some people don't like these, so we won't turn them on by
" default.
" filetype indent on

if has("autocmd")

augroup gentoo
  au!

  " Gentoo-specific settings for ebuilds.  These are the federally-mandated
  " required tab settings.  See the following for more information:
  " http://www.gentoo.org/doc/en/xml/gentoo-howto.xml
  " Better yet, emerge app-vim/gentoo-syntax and you'll get full syntax,
  " filetype and indent settings for all things Gentoo.
  au BufRead,BufNewFile *.e{build,class} let is_bash=1|setfiletype sh
  au BufRead,BufNewFile *.e{build,class} set ts=4 sw=4 noexpandtab

  " In text files, limit the width of text to 78 characters, but be careful
  " that we don't override the user's setting.
  autocmd BufNewFile,BufRead *.txt if &tw == 0 | set tw=78 | endif

  " When editing a file, always jump to the last cursor position
  autocmd BufReadPost *
        \ if line("'\"") > 0 && line ("'\"") <= line("$") |
        \   exe "normal g'\"" |
        \ endif

" When editing a crontab file, set backupcopy to yes rather than auto. See
  " :help crontab and bug 53437.
  autocmd FileType crontab set backupcopy=yes

augroup END

endif " has("autocmd")



Follow ups

References