diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index 5ae1b5cbf..9dfa2f1f9 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -930,7 +930,7 @@ endfunction function! s:save_current_file() abort let v:errmsg = '' - silent! update + silent! write if v:errmsg !=# '' echohl ErrorMsg echo v:errmsg diff --git a/lua/spacevim/plugin/todo.lua b/lua/spacevim/plugin/todo.lua index e30863a3c..1554cb609 100644 --- a/lua/spacevim/plugin/todo.lua +++ b/lua/spacevim/plugin/todo.lua @@ -91,6 +91,27 @@ local function open_todo() -- {{{ vim.cmd('noautocmd normal! :') end -- }}} +-- +local function apply_to_quickfix() -- {{{ + local qf = {} + for _, v in ipairs(todos) do + table.insert(qf, { + filename = v.file, + lnum = v.line, + col = v.column, + text = v.title, + type = v.label, + }) + end + vim.fn.setqflist({}, 'r', { + title = 'Todos', + items = qf, + }) + vim.cmd('close') + vim.cmd(winnr .. 'wincmd w') + vim.cmd('botright copen') +end +-- }}} local function indexof(t, v) -- {{{ for i, x in ipairs(t) do @@ -158,7 +179,6 @@ local function on_exit(id, data, event) -- {{{ end -- }}} - -- labels to command line regex local function get_labels_regex() -- {{{ local sep = '' @@ -255,6 +275,9 @@ local function open_win() -- {{{ vim.api.nvim_buf_set_keymap(bufnr, 'n', '', '', { callback = open_todo, }) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '', '', { + callback = apply_to_quickfix, + }) end -- }}}