forked from csscomb/vim-csscomb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcsscomb.vim
More file actions
23 lines (19 loc) · 779 Bytes
/
csscomb.vim
File metadata and controls
23 lines (19 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"=============================================================================
" File: csscomb.vim
" Author: Aleksandr Batsuev (alex@batsuev.com)
" WebPage: https://github.com/batsuev/csscomb-vim
" License: MIT
let g:CSScombPluginDir = fnamemodify(expand("<sfile>"), ":h")
function! g:CSScomb(count, line1, line2)
let content = getline(a:line1, a:line2)
let tempFile = tempname() . '.' . &filetype
call writefile(content, tempFile)
let systemOutput = system('csscomb ' . shellescape(tempFile))
if len(systemOutput)
echoerr split(systemOutput, "\n")[1]
else
let lines = readfile(tempFile)
call setline(a:line1, lines)
endif
endfunction
command! -nargs=? -range=% CSScomb :call g:CSScomb(<count>, <line1>, <line2>, <f-args>)