diff options
-rw-r--r-- | vimrc | 25 | ||||
-rw-r--r-- | zsh/_wg.zsh | 7 |
2 files changed, 32 insertions, 0 deletions
@@ -107,6 +107,31 @@ autocmd FileType json setlocal foldmethod=syntax | |||
107 | " Apply new SniptMat Parser | 107 | " Apply new SniptMat Parser |
108 | let g:snipMate = { 'snippet_version' : 1 } | 108 | let 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 | ||
114 | function! 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")) | ||
131 | endfunction | ||
132 | |||
133 | command! -nargs=1 -complete=command Redir silent call Redir(<q-args>) | ||
134 | |||
110 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | 135 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
111 | " => Settings for Vimwiki | 136 | " => Settings for Vimwiki |
112 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | 137 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
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 @@ | |||
1 | #compdef wg | ||
2 | |||
3 | function _wg() { | ||
4 | compadd -S '' $(cd ~/vimwiki && ls ${words[2]}*) | ||
5 | } | ||
6 | |||
7 | _wg | ||