@woshichuanqilz
2015-11-15T03:13:40.000000Z
字数 1149
阅读 1307
Vim
- Two Keys here
- 1. Read the output from the cmd line use the statement "r !echo hello" you will get the output in the current window
- 2. Redirect the output to the buffer window.
execute "split" fnamescape(bufname)
setlocal buftype=nofile
setlocal nobuflisted
" Press leader r and the word under the curor will be search in the python helpnnoremap <leader>r :<C-u>execute "!start cmd /k python C:\\Python27\\Lib\\pydoc.py " . expand("<cword>")<CR>"Enter :Pyhelp "SearchWord" in the command line you will get the help about the word in a new buffer.command! -nargs=1 -bar Pyhelp :call ShowPydoc(<f-args>)function! ShowPydoc(what)let bufname = a:what . ".pydoc"" check if the buffer exists alreadyif bufexists(bufname)let winnr = bufwinnr(bufname)if winnr != -1" if the buffer is already displayed, switch to that windowexecute winnr "wincmd w"else" otherwise, open the buffer in a splitexecute "sbuffer" bufnameendifelse" create a new buffer, set the nofile buftype and don't display it in the" buffer listexecute "split" fnameescape(bufname)setlocal buftype=nofilesetlocal nobuflisted" read the output from pydoclet l:cmd = "r !python C:\\Python27\\Lib\\pydoc.py " . a:what" execute "r !" . shellescape(s:pydoc_path, 1) . " " . shellescape(a:what, 1)execute cmdendif" go to the first line of the document1endfunction