summaryrefslogtreecommitdiff
path: root/config/vim/autoload/emmet/lorem
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2021-10-09 22:20:41 +0100
committerdavidovski <david@davidovski.xyz>2021-10-09 22:20:41 +0100
commit01ced0b7ce47d279789efb2dc70d1cd009ac56ad (patch)
tree6ece604b8ae3476d2d70c9c9d42f86fe607990da /config/vim/autoload/emmet/lorem
initial commit
Diffstat (limited to 'config/vim/autoload/emmet/lorem')
-rw-r--r--config/vim/autoload/emmet/lorem/en.vim65
-rw-r--r--config/vim/autoload/emmet/lorem/ja.vim27
2 files changed, 92 insertions, 0 deletions
diff --git a/config/vim/autoload/emmet/lorem/en.vim b/config/vim/autoload/emmet/lorem/en.vim
new file mode 100644
index 0000000..30713e4
--- /dev/null
+++ b/config/vim/autoload/emmet/lorem/en.vim
@@ -0,0 +1,65 @@
+function! emmet#lorem#en#expand(command) abort
+ let wcount = matchstr(a:command, '\(\d*\)$')
+ let wcount = wcount > 0 ? wcount : 30
+
+ let common = ['lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipisicing', 'elit']
+ let words = ['exercitationem', 'perferendis', 'perspiciatis', 'laborum', 'eveniet',
+ \ 'sunt', 'iure', 'nam', 'nobis', 'eum', 'cum', 'officiis', 'excepturi',
+ \ 'odio', 'consectetur', 'quasi', 'aut', 'quisquam', 'vel', 'eligendi',
+ \ 'itaque', 'non', 'odit', 'tempore', 'quaerat', 'dignissimos',
+ \ 'facilis', 'neque', 'nihil', 'expedita', 'vitae', 'vero', 'ipsum',
+ \ 'nisi', 'animi', 'cumque', 'pariatur', 'velit', 'modi', 'natus',
+ \ 'iusto', 'eaque', 'sequi', 'illo', 'sed', 'ex', 'et', 'voluptatibus',
+ \ 'tempora', 'veritatis', 'ratione', 'assumenda', 'incidunt', 'nostrum',
+ \ 'placeat', 'aliquid', 'fuga', 'provident', 'praesentium', 'rem',
+ \ 'necessitatibus', 'suscipit', 'adipisci', 'quidem', 'possimus',
+ \ 'voluptas', 'debitis', 'sint', 'accusantium', 'unde', 'sapiente',
+ \ 'voluptate', 'qui', 'aspernatur', 'laudantium', 'soluta', 'amet',
+ \ 'quo', 'aliquam', 'saepe', 'culpa', 'libero', 'ipsa', 'dicta',
+ \ 'reiciendis', 'nesciunt', 'doloribus', 'autem', 'impedit', 'minima',
+ \ 'maiores', 'repudiandae', 'ipsam', 'obcaecati', 'ullam', 'enim',
+ \ 'totam', 'delectus', 'ducimus', 'quis', 'voluptates', 'dolores',
+ \ 'molestiae', 'harum', 'dolorem', 'quia', 'voluptatem', 'molestias',
+ \ 'magni', 'distinctio', 'omnis', 'illum', 'dolorum', 'voluptatum', 'ea',
+ \ 'quas', 'quam', 'corporis', 'quae', 'blanditiis', 'atque', 'deserunt',
+ \ 'laboriosam', 'earum', 'consequuntur', 'hic', 'cupiditate',
+ \ 'quibusdam', 'accusamus', 'ut', 'rerum', 'error', 'minus', 'eius',
+ \ 'ab', 'ad', 'nemo', 'fugit', 'officia', 'at', 'in', 'id', 'quos',
+ \ 'reprehenderit', 'numquam', 'iste', 'fugiat', 'sit', 'inventore',
+ \ 'beatae', 'repellendus', 'magnam', 'recusandae', 'quod', 'explicabo',
+ \ 'doloremque', 'aperiam', 'consequatur', 'asperiores', 'commodi',
+ \ 'optio', 'dolor', 'labore', 'temporibus', 'repellat', 'veniam',
+ \ 'architecto', 'est', 'esse', 'mollitia', 'nulla', 'a', 'similique',
+ \ 'eos', 'alias', 'dolore', 'tenetur', 'deleniti', 'porro', 'facere',
+ \ 'maxime', 'corrupti']
+ let ret = []
+ let sentence = 0
+ for i in range(wcount)
+ let arr = common
+ if sentence > 0
+ let arr += words
+ endif
+ let r = emmet#util#rand()
+ let word = arr[r % len(arr)]
+ if sentence == 0
+ let word = substitute(word, '^.', '\U&', '')
+ endif
+ let sentence += 1
+ call add(ret, word)
+ if (sentence > 5 && emmet#util#rand() < 10000) || i == wcount - 1
+ if i == wcount - 1
+ let endc = '?!...'[emmet#util#rand() % 5]
+ call add(ret, endc)
+ else
+ let endc = '?!,...'[emmet#util#rand() % 6]
+ call add(ret, endc . ' ')
+ endif
+ if endc !=# ','
+ let sentence = 0
+ endif
+ else
+ call add(ret, ' ')
+ endif
+ endfor
+ return join(ret, '')
+endfunction
diff --git a/config/vim/autoload/emmet/lorem/ja.vim b/config/vim/autoload/emmet/lorem/ja.vim
new file mode 100644
index 0000000..f99d8fa
--- /dev/null
+++ b/config/vim/autoload/emmet/lorem/ja.vim
@@ -0,0 +1,27 @@
+scriptencoding utf-8
+
+function! emmet#lorem#ja#expand(command) abort
+ let wcount = matchstr(a:command, '^\%(lorem\|lipsum\)\(\d*\)}$', '\1', '')
+ let wcount = wcount > 0 ? wcount : 30
+
+ let url = "http://www.aozora.gr.jp/cards/000081/files/470_15407.html"
+ let content = emmet#util#cache(url)
+ if len(content) == 0
+ let content = emmet#util#getContentFromURL(url)
+ let content = matchstr(content, '<div[^>]*>\zs.\{-}</div>')
+ let content = substitute(content, '[ \r]', '', 'g')
+ let content = substitute(content, '<br[^>]*>', "\n", 'g')
+ let content = substitute(content, '<[^>]\+>', '', 'g')
+ let content = join(filter(split(content, "\n"), 'len(v:val)>0'), "\n")
+ call emmet#util#cache(url, content)
+ endif
+
+ let content = substitute(content, "、\n", "、", "g")
+ let clines = split(content, '\n')
+ let lines = filter(clines, 'len(substitute(v:val,".",".","g"))<=wcount')
+ if len(lines) == 0
+ let lines = clines
+ endif
+ let r = emmet#util#rand()
+ return lines[r % len(lines)]
+endfunction