From 4ae4cad290e588ae157e22d12344489671aef9c8 Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Wed, 3 Apr 2019 22:01:31 +0800 Subject: [PATCH] Fix defx --- config/plugins/defx.vim | 29 +++++++++++++++++------------ doc/SpaceVim.txt | 29 ++++++++++++++++++++++------- test.py | 26 ++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 19 deletions(-) create mode 100644 test.py diff --git a/config/plugins/defx.vim b/config/plugins/defx.vim index aeae10bca..e34c7b4d4 100644 --- a/config/plugins/defx.vim +++ b/config/plugins/defx.vim @@ -134,28 +134,33 @@ function! s:defx_init() \ defx#do_action('change_vim_cwd') endf +" in this function we should vim-choosewin if possible function! DefxSmartL(_) if defx#is_directory() call defx#call_action('open_tree') normal! j else let filepath = defx#get_candidate()['action__path'] - if tabpagewinnr(tabpagenr(), '$') >= 3 - if has('nvim') - let input = input({ - \ 'prompt' : 'ChooseWin No.: ', - \ 'cancelreturn': 0, - \ }) - if input == 0 | return | endif + if tabpagewinnr(tabpagenr(), '$') >= 3 " if there are more than 2 normal windows + if exists(':ChooseWin') == 2 + ChooseWin else - let input = input('ChooseWin No.: ') + if has('nvim') + let input = input({ + \ 'prompt' : 'ChooseWin No.: ', + \ 'cancelreturn': 0, + \ }) + if input == 0 | return | endif + else + let input = input('ChooseWin No.: ') + endif + if input == winnr() | return | endif + exec input . 'wincmd w' endif - if input == winnr() | return | endif - exec ': ' . input . 'wincmd w' - exec ':e' . filepath + exec 'e' filepath else exec 'wincmd w' - exec ':e' . filepath + exec 'e' filepath endif endif endfunction diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index f9fe1a0c4..67103868f 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -32,13 +32,14 @@ CONTENTS *SpaceVim-contents* 12. guifont...................................|SpaceVim-options-guifont| 13. lint_on_the_fly...................|SpaceVim-options-lint_on_the_fly| 14. max_column.............................|SpaceVim-options-max_column| - 15. plugin_bundle_dir...............|SpaceVim-options-plugin_bundle_dir| - 16. plugin_manager_processes.|SpaceVim-options-plugin_manager_processes| - 17. realtime_leader_guide.......|SpaceVim-options-realtime_leader_guide| - 18. relativenumber.....................|SpaceVim-options-relativenumber| - 19. sidebar_width.......................|SpaceVim-options-sidebar_width| - 20. snippet_engine.....................|SpaceVim-options-snippet_engine| - 21. windows_leader.....................|SpaceVim-options-windows_leader| + 15. max_column......................|SpaceVim-options-home_files_number| + 16. plugin_bundle_dir...............|SpaceVim-options-plugin_bundle_dir| + 17. plugin_manager_processes.|SpaceVim-options-plugin_manager_processes| + 18. realtime_leader_guide.......|SpaceVim-options-realtime_leader_guide| + 19. relativenumber.....................|SpaceVim-options-relativenumber| + 20. sidebar_width.......................|SpaceVim-options-sidebar_width| + 21. snippet_engine.....................|SpaceVim-options-snippet_engine| + 22. windows_leader.....................|SpaceVim-options-windows_leader| 3. Configuration...........................................|SpaceVim-config| 4. Commands..............................................|SpaceVim-commands| 5. Functions............................................|SpaceVim-functions| @@ -230,6 +231,14 @@ Change the max number of columns for SpaceVim. Default is 120. max_column = 120 < +============================================================================== +MAX_COLUMN *SpaceVim-options-home_files_number* + +Change the list number of files for SpaceVim home. Default is 6. +> + home_files_number = 6 +< + ============================================================================== PLUGIN_BUNDLE_DIR *SpaceVim-options-plugin_bundle_dir* @@ -311,6 +320,12 @@ Change the max number of columns for SpaceVim. Default is 120. let g:spacevim_max_column = 120 < + *g:spacevim_home_files_number* +Change the list number of files for SpaceVim home. Default is 6. +> + let g:spacevim_home_files_number = 6 +< + *g:spacevim_enable_guicolors* Enable true color support in terminal. Default is 1. > diff --git a/test.py b/test.py new file mode 100644 index 000000000..0e515b626 --- /dev/null +++ b/test.py @@ -0,0 +1,26 @@ +import io +import sys +sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') + + +def pv_f(c, r, n, when=1): + import numpy as np #导入numpy库 + c = np.array(c) + r = np.array(r) + if when == 1: + n = np.arange(1, n + 1) + else: + n = np.arange(0, n) + pv = c / (1 + r)**n + return pv.sum() + + +c = 20000 +r = 0.05 +n = 5 +#调用前文定义的函数pv_f(c,r,n,when=1) +pv1 = pv_f(c, r, n, when=1) +print("普通年金现值(年末):%.2f" % pv1) +#如果是预付年金,则when=0 +pv2 = pv_f(c, r, n, when=0) +print("预付年金现值(年初):%.2f" % pv2)