mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 23:10:06 +08:00
feat(todo): add todo_close_list
option
This commit is contained in:
parent
714e3b41ca
commit
833c9ac3d0
@ -1278,6 +1278,17 @@ let g:spacevim_commandline_prompt = '>'
|
|||||||
" Option for setting todo labels in current project.
|
" Option for setting todo labels in current project.
|
||||||
let g:spacevim_todo_labels = ['fixme', 'question', 'todo', 'idea']
|
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
|
" @section todo_prefix, options-todo_prefix
|
||||||
" @parentsection options
|
" @parentsection options
|
||||||
|
@ -166,10 +166,12 @@ endfunction
|
|||||||
|
|
||||||
function! s:open_todo() abort
|
function! s:open_todo() abort
|
||||||
let todo = s:todos[line('.') - 1]
|
let todo = s:todos[line('.') - 1]
|
||||||
try
|
if g:spacevim_todo_close_list
|
||||||
close
|
try
|
||||||
catch
|
close
|
||||||
endtry
|
catch
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
exe s:winnr . 'wincmd w'
|
exe s:winnr . 'wincmd w'
|
||||||
exe 'e ' . todo.file
|
exe 'e ' . todo.file
|
||||||
call cursor(todo.line, todo.column)
|
call cursor(todo.line, todo.column)
|
||||||
@ -191,7 +193,7 @@ function! s:get_labels_regex()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
return join(map(copy(s:labels), "s:prefix . v:val . '\\b'"),
|
return join(map(copy(s:labels), "s:prefix . v:val . '\\b'"),
|
||||||
\ separator)
|
\ separator)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! s:get_labels_pattern()
|
function! s:get_labels_pattern()
|
||||||
|
@ -83,16 +83,17 @@ CONTENTS *SpaceVim-contents*
|
|||||||
63. statusline_separator.........|SpaceVim-options-statusline_separator|
|
63. statusline_separator.........|SpaceVim-options-statusline_separator|
|
||||||
64. statusline_unicode.............|SpaceVim-options-statusline_unicode|
|
64. statusline_unicode.............|SpaceVim-options-statusline_unicode|
|
||||||
65. terminal_cursor_shape.......|SpaceVim-options-terminal_cursor_shape|
|
65. terminal_cursor_shape.......|SpaceVim-options-terminal_cursor_shape|
|
||||||
66. todo_labels...........................|SpaceVim-options-todo_labels|
|
66. todo_close_list........................|SpaceVim-options-close_list|
|
||||||
67. todo_prefix...........................|SpaceVim-options-todo_prefix|
|
67. todo_labels...........................|SpaceVim-options-todo_labels|
|
||||||
68. vim_help_language...............|SpaceVim-options-vim_help_language|
|
68. todo_prefix...........................|SpaceVim-options-todo_prefix|
|
||||||
69. vimcompatible.......................|SpaceVim-options-vimcompatible|
|
69. vim_help_language...............|SpaceVim-options-vim_help_language|
|
||||||
70. warning_symbol.....................|SpaceVim-options-warning_symbol|
|
70. vimcompatible.......................|SpaceVim-options-vimcompatible|
|
||||||
71. wildignore.............................|SpaceVim-options-wildignore|
|
71. warning_symbol.....................|SpaceVim-options-warning_symbol|
|
||||||
72. windisk_encoding.................|SpaceVim-options-windisk_encoding|
|
72. wildignore.............................|SpaceVim-options-wildignore|
|
||||||
73. windows_index_type.............|SpaceVim-options-windows_index_type|
|
73. windisk_encoding.................|SpaceVim-options-windisk_encoding|
|
||||||
74. windows_leader.....................|SpaceVim-options-windows_leader|
|
74. windows_index_type.............|SpaceVim-options-windows_index_type|
|
||||||
75. windows_smartclose.............|SpaceVim-options-windows_smartclose|
|
75. windows_leader.....................|SpaceVim-options-windows_leader|
|
||||||
|
76. windows_smartclose.............|SpaceVim-options-windows_smartclose|
|
||||||
3. Configuration...........................................|SpaceVim-config|
|
3. Configuration...........................................|SpaceVim-config|
|
||||||
4. Commands..............................................|SpaceVim-commands|
|
4. Commands..............................................|SpaceVim-commands|
|
||||||
5. Public functions.....................................|SpaceVim-functions|
|
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'
|
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*
|
TODO_LABELS *SpaceVim-options-todo_labels*
|
||||||
|
|
||||||
@ -1531,6 +1538,10 @@ Config the command line prompt for flygrep and denite etc.
|
|||||||
*g:spacevim_todo_labels*
|
*g:spacevim_todo_labels*
|
||||||
Option for setting todo labels in current project.
|
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*
|
*g:spacevim_lint_on_the_fly*
|
||||||
Enable/Disable lint on the fly feature of SpaceVim's maker. Default is 0.
|
Enable/Disable lint on the fly feature of SpaceVim's maker. Default is 0.
|
||||||
>
|
>
|
||||||
|
@ -86,7 +86,9 @@ end
|
|||||||
-- }}}
|
-- }}}
|
||||||
local function open_todo() -- {{{
|
local function open_todo() -- {{{
|
||||||
local t = todos[vim.fn.line('.')]
|
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(winnr .. 'wincmd w')
|
||||||
vim.cmd('e ' .. t.file)
|
vim.cmd('e ' .. t.file)
|
||||||
vim.fn.cursor(t.line, t.column)
|
vim.fn.cursor(t.line, t.column)
|
||||||
|
Loading…
Reference in New Issue
Block a user