From e50cc58941a62cd42b22d94f08be55e7aa1eff4e Mon Sep 17 00:00:00 2001 From: bretello Date: Sat, 13 Mar 2021 14:41:36 +0100 Subject: [PATCH] vim: add completion to Man and Cmd functions --- vim/functions.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vim/functions.vim b/vim/functions.vim index c3e5c1f..326b5f5 100644 --- a/vim/functions.vim +++ b/vim/functions.vim @@ -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(, , , ) -" 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() +command! -nargs=1 -complete=shellcmd Man silent call Man() " 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() +command! -nargs=1 -complete=shellcmd Cmd silent call Cmd()