diff --git a/autoload/dash.vim b/autoload/dash.vim index 2fd898e..f5db0a6 100644 --- a/autoload/dash.vim +++ b/autoload/dash.vim @@ -50,9 +50,11 @@ endfunction "}}} function! dash#keywords(...) "{{{ - let keywords = copy(a:000) - call filter(keywords, 'index(s:cache.keywords(), v:val) != -1') - let b:dash_keywords = keywords + if a:0 == 0 + call s:show_buffer_keywords() + else + call s:set_buffer_keywords(a:000) + endif endfunction "}}} @@ -119,4 +121,21 @@ function! s:search(term, keywords) "{{{ endfunction "}}} +function! s:set_buffer_keywords(keyword_list) "{{{ + let keywords = copy(a:keyword_list) + call filter(keywords, 'index(s:cache.keywords(), v:val) != -1') + let b:dash_keywords = keywords +endfunction +"}}} + +function! s:show_buffer_keywords() "{{{ + redraw + if !exists("b:dash_keywords") || empty(b:dash_keywords) + echo "There are no keywords set for the current buffer." + else + echo "Keywords: " . join(b:dash_keywords, " ") + endif +endfunction +"}}} + call s:extend_keywords_map() diff --git a/plugin/dash.vim b/plugin/dash.vim index 80581f7..4a3de5c 100644 --- a/plugin/dash.vim +++ b/plugin/dash.vim @@ -49,7 +49,7 @@ if exists(':DashKeywords') == 2 echomsg 'dash.vim: could not create command DashKeywords' echohl None else - command -complete=customlist,dash#complete -nargs=+ DashKeywords call dash#keywords() + command -complete=customlist,dash#complete -nargs=* DashKeywords call dash#keywords() endif "}}}