Add simple random number function.

This commit is contained in:
Chiel ten Brinke 2017-08-30 15:14:56 +02:00
parent c020f1680e
commit 3e26966412
2 changed files with 20 additions and 8 deletions

View File

@ -1,10 +1,5 @@
" Function for finding the formatters for this filetype " Function for finding the formatters for this filetype
" Result is stored in b:formatters " Result is stored in b:formatters
if !exists('g:autoformat_autoindent')
let g:autoformat_autoindent = 1
endif
function! s:find_formatters(...) function! s:find_formatters(...)
" Detect verbosity " Detect verbosity
let verbose = &verbose || g:autoformat_verbosemode == 1 let verbose = &verbose || g:autoformat_verbosemode == 1
@ -347,6 +342,3 @@ function! s:RemoveTrailingSpaces()
endtry endtry
endfunction endfunction
command! RemoveTrailingSpaces call s:RemoveTrailingSpaces() command! RemoveTrailingSpaces call s:RemoveTrailingSpaces()
" Put the uncopyable messages text into the buffer
command! PutMessages redir @" | messages | redir END | put

20
plugin/utils.vim Normal file
View File

@ -0,0 +1,20 @@
" Simple python-based random number generator
function! g:Random()
if has("python3")
python3 << EOF
import random
result = random.randrange(1, 1000000)
vim.command('return ' + str(result))
EOF
else
python << EOF
import random
result = random.randrange(1, 1000000)
vim.command('return ' + str(result))
EOF
endif
endfunction
" Put the uncopyable messages text into the buffer
command! PutMessages redir @" | messages | redir END | put