From 3e26966412c03e3664c3e3b43c3f8d15dd73f34e Mon Sep 17 00:00:00 2001 From: Chiel ten Brinke Date: Wed, 30 Aug 2017 15:14:56 +0200 Subject: [PATCH] Add simple random number function. --- plugin/autoformat.vim | 8 -------- plugin/utils.vim | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 plugin/utils.vim diff --git a/plugin/autoformat.vim b/plugin/autoformat.vim index f4fa25f..fb4283e 100644 --- a/plugin/autoformat.vim +++ b/plugin/autoformat.vim @@ -1,10 +1,5 @@ " Function for finding the formatters for this filetype " Result is stored in b:formatters - -if !exists('g:autoformat_autoindent') - let g:autoformat_autoindent = 1 -endif - function! s:find_formatters(...) " Detect verbosity let verbose = &verbose || g:autoformat_verbosemode == 1 @@ -347,6 +342,3 @@ function! s:RemoveTrailingSpaces() endtry endfunction command! RemoveTrailingSpaces call s:RemoveTrailingSpaces() - -" Put the uncopyable messages text into the buffer -command! PutMessages redir @" | messages | redir END | put diff --git a/plugin/utils.vim b/plugin/utils.vim new file mode 100644 index 0000000..1a22b8d --- /dev/null +++ b/plugin/utils.vim @@ -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