diff options
| author | nsfisis <nsfisis@gmail.com> | 2021-11-27 21:59:34 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2021-11-27 22:38:54 +0900 |
| commit | 17975ffc46cc18ca49304b4780f20a5b0b91e4ca (patch) | |
| tree | 00295b01bb6e92d32564fe205f5e1c7a3abca0b6 /.config/nvim/my/after/ftplugin/qf.vim | |
| parent | 318a31846d20cc80de090adee201de14965bf545 (diff) | |
| download | dotfiles-17975ffc46cc18ca49304b4780f20a5b0b91e4ca.tar.gz dotfiles-17975ffc46cc18ca49304b4780f20a5b0b91e4ca.tar.zst dotfiles-17975ffc46cc18ca49304b4780f20a5b0b91e4ca.zip | |
vim: minimize .vimrc
Diffstat (limited to '.config/nvim/my/after/ftplugin/qf.vim')
| -rw-r--r-- | .config/nvim/my/after/ftplugin/qf.vim | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/.config/nvim/my/after/ftplugin/qf.vim b/.config/nvim/my/after/ftplugin/qf.vim new file mode 100644 index 0000000..364759c --- /dev/null +++ b/.config/nvim/my/after/ftplugin/qf.vim @@ -0,0 +1,40 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_qf_after') + finish +endif + + + +nnoremap <buffer> p <Return>zz<C-w>p +nnoremap <silent> <buffer> dd :call <SID>del_entry()<Return> +xnoremap <silent> <buffer> d :call <SID>del_entry()<Return> +nnoremap <silent> <buffer> u :<C-u>call <SID>undo_entry()<Return> + + +if exists('*s:undo_entry') + finish +endif + + +function! s:undo_entry() + let history = get(w:, 'qf_history', []) + if !empty(history) + call setqflist(remove(history, -1), 'r') + endif +endfunction + +function! s:del_entry() range + let qf = getqflist() + let history = get(w:, 'qf_history', []) + call add(history, copy(qf)) + let w:qf_history = history + unlet! qf[a:firstline - 1 : a:lastline - 1] + call setqflist(qf, 'r') + execute a:firstline +endfunction + + + +let b:did_ftplugin_qf_after = 1 |
