I am using gnuplot to display data and I usually edit the files in 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. here is the contents of my .vimrc file:
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:
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.Therefore…
Your two FiletType autocommands can't work as-is. They should match on gnuplot, not 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.)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With