aboutsummaryrefslogtreecommitdiffhomepage
path: root/.vim/my/after/ftplugin/qf.vim
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2020-09-08 06:14:51 +0900
committernsfisis <nsfisis@gmail.com>2020-09-08 06:14:51 +0900
commitd2732d24689189f02d1b3680b5c560a678321564 (patch)
tree40a474a7efa3a3642e9f679fd0d98eac979bb044 /.vim/my/after/ftplugin/qf.vim
parent7574b72a50cf2f4658e7695afd3367fec028f5e1 (diff)
downloaddotfiles-d2732d24689189f02d1b3680b5c560a678321564.tar.gz
dotfiles-d2732d24689189f02d1b3680b5c560a678321564.tar.zst
dotfiles-d2732d24689189f02d1b3680b5c560a678321564.zip
Add .vim
Diffstat (limited to '.vim/my/after/ftplugin/qf.vim')
-rw-r--r--.vim/my/after/ftplugin/qf.vim40
1 files changed, 40 insertions, 0 deletions
diff --git a/.vim/my/after/ftplugin/qf.vim b/.vim/my/after/ftplugin/qf.vim
new file mode 100644
index 0000000..364759c
--- /dev/null
+++ b/.vim/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