I debugged this further:

This block causes problems with a newer vim:

" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
     \ if line("'\"") > 0 && line("'\"") <= line("$") |
     \   exe "normal! g`\"" |
     \ endif



> On Mar 28, 2020, at 2:07 PM, Nicholas Papadonis <[email protected]> 
> wrote:
> 
> Hi,
> 
> I'm trying to start vim using an init file and vim is complaining at startup. 
>  The same startup file works on other operating systems with vim.
> 
> Does anyone know what the cause could be?
> 
> Thanks
> 
> This is the feedback at startup:
> $ vim
> 
> --- Autocommands ---
> vimStartup  BufRead
> *if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' |   exe 
> "normal! g`\"" | endif
> filetypedetect  BufRead
> *if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat | runtime! 
> scripts.vim | endif
> *if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat    && 
> (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'^I|| 
> getline(4) =~ '^#' || getline(5) =~ '^#') |   setf FALLBACK conf | endif
> Press ENTER or type command to continue
> 
> Removing this from the .vimrc resolves the issue:
> > if has ("autocmd")
> >     " Automatically go to last place in file
> >     autocmd BufReadPost *
> >      if line("'\"") > 0 && line ("'\"") <= line("$") | exe "normal g'\"" |
> >      endif
> >     
> >     augroup default
> >     "autocmd BufEnter * set textwidth=72 ai formatoptions=tcqn
> >     augroup END
> > 
> >     " Only turn on C-indenting on C type files
> >     augroup cprog
> >       " Remove all cprog autocommands
> >       " au!
> >       autocmd FileType c,cpp au! default
> > 
> >       " When starting to edit a file:
> >       "   For C and C++ files set formatting of comments and set 
> > C-indenting on.
> >       "   For other files switch it off.
> >       "   Don't change the order, it's important that the line with *
> >       "     comes first.
> >       "autocmd FileType *      set formatoptions=tcql nocindent comments&
> >       "autocmd FileType c,cpp  set formatoptions=croql cindent 
> > comments=sr:/*,mb:*,el:*/,://
> >       "autocmd FileType c,cpp  set textwidth=80 ai formatoptions=tcrql
> >       autocmd FileType c,cpp,  set expandtab
> >     augroup END
> > else
> >     set textwidth=72
> > endif
> 
> 
> The version of vim I'm using:
> VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 20 2019 18:44:42)
> Included patches: 1-1721
> Modified by OpenIndiana <[email protected]>
> Compiled by oi-userland build environment
> Huge version without GUI.  Features included (+) or not (-):
> +acl               -farsi             -mouse_sysmouse    -tag_any_white
> +arabic            +file_in_path      +mouse_urxvt       -tcl
> +autocmd           +find_in_path      +mouse_xterm       +termguicolors
> +autochdir         +float             +multi_byte        +terminal
> -autoservername    +folding           +multi_lang        +terminfo
> -balloon_eval      -footer            -mzscheme          +termresponse
> +balloon_eval_term +fork()            +netbeans_intg     +textobjects
> -browse            +gettext           +num64             +textprop
> ++builtin_terms    -hangul_input      +packages          +timers
> +byte_offset       +iconv             +path_extra        +title
> +channel           +insert_expand     +perl/dyn          -toolbar
> +cindent           +job               +persistent_undo   +user_commands
> -clientserver      +jumplist          +postscript        +vartabs
> -clipboard         +keymap            +printer           +vertsplit
> +cmdline_compl     +lambda            +profile           +virtualedit
> +cmdline_hist      +langmap           +python/dyn        +visual
> +cmdline_info      +libcall           +python3/dyn       +visualextra
> +comments          +linebreak         +quickfix          +viminfo
> +conceal           +lispindent        +reltime           +vreplace
> +cryptv            +listcmds          +rightleft         +wildignore
> +cscope            +localmap          +ruby/dyn          +wildmenu
> +cursorbind        +lua/dyn           +scrollbind        +windows
> +cursorshape       +menu              +signs             +writebackup
> +dialog_con        +mksession         +smartindent       -X11
> +diff              +modify_fname      -sound             -xfontset
> +digraphs          +mouse             +spell             -xim
> -dnd               -mouseshape        +startuptime       -xpm
> -ebcdic            +mouse_dec         +statusline        -xsmp
> +emacs_tags        -mouse_gpm         -sun_workshop      -xterm_clipboard
> +eval              -mouse_jsbterm     +syntax            -xterm_save
> +ex_extra          +mouse_netterm     +tag_binary
> +extra_search      +mouse_sgr         -tag_old_static
>    system vimrc file: "/etc/vimrc"
>      user vimrc file: "$HOME/.vimrc"
>  2nd user vimrc file: "~/.vim/vimrc"
>       user exrc file: "$HOME/.exrc"
>        defaults file: "$VIMRUNTIME/defaults.vim"
>   fall-back for $VIM: "/usr/share/vim"
> Compilation: /usr/gcc/6/bin/gcc -c -I. -Iproto -DHAVE_CONFIG_H     -m64 -O3  
> -std=c9
> 9 -D_XOPEN_SOURCE=600 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
> Linking: /usr/gcc/6/bin/gcc   -L. -fstack-protector-strong -R 
> /usr/perl5/5.24/lib/i8
> 6pc-solaris-thread-multi-64/CORE  -m64 -o vim        -lncurses -lsec   -R 
> /usr/perl5
> /5.24/lib/i86pc-solaris-thread-multi-64/CORE  -m64 -fstack-protector-strong   
> -L/usr
> /perl5/5.24/lib/i86pc-solaris-thread-multi-64/CORE -lsocket -lnsl -lm -lc
> 
> 
> -- 
> -- 
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php 
> <http://www.vim.org/maillist.php>
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/vim_use/84425c07-e8fe-47ce-bd10-51803fdafa65%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/vim_use/84425c07-e8fe-47ce-bd10-51803fdafa65%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/96EADBEF-FF00-4E7A-BCD3-7606996B8332%40gmail.com.

Reply via email to