diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index e1c0c8fcd..6bbeb026b 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -1278,6 +1278,17 @@ let g:spacevim_commandline_prompt = '>' " Option for setting todo labels in current project. let g:spacevim_todo_labels = ['fixme', 'question', 'todo', 'idea'] +"" +" @section todo_close_list, options-close_list +" @parentsection options +" Option for setting todo windows behavior when open item in todo list. +" Default is `true`, set to `false` will not close todo windows. + +"" +" Option for setting todo windows behavior when open item in todo list. +" Default is 1, set to 0 will not close todo windows. +let g:spacevim_todo_close_list = 0 + "" " @section todo_prefix, options-todo_prefix " @parentsection options diff --git a/autoload/SpaceVim/plugins/todo.vim b/autoload/SpaceVim/plugins/todo.vim index 432b46276..e98f5a92a 100644 --- a/autoload/SpaceVim/plugins/todo.vim +++ b/autoload/SpaceVim/plugins/todo.vim @@ -166,10 +166,12 @@ endfunction function! s:open_todo() abort let todo = s:todos[line('.') - 1] - try - close - catch - endtry + if g:spacevim_todo_close_list + try + close + catch + endtry + endif exe s:winnr . 'wincmd w' exe 'e ' . todo.file call cursor(todo.line, todo.column) @@ -191,7 +193,7 @@ function! s:get_labels_regex() endif return join(map(copy(s:labels), "s:prefix . v:val . '\\b'"), - \ separator) + \ separator) endfunc function! s:get_labels_pattern() diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 612d7a753..a87c27bf5 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -83,16 +83,17 @@ CONTENTS *SpaceVim-contents* 63. statusline_separator.........|SpaceVim-options-statusline_separator| 64. statusline_unicode.............|SpaceVim-options-statusline_unicode| 65. terminal_cursor_shape.......|SpaceVim-options-terminal_cursor_shape| - 66. todo_labels...........................|SpaceVim-options-todo_labels| - 67. todo_prefix...........................|SpaceVim-options-todo_prefix| - 68. vim_help_language...............|SpaceVim-options-vim_help_language| - 69. vimcompatible.......................|SpaceVim-options-vimcompatible| - 70. warning_symbol.....................|SpaceVim-options-warning_symbol| - 71. wildignore.............................|SpaceVim-options-wildignore| - 72. windisk_encoding.................|SpaceVim-options-windisk_encoding| - 73. windows_index_type.............|SpaceVim-options-windows_index_type| - 74. windows_leader.....................|SpaceVim-options-windows_leader| - 75. windows_smartclose.............|SpaceVim-options-windows_smartclose| + 66. todo_close_list........................|SpaceVim-options-close_list| + 67. todo_labels...........................|SpaceVim-options-todo_labels| + 68. todo_prefix...........................|SpaceVim-options-todo_prefix| + 69. vim_help_language...............|SpaceVim-options-vim_help_language| + 70. vimcompatible.......................|SpaceVim-options-vimcompatible| + 71. warning_symbol.....................|SpaceVim-options-warning_symbol| + 72. wildignore.............................|SpaceVim-options-wildignore| + 73. windisk_encoding.................|SpaceVim-options-windisk_encoding| + 74. windows_index_type.............|SpaceVim-options-windows_index_type| + 75. windows_leader.....................|SpaceVim-options-windows_leader| + 76. windows_smartclose.............|SpaceVim-options-windows_smartclose| 3. Configuration...........................................|SpaceVim-config| 4. Commands..............................................|SpaceVim-commands| 5. Public functions.....................................|SpaceVim-functions| @@ -927,6 +928,12 @@ the following to ~/.tmux.conf: set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' < +============================================================================== +TODO_CLOSE_LIST *SpaceVim-options-close_list* + +Option for setting todo windows behavior when open item in todo list. Default +is `true`, set to `false` will not close todo windows. + ============================================================================== TODO_LABELS *SpaceVim-options-todo_labels* @@ -1531,6 +1538,10 @@ Config the command line prompt for flygrep and denite etc. *g:spacevim_todo_labels* Option for setting todo labels in current project. + *g:spacevim_todo_close_list* +Option for setting todo windows behavior when open item in todo list. Default +is 1, set to 0 will not close todo windows. + *g:spacevim_lint_on_the_fly* Enable/Disable lint on the fly feature of SpaceVim's maker. Default is 0. > diff --git a/lua/spacevim/plugin/todo.lua b/lua/spacevim/plugin/todo.lua index 76a9ef4b6..fc36cdee0 100644 --- a/lua/spacevim/plugin/todo.lua +++ b/lua/spacevim/plugin/todo.lua @@ -86,7 +86,9 @@ end -- }}} local function open_todo() -- {{{ local t = todos[vim.fn.line('.')] - vim.cmd('close') + if vim.g.spacevim_todo_close_list == 1 or vim.g.spacevim_todo_close_list == true then + vim.cmd('close') + end vim.cmd(winnr .. 'wincmd w') vim.cmd('e ' .. t.file) vim.fn.cursor(t.line, t.column)