summaryrefslogtreecommitdiff
path: root/plugin/vdebug.vim
diff options
context:
space:
mode:
authorBlackEagle <ike.devolder@gmail.com>2017-03-23 16:15:02 +0100
committerBlackEagle <ike.devolder@gmail.com>2017-03-23 16:15:02 +0100
commit277a063f31af85581cb052b94e302d646dbf3a60 (patch)
tree0eabc992b8bf3eb7d28e3bc17c05a6a49bab8cc7 /plugin/vdebug.vim
parent85358d9ae1d21be268380931820720d9a66fe809 (diff)
parent4ec54eda078bef26f4ac68242e8648fc243b8514 (diff)
downloadvdebug-277a063f31af85581cb052b94e302d646dbf3a60.zip
Merge branch 'fix_uninitialized_param_dictionary' of https://github.com/Dudemullet/vdebug into v2-integration
* 'fix_uninitialized_param_dictionary' of https://github.com/Dudemullet/vdebug: Extracts the get_options method from load_options Moves g:vdebug_options_ to a variables and gets its len for later use Looks for params using the default param key names Signed-off-by: BlackEagle <ike.devolder@gmail.com>
Diffstat (limited to 'plugin/vdebug.vim')
-rw-r--r--plugin/vdebug.vim33
1 files changed, 32 insertions, 1 deletions
diff --git a/plugin/vdebug.vim b/plugin/vdebug.vim
index 8af3532..1b125da 100644
--- a/plugin/vdebug.vim
+++ b/plugin/vdebug.vim
@@ -9,7 +9,7 @@
" Perl, NodeJS)
" Maintainer: Jon Cairns <jon at joncairns.com>
" Version: 1.4.1
-" Inspired by the Xdebug plugin, which was originally written by
+" Inspired by the Xdebug plugin, which was originally written by
" Seung Woo Shin <segv <at> sayclub.com> and extended by many
" others.
" Usage: Use :help Vdebug for information on how to configure and use
@@ -171,9 +171,40 @@ endfunction
function! Vdebug_load_options(options)
" Merge options with defaults
let g:vdebug_options = extend(g:vdebug_options_defaults, a:options)
+
+ " Override with single defined params ie. g:vdebug_options_port
+ let single_defined_params = s:Vdebug_get_options()
+ let g:vdebug_options = extend(g:vdebug_options, single_defined_params)
+
exe ":python debugger.reload_options()"
endfunction
+" Get options defined outside of the vdebug_options dictionary
+"
+" This helps for when users might want to define a single option by itself
+" without needing the ditionary ie. vdebug_options_port = 9000
+function! s:Vdebug_get_options()
+ let param_namespace = "g:vdebug_options_"
+ let param_namespace_len = strlen(param_namespace)
+
+ " Get the paramter names and concat the g:vdebug_options namespace
+ let parameters = map(keys(g:vdebug_options_defaults), 'param_namespace.v:val')
+
+ " Only use the defined parameters
+ let existing_params = filter(parameters, 'exists(v:val)')
+
+ " put into a dictionary for use with extend()
+ let params = {}
+ for name in existing_params
+ let val = eval(name)
+
+ " Remove g:vdebug_options namespace from param
+ let name = strpart(name, param_namespace_len)
+ let params[name] = val
+ endfor
+ return params
+endfunction
+
" Assign keymappings, and merge with defaults.
"
" This should be called if you want to update the keymappings after vdebug has