AdamW
AdamW

Reputation: 184

Vim Shell Command Confusion

I'm running gVim under Win 7. I have this alias to compile my LESS file

cnoremap less  !lessc % > %<.css

Works fine. But when I try to put a write command in front of it

 cnoremap less w<CR> !lessc % > %<.css

it puts this command string

.!essc % > %<.css

on the command line. If I try the command sequence directly by putting

:w<CR> !lessc % > %<.css

on the command line, it seems to send the correct command to cmd.exe but tells me it can't open the .css file for writing (even if there isn't one already present.

I've tried concatenating the commands with the | operator but that worked even worse.

Totaly confused here. Would appreciate any help.

Thanks

Upvotes: 0

Views: 34

Answers (1)

ephemient
ephemient

Reputation: 204738

If you

:set aw

(:help 'autowrite') then you don't need the :w before :!.

:cnoremap less w \| !lessc % > %<.css

should work too.

Upvotes: 1

Related Questions