From 2fddc277815b8e09ef80279d94578735481ec435 Mon Sep 17 00:00:00 2001 From: typebrook Date: Tue, 12 Mar 2019 17:47:06 +0800 Subject: update --- vimrc | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'vimrc') diff --git a/vimrc b/vimrc index 78ce6ac..8d7a82a 100644 --- a/vimrc +++ b/vimrc @@ -13,9 +13,42 @@ set siso=999 let g:vim_markdown_conceal = 0 nmap :q -nnoremap r :.w !bash +nnoremap t :.w !bash nnoremap tt :TableFormat +let g:vim_markdown_folding_disabled = 1 +source ~/.vim_runtime/vimrcs/redir.vim + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Redirect the output of a Vim or external command into a scratch buffer +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Copy from : https://gist.github.com/romainl/eae0a260ab9c135390c30cd370c20cd7 +" 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() +nnoremap r :Redir + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Make Alt key works on Gnome terminal -- cgit v1.2.3-70-g09d2