Hi,
On Mon, Oct 31, 2022 at 5:35 AM Mattis DALLEAU <[email protected]>
wrote:
> Steps to reproduce
>
> 1. Add source /etc/vim/myscript.vim in /etc/vim/vimrc
> 2. Put my script at /etc/vim/myscript.vim
> 3. Tells me that the dictionary has invalid syntax (See Expected
> Behaviour)
>
>
This is caused by running Vim in Vi-compatible mode. This is described
under:
:help cpo-C
:help line-continuation
When the /etc/vim/myscript.vim file is sourced, Vim is still running in
compatible mode.
> 1. Remove the line in source /etc/vim/myscript.vim in /etc/vim/vimrc
> 2. Remove myscript.vim from /etc/vim
> 3. Create a ~/.vimrc and add the line source ~/.vim/myscript.vim
>
>
When the .vimrc file is present, Vim starts in non-compatible mode. So
sourcing
your script from the .vimrc file doesn't cause any problems.
- Yegappan
>
> 1. Put my script in it
> 2. Works like a charm
>
> Expected behaviour
>
> Here is the code
>
> let s:comMapNoShebang = {
> \ 'c': {'b': '/*', 'm': '**', 'e': '*/'},
> \ 'cpp': {'b': '//', 'm': '//', 'e': '//'},
> \ 'make': {'b': '##', 'm': '##', 'e': '##'},
> \ 'java': {'b': '//', 'm': '//', 'e': '//'},
> \ 'latex': {'b': '%%', 'm': '%%', 'e': '%%'},
> \ 'html': {'b': '<!--', 'm': ' --', 'e': '-->'},
> \ 'lisp': {'b': ';;', 'm': ';;', 'e': ';;'},
> \ 'css': {'b': '/*', 'm': '**', 'e': '*/'},
> \ 'pov': {'b': '//', 'm': '//', 'e': '//'},
> \ 'pascal': {'b': '{ ', 'm': ' ', 'e': '}'},
> \ 'haskell': {'b': '{-', 'm': '-- ', 'e': '-}'},
> \ 'vim': {'b': '""', 'm': '"" ', 'e': '""'},
> \}
>
> I do not understand why if the script is loaded by /etc/vim/vimrc it
> tells me:
>
> Error detected while processing /etc/vim/epitech.vim:
> line 35:
> E15: Invalid expression: {
> line 36:
> E10: \ should be followed by /, ? or &
> line 37:
> E10: \ should be followed by /, ? or &
> line 38:
> E10: \ should be followed by /, ? or &
> line 39:
> E10: \ should be followed by /, ? or &
> line 40:
> E10: \ should be followed by /, ? or &
> line 41:
> E10: \ should be followed by /, ? or &
> line 42:
> E10: \ should be followed by /, ? or &
> line 43:
> E10: \ should be followed by /, ? or &
> line 44:
> E10: \ should be followed by /, ? or &
> line 45:
> E10: \ should be followed by /, ? or &
> line 46:
> E10: \ should be followed by /, ? or &
> line 47:
> E10: \ should be followed by /, ? or &
> line 48:
> E10: \ should be followed by /, ? or &
> line 50:
> E15: Invalid expression: {
> line 51:
> E10: \ should be followed by /, ? or &
> line 52:
> E10: \ should be followed by /, ? or &
> line 53:
> E10: \ should be followed by /, ? or &
> line 54:
> E10: \ should be followed by /, ? or &
> line 55:
> E10: \ should be followed by /, ? or &
> line 56:
> E10: \ should be followed by /, ? or &
> line 57:
> E10: \ should be followed by /, ? or &
> line 58:
> E10: \ should be followed by /, ? or &
> line 59:
> E10: \ should be followed by /, ? or &
> Press ENTER or type command to continue
>
> But works like a charm in .vimrc
>
> I actually need this script for system wide installation
> Version of Vim
>
> VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31)
> Included patches: 1-2269 Modified by [email protected] Compiled
> by [email protected]
> Environment
>
> Operating System: Ubuntu20.04 LTS
> Terminal: Default Gnome Terminal
> Logs and stack traces
>
> *No response*
>
>
>
--
--
You received this message from the "vim_dev" 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_dev" 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_dev/CAAW7x7nkBWiv0xyUJ1%3Dvr%2BgyeJztkL4yWqj%2BqpaeE9TvVyO7LQ%40mail.gmail.com.