vim hilighting与名称中没有“ - ”的函数不一致

时间:2017-06-12 21:00:14

标签: bash vim syntax-highlighting vim-syntax-highlighting

Vim似乎在bash脚本中对函数的颜色不同,具体取决于它们在函数名中有-。这也延续到开启和关闭支撑。

对此行为可能有什么责任?哪种颜色是“正确的”?我想使这一点保持一致。

我附上了显示行为的屏幕截图,请注意conda()和以下函数之间的区别。我知道有不必要的重复:所涉及的路径,无需指出:)

vim function miscolor

我对3的颜色不同感到恼火,但这可能是一个不同的问题......

就环境而言,这是Ubuntu 16.04.2 LTS上的“vim-nox 2:7.4.1689-3ubuntu1”。我有一个广泛的vimrc:

if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
   set fileencodings=ucs-bom,utf-8,latin1
endif

set nocompatible        " Use Vim defaults (much better!)
set bs=indent,eol,start " allow backspacing over everything in insert mode
set ai                  " always set autoindenting on
set nobackup            " stop littering!
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
set background=dark     " honestly who uses light background terminals!?
set nowrap              " word wrapping is the devil
set smartcase           " does what it says on the tin
set wildmenu            " completions in status line
set visualbell          " flash instead of making noise
set number              " line numbers yay
set nofoldenable        " code folding is for IDEs, knock it off
set shiftwidth=4
set tabstop=4

" allow F3 to toggle line number display
noremap <F3> :set invnumber<CR>
inoremap <F3> <C-O>:set invnumber<CR>

filetype plugin indent on

" Switch syntax highlighting on, when the terminal has colors
" adjust the line number color, and also switch on search
" pattern hilighting
if &t_Co > 2 || has("gui_running")
  syntax on
  highlight LineNr term=bold cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=DarkRed guibg=NONE
  set hlsearch
endif

" .sc is a scala file, please to be hilight
au BufNewFile,BufRead *.sc set filetype=scala

if &term=="xterm"
     set t_Co=8
     set t_Sb=m
     set t_Sf=m
endif

" Don't wake up system with blinking cursor:
" (URL removed, site is replaced with a squatter now)
let &guicursor = &guicursor . ",a:blinkon0"

" hex support
nnoremap <C-X> :Hexmode<CR>
inoremap <C-X> <Esc>:Hexmode<CR>
vnoremap <C-X> :<C-U>Hexmode<CR>
command -bar Hexmode call ToggleHex()
function ToggleHex()
  " hex mode should be considered a read-only operation
  " save values for modified and read-only for restoration later,
  " and clear the read-only flag for now
  let l:modified=&mod
  let l:oldreadonly=&readonly
  let &readonly=0
  let l:oldmodifiable=&modifiable
  let &modifiable=1
  if !exists("b:editHex") || !b:editHex
    " save old options
    let b:oldft=&ft
    let b:oldbin=&bin
    " set new options
    setlocal binary " make sure it overrides any textwidth, etc.
    silent :e " this will reload the file without trickeries
              "(DOS line endings will be shown entirely )
    let &ft="xxd"
    " set status
    let b:editHex=1
    " switch to hex editor
    %!xxd -g 1
  else
    " restore old options
    let &ft=b:oldft
    if !b:oldbin
      setlocal nobinary
    endif
    " set status
    let b:editHex=0
    " return to normal editing
    %!xxd -r
  endif
  " restore values for modified and read only state
  let &mod=l:modified
  let &readonly=l:oldreadonly
  let &modifiable=l:oldmodifiable
endfunction

0 个答案:

没有答案