diff options
author | typebrook <typebrook@gmail.com> | 2019-03-12 17:47:06 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2019-03-12 17:47:06 +0800 |
commit | 2fddc277815b8e09ef80279d94578735481ec435 (patch) | |
tree | e73ad022e895cd6b6c41cc571c0ff51b6653d2e4 /vimrc | |
parent | c738efc6a2022eff8cd9367dafe653f02bb0db4e (diff) |
update
Diffstat (limited to 'vimrc')
-rw-r--r-- | vimrc | 35 |
1 files changed, 34 insertions, 1 deletions
@@ -13,9 +13,42 @@ set siso=999 | |||
13 | let g:vim_markdown_conceal = 0 | 13 | let g:vim_markdown_conceal = 0 |
14 | 14 | ||
15 | nmap <c-c> :q<cr> | 15 | nmap <c-c> :q<cr> |
16 | nnoremap <leader>r :.w !bash<cr> | 16 | nnoremap <leader>t :.w !bash<cr> |
17 | nnoremap <leader>tt :TableFormat<cr> | 17 | nnoremap <leader>tt :TableFormat<cr> |
18 | 18 | ||
19 | let g:vim_markdown_folding_disabled = 1 | ||
20 | source ~/.vim_runtime/vimrcs/redir.vim | ||
21 | |||
22 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
23 | " => Redirect the output of a Vim or external command into a scratch buffer | ||
24 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
25 | " Copy from : https://gist.github.com/romainl/eae0a260ab9c135390c30cd370c20cd7 | ||
26 | " Usage: | ||
27 | " :Redir hi ............. show the full output of command ':hi' in a scratch window | ||
28 | " :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window | ||
29 | " | ||
30 | function! Redir(cmd) | ||
31 | for win in range(1, winnr('$')) | ||
32 | if getwinvar(win, 'scratch') | ||
33 | execute win . 'windo close' | ||
34 | endif | ||
35 | endfor | ||
36 | if a:cmd =~ '^!' | ||
37 | let output = system(matchstr(a:cmd, '^!\zs.*')) | ||
38 | else | ||
39 | redir => output | ||
40 | execute a:cmd | ||
41 | redir END | ||
42 | endif | ||
43 | vnew | ||
44 | let w:scratch = 1 | ||
45 | setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile | ||
46 | call setline(1, split(output, "\n")) | ||
47 | endfunction | ||
48 | |||
49 | command! -nargs=1 -complete=command Redir silent call Redir(<q-args>) | ||
50 | nnoremap <leader>r :Redir | ||
51 | |||
19 | 52 | ||
20 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | 53 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
21 | " => Make Alt key works on Gnome terminal | 54 | " => Make Alt key works on Gnome terminal |