aboutsummaryrefslogtreecommitdiffhomepage
path: root/vimrc
diff options
context:
space:
mode:
authorHsieh Chin Fan <typebrook@gmail.com>2021-07-05 10:30:24 +0800
committerHsieh Chin Fan <typebrook@gmail.com>2021-07-05 10:30:24 +0800
commit1dbe682f99d170236ca9b04ae68c9a082ab80d60 (patch)
tree4c6b406c1e336bce06dcf3dc4cb43143478d975f /vimrc
parentf3050ed46a1813b30a0d29e8a5397e1243f20e62 (diff)
update
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc25
1 files changed, 25 insertions, 0 deletions
diff --git a/vimrc b/vimrc
index a9ef222..fe19803 100644
--- a/vimrc
+++ b/vimrc
@@ -107,6 +107,31 @@ autocmd FileType json setlocal foldmethod=syntax
107" Apply new SniptMat Parser 107" Apply new SniptMat Parser
108let g:snipMate = { 'snippet_version' : 1 } 108let g:snipMate = { 'snippet_version' : 1 }
109 109
110" Redirection with buffer
111" Usage:
112" :Redir hi ............. show the full output of command ':hi' in a scratch window
113" :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window
114function! Redir(cmd)
115 for win in range(1, winnr('$'))
116 if getwinvar(win, 'scratch')
117 execute win . 'windo close'
118 endif
119 endfor
120 if a:cmd =~ '^!'
121 let output = system(matchstr(a:cmd, '^!\zs.*'))
122 else
123 redir => output
124 execute a:cmd
125 redir END
126 endif
127 vnew
128 let w:scratch = 1
129 setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile
130 call setline(1, split(output, "\n"))
131endfunction
132
133command! -nargs=1 -complete=command Redir silent call Redir(<q-args>)
134
110""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 135"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
111" => Settings for Vimwiki 136" => Settings for Vimwiki
112""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 137"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""