2

I'm a new user and I have just installed GVim on my linux. I just have ~/.vimrc file and no .vim folder may be because I did not install any plugins.

When I try to refresh (by :e) or reopen the buffer containing a specific type of files (*.inp). I get the following error.

Error detected while processing BufRead Autocommands for "*.inp"..function dist#ft#Check_inp[2]..FileType Autocommands for "*"..function <SNR>17_LoadFTPlugin:
line    3:
E1269: Cannot create a Vim9 script variable in a function: s:cpo_save

My ~/.vimrc looks as follows:

colorscheme evening
set guifont=Monospace\ 11
" visualizes line number
set number
set nocompatible
syntax enable
syntax on
" autoupdates file
set autoread
filetype plugin indent on
" sets the window to maximized when opened
set lines=999 columns=999
" updates file after buffer change
au FocusGained,BufEnter *.* :checktime
" keymap for :e = reloading the current buffer
nnoremap <F5> :edit<CR>
" list the contents of the current folder
nnoremap <F6> :!ls<CR>
" source ~/.vimrc
nnoremap <F7> :so $MYVIMRC<CR>

Could somebody please explain to me why I get this message and how to solve it ?

3
  • 1
    That might well be a bug in $VIMRUNTIME/filetype.vim or $VIMRUNTIME/autoload/dist/ft.vim, but I don't see any cpo_save in a vim9 context in those files. Might be worth reporting on the mailing list or GitHub, esp. if you can reproduce with something like vim -u DEFAULTS
    – D. Ben Knoble
    May 9, 2022 at 13:35
  • 1
    I can reproduce it with vim -u DEFAULTS. I'm going to file a bug report in GitHub.
    – AccGen
    May 9, 2022 at 13:55
  • Welcome to Vi and Vim! Please report back with an answer if you get some feedback from GitHub. Thanks!
    – filbranden
    May 9, 2022 at 15:06

1 Answer 1

1

The mailing list discussion confirmed a bug in the abaqus.vim ftplugin, which has since been patched.

Options for the current user are (according to lacygoill on the mailing list):

  1. Wait for the next runtime files update; then, build vim yourself or wait for your package manager to update.
  2. Download the latest version of the file with patches to override the current file (see below).
  3. Idem. using the current $VIMRUNTIME copy (see below).

Shell commands for (2):

curl --fail --location --show-error --silent --output ~/.vim/ftplugin/abaqus.vim https://raw.githubusercontent.com/vim/vim/master/runtime/ftplugin/abaqus.vim
<~/.vim/ftplugin/abaqus.vim sed '/let b:undo_ftplugin = "let s:cpo_save = &cpoptions|"/,/^$/s/s:/b:/g' >~/.vim/ftplugin/abaqus.vim.new && mv ~/.vim/ftplugin/abaqus.vim.new ~/.vim/ftplugin/abaqus.vim

Vim commands for (3):

:call mkdir($HOME . '/.vim/ftplugin/', 'p')
:edit $HOME/.vim/ftplugin/abaqus.vim
:read $VIMRUNTIME/ftplugin/abaqus.vim
:silent 90,94 substitute/s:/b:/
:write

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.