add command for guids

This commit is contained in:
Alex Yatskov 2019-11-11 20:09:43 -08:00
parent 9cdbaed470
commit aec3ecc838
2 changed files with 19 additions and 0 deletions

View File

@ -9,3 +9,19 @@ function! s:unalign() range
endfunction
command! -range UnAlign <line1>,<line2>call s:unalign()
function! s:guid()
if has('pythonx')
pythonx import uuid
let l:guid = pyxeval('str(uuid.uuid4())')
elseif has('windows')
let l:guid = system('powershell.exe -command "[guid]::NewGuid().ToString()"')
endif
if exists('l:guid')
execute 'normal! a' . l:guid . "\<Esc>"
else
echoerr 'No GUID provider available'
endif
endfunction
command! Guid call s:guid()

View File

@ -35,6 +35,9 @@ nnoremap <C-l> <C-W>l
nnoremap j gj
nnoremap k gk
" functions
nnoremap <Leader>g :Guid<Cr>
" fzf
nnoremap <silent><Leader>fg :GFiles<Cr>
nnoremap <silent><Leader>ff :Files ~<Cr>