From 1dbe682f99d170236ca9b04ae68c9a082ab80d60 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 5 Jul 2021 10:30:24 +0800 Subject: update --- vimrc | 25 +++++++++++++++++++++++++ zsh/_wg.zsh | 7 +++++++ 2 files changed, 32 insertions(+) create mode 100644 zsh/_wg.zsh diff --git a/vimrc b/vimrc index a9ef222..fe19803 100644 --- a/vimrc +++ b/vimrc @@ -107,6 +107,31 @@ autocmd FileType json setlocal foldmethod=syntax " Apply new SniptMat Parser let g:snipMate = { 'snippet_version' : 1 } +" Redirection with buffer +" Usage: +" :Redir hi ............. show the full output of command ':hi' in a scratch window +" :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window +function! Redir(cmd) + for win in range(1, winnr('$')) + if getwinvar(win, 'scratch') + execute win . 'windo close' + endif + endfor + if a:cmd =~ '^!' + let output = system(matchstr(a:cmd, '^!\zs.*')) + else + redir => output + execute a:cmd + redir END + endif + vnew + let w:scratch = 1 + setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile + call setline(1, split(output, "\n")) +endfunction + +command! -nargs=1 -complete=command Redir silent call Redir() + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Settings for Vimwiki """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/zsh/_wg.zsh b/zsh/_wg.zsh new file mode 100644 index 0000000..e914092 --- /dev/null +++ b/zsh/_wg.zsh @@ -0,0 +1,7 @@ +#compdef wg + +function _wg() { + compadd -S '' $(cd ~/vimwiki && ls ${words[2]}*) +} + +_wg -- cgit v1.2.3-70-g09d2