5

I am trying to write a beautify CSS command in vim that sorts and alphabetizes all of the CSS properties as well as checks to see if there is not a space after the colon and inserts one.

Here is my code:

nnoremap <leader>S :g#\({\n\)\@<=#.,/}/sort | %s/:\(\S\)/: \1/g<CR>
:command! SortCSSBraceContents :g#\({\n\)\@<=#.,/}/sort | %s/:\(\S\)/: \1/g              

These work independently. However, I am trying to pipe them into one command.

On save VIM says:

Error detected while processing /var/home/jesse-atkinson/.vimrc:
line  196:
E488: Trailing characters

Any ideas?

0
11

You need to replace your | characters in that line with <bar>.

What's happening is that Vim is executing that line as separate commands rather than creating a mapping from the whole line.

See: :help map_bar

0

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.