mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-12-22 11:51:41 +01:00
vim: add completion to Man and Cmd functions
This commit is contained in:
parent
9dd2aa7ac4
commit
e50cc58941
|
@ -92,7 +92,7 @@ function! GitStatus()
|
|||
endfunction
|
||||
|
||||
|
||||
" Redirect command into scractch buffer. Stolen from romainl
|
||||
" Redirect command into scratch buffer. Stolen from romainl
|
||||
function! Redir(cmd, rng, start, end)
|
||||
for win in range(1, winnr('$'))
|
||||
if getwinvar(win, 'scratch')
|
||||
|
@ -124,17 +124,17 @@ endfunction
|
|||
|
||||
command! -nargs=1 -complete=command -bar -range Redir silent call Redir(<q-args>, <range>, <line1>, <line2>)
|
||||
|
||||
" Gets the manul page for the given command
|
||||
" Gets the man page for the given command
|
||||
function! Man(cmd)
|
||||
let output = system('man ' . a:cmd)
|
||||
vnew
|
||||
let w:scratch=1
|
||||
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile filetype=man
|
||||
setlocal nonumber norelativenumber
|
||||
let output = system('man ' . a:cmd)
|
||||
call setline(1, split(output, '\n'))
|
||||
endfunction
|
||||
|
||||
command! -nargs=1 -complete=command Man silent call Man(<q-args>)
|
||||
command! -nargs=1 -complete=shellcmd Man silent call Man(<q-args>)
|
||||
|
||||
" Execute the given command and print it in a scratch buffer
|
||||
function! Cmd(cmd)
|
||||
|
@ -147,4 +147,4 @@ function! Cmd(cmd)
|
|||
call setline(1, split(output, '\n'))
|
||||
endfunction
|
||||
|
||||
command! -nargs=1 -complete=command Cmd silent call Cmd(<q-args>)
|
||||
command! -nargs=1 -complete=shellcmd Cmd silent call Cmd(<q-args>)
|
||||
|
|
Loading…
Reference in New Issue
Block a user