2

I'm trying to automate the creation of .vimrc using this command:

printf "\n# Funcionar como vim y no como vi\nset nocompatible\n\n# Colorear sintaxis\nsyntax on\ncolorscheme sienna\n\n# Otros seteos\n# Más info, desde vim poner: :help '<comando>'\nset backspace=2\nset wrapmargin=8\nset ruler\nset number\n" > ~/.vimrc

But I get this error: E488 in lines 2, 5 9 and 10.

The .vimrc file after the execution is:

# Funcionar como vim y no como vi
set nocompatible

# Colorear sintaxis
syntax on
colorscheme sienna

# Otros seteos
# Más info, desde vim poner: :help '<comando>'
set backspace=2
set wrapmargin=8
set ruler
set number

Thank you for your help.

  • 1
    # is not the comment character in vim. It is ". For example, " This is a comment – EvergreenTree Sep 5 '16 at 21:19
7

# is not a comment character, " is. So it should read:

" Funcionar como vim y no como vi
set nocompatible

" Colorear sintaxis
syntax on
colorscheme sienna

" Otros seteos
" Más info, desde vim poner: :help '<comando>'
set backspace=2
set wrapmargin=8
set ruler
set number

Yeah, it's a strange choice, but it is what it is.

The easiest way to fix this in your shell command is to switch the shell quotes to ':

printf '\n" Funcionar como [...]'

Learn Vimscript the Hard Way is a good resource to start learning Vim.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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