dotvim/.vim/functions.vim

28 lines
779 B
VimL
Raw Normal View History

auto BufRead,BufNewFile *.gohtml setfiletype html
2015-02-18 09:25:46 +00:00
function! s:unalign() range
for l:line in range(a:firstline, a:lastline)
let l:text = getline(l:line)
let l:subst = substitute(l:text, '\(\S\+\)\s\{2,}', '\1 ', 'g')
call setline(l:line, l:subst)
endfor
endfunction
command! -range UnAlign <line1>,<line2>call s:unalign()
2019-11-12 04:09:43 +00:00
function! s:guid()
if has('pythonx')
pythonx import uuid
let l:guid = pyxeval('str(uuid.uuid4())')
elseif has('windows')
2019-11-12 04:18:54 +00:00
let l:guid = system('powershell.exe -command "[guid]::NewGuid().ToString()"')[:-2]
2019-11-12 04:09:43 +00:00
endif
if exists('l:guid')
execute 'normal! a' . l:guid . "\<Esc>"
else
echoerr 'No GUID provider available'
endif
endfunction
command! Guid call s:guid()