mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-04 11:00:06 +08:00
d05566c901
* Add text insertion commands * Add password api * Implement SPC i p * * Add mapping for uuidgen * Add SPC i l l for insert lorem-ipsum list * Add SPC i l p for insert lorem-ipsum paragraph * Add SPC i l s for insert lorem-ipsum sentence * Fix lint
82 lines
2.3 KiB
VimL
82 lines
2.3 KiB
VimL
let s:self = {}
|
|
|
|
let s:NUMBER = SpaceVim#api#import('data#number')
|
|
let s:STRING = SpaceVim#api#import('data#string')
|
|
|
|
function! s:self.generate_simple(len) abort
|
|
let temp = s:STRING.string2chars('abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
|
let ps = []
|
|
" random(0,len_temp)
|
|
let i = 0
|
|
while i < str2nr(a:len)
|
|
call add(ps, temp[s:NUMBER.random(0, len(temp))])
|
|
let i += 1
|
|
endwhile
|
|
return join(ps, '')
|
|
endfunction
|
|
|
|
function! s:self.generate_strong(len) abort
|
|
let temp = s:STRING.string2chars('abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ_@!.^%,&-')
|
|
let ps = []
|
|
" random(0,len_temp)
|
|
let i = 0
|
|
while i < str2nr(a:len)
|
|
call add(ps, temp[s:NUMBER.random(0, len(temp))])
|
|
let i += 1
|
|
endwhile
|
|
return join(ps, '')
|
|
endfunction
|
|
|
|
function! s:self.generate_paranoid(len) abort
|
|
let temp = s:STRING.string2chars('abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_-+=/?,.><[]{}~')
|
|
let ps = []
|
|
" random(0,len_temp)
|
|
let i = 0
|
|
while i < str2nr(a:len)
|
|
call add(ps, temp[s:NUMBER.random(0, len(temp))])
|
|
let i += 1
|
|
endwhile
|
|
return join(ps, '')
|
|
endfunction
|
|
|
|
function! s:self.generate_numeric(len) abort
|
|
let temp = s:STRING.string2chars('0123456789')
|
|
let ps = []
|
|
" random(0,len_temp)
|
|
let i = 0
|
|
while i < str2nr(a:len)
|
|
call add(ps, temp[s:NUMBER.random(0, len(temp))])
|
|
let i += 1
|
|
endwhile
|
|
return join(ps, '')
|
|
endfunction
|
|
|
|
function! s:self.generate_phonetic(len) abort
|
|
let temp_A = s:STRING.string2chars('eyuioa')
|
|
let temp_B = s:STRING.string2chars('wrtpsdfghjkzxcvbnm')
|
|
let temp_N = s:STRING.string2chars('123456789')
|
|
let type = 1
|
|
|
|
let ps = []
|
|
" random(0,len_temp)
|
|
let i = 0
|
|
while i < str2nr(a:len)
|
|
if type == 1
|
|
call add(ps, temp_A[s:NUMBER.random(0, len(temp_A))])
|
|
let type = 2
|
|
elseif type == 2
|
|
call add(ps, temp_B[s:NUMBER.random(0, len(temp_B))])
|
|
let type = 3
|
|
elseif type == 3
|
|
call add(ps, temp_N[s:NUMBER.random(0, len(temp_N))])
|
|
let type = 1
|
|
endif
|
|
let i += 1
|
|
endwhile
|
|
return join(ps, '')
|
|
endfunction
|
|
|
|
function! SpaceVim#api#password#get() abort
|
|
return deepcopy(s:self)
|
|
endfunction
|