[英]gnuplot highlighting in vim
I am using gnuplot to display data and I usually edit the files in vim.我正在使用 gnuplot 显示数据,我通常编辑 vim 中的文件。 I would like to have some sort of syntax highlighting if it was possible.
如果可能的话,我希望有某种语法突出显示。 I tried to install several plugins with vim plug for gnuplot but I can't seem to make it work.
我尝试使用用于 gnuplot 的 vim 插件安装几个插件,但我似乎无法使其工作。 here is the contents of my
.vimrc
file:这是我的
.vimrc
文件的内容:
call plug#begin()
Plug 'tpope/vim-sensible'
Plug 'flazz/vim-colorschemes'
Plug 'junegunn/seoul256.vim'
Plug 'junegunn/vim-easy-align'
Plug 'vim-scripts/gnuplot.vim'
call plug#end()
if has("syntax")
syntax on
endif
let mapleader=","
set cindent
set statusline+=col:\ %c,
set ruler
set nu
set showcmd
set nocompatible
set nosol
set background=dark
set autoread
set wildmenu
set lazyredraw
set magic
set showmatch
set mat=10
set noerrorbells
set novisualbell
set autoindent
set smartindent
set cursorline
set ic
set hls
set lbr
set shiftwidth=4
set expandtab
set tabstop=4
set t_Co=256
set shortmess+=A
set ff=unix
set clipboard=unnamedplus
set splitbelow
set termwinsize=10x0
set mouse=i
set formatoptions+=w
set splitright
set autochdir
set textwidth=180 wrapmargin=0
set colorcolumn=180
"
nnoremap <C-Left> :tabprevious<CR>
nnoremap <C-Right> :tabnext<CR>
""
colorscheme Monokai
"
augroup gnuplot
autocmd!
autocmd FileType gp :nnoremap <Leader>c :w<CR>:!gnuplot %<CR>
autocmd FileType gp :nnoremap <Leader>v :!okular $(awk 'BEGIN {FS="\047"} /set output/ {print $2}' "%") &<CR><CR>
augroup END
""
let g:livepreview_previewer = 'okular'
""
map <C-m> :set nonu<CR>
map <C-n> :set nu<CR>
I am almost sure that the problem comes from this file but I cannot see it.我几乎可以肯定问题来自这个文件,但我看不到它。
If I run: :set hl
I get the following error:如果我运行:
:set hl
我收到以下错误:
highlight=8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,a:LineNrAbove,b:LineNrBelow,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:F
oldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine,z:StatusLineTerm
,Z:StatusLineTermNC
Press ENTER or type command to continue
Cheers干杯
gnuplot
filetype to *.gpi
files out of the box. gnuplot
文件类型分配给开箱即用的*.gpi
文件。 Therefore…所以…
Your two FiletType
autocommands can't work as-is.您的两个
FiletType
自动命令无法按原样工作。 They should match on gnuplot
, not gp
:他们应该匹配
gnuplot
,而不是gp
:
augroup gnuplot autocmd: autocmd FileType gnuplot nnoremap <buffer> <Leader>c:w<CR>:!gnuplot %<CR> autocmd FileType gnuplot nnoremap <buffer> <Leader>v :!okular $(awk 'BEGIN {FS="\047"} /set output/ {print $2}' "%") &<CR><CR> augroup END
(I also removed the unnecessary colons and added the missing <buffer>
s that guarantee your mappings won't leak to buffers with other filetypes.) (我还删除了不必要的冒号并添加了丢失的
<buffer>
,以保证您的映射不会泄漏到其他文件类型的缓冲区。)
There is no hard need for installing a third-party syntax script.无需安装第三方语法脚本。
With your vimrc
in its current form, Vim should highlight *.gpi
without you having to do anything.使用当前形式的
vimrc
,Vim 应该突出显示*.gpi
,而无需您做任何事情。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.