Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set shell=powershell.exe
- set shellcmdflag=-STA\ -NoLogo\ -NoProfile\ -NonInteractive\ -ExecutionPolicy\ Bypass\ -Command
- set shellpipe=|
- set shellredir=>
- # Before PowerShell ISE came along
- noremap \rf :map \rf :!&{.'%:p'}<Enter>
- " Launch the command under the visual selection or typed at the prompt (with the shell)
- nnoremap <silent> <F5> :call RunCommandPrompt()<CR>
- inoremap <silent> <F5> <C-O>:call RunCommandPrompt()<CR>
- vnoremap <silent> <F5> :<C-U>let old_reg=@"<CR>gv""y:! <C-R><C-R>"<CR>:let @"=old_reg<CR>
- " Captures the output of a command under the visual selection or typed at the prompt
- nnoremap <silent> <S-F5> :call RunCommandPromptWithCapture()<CR>
- inoremap <silent> <S-F5> <C-O>:call RunCommandPromptWithCapture()<CR>
- vnoremap <silent> <S-F5> :<C-U>let old_reg=@"<CR>gv""y:r ! <C-R><C-R>"<CR>:let @"=old_reg<CR>
- function! RunCommandPrompt()
- let _cmdstr = input( getcwd() . "> " )
- if (_cmdstr != "")
- execute "! " . _cmdstr
- endif
- endfunction
- function! RunCommandPromptWithCapture()
- let _cmdstr = input( getcwd() . "> " )
- if (_cmdstr != "")
- execute "r ! " . _cmdstr
- endif
- endfunction
- function! RunCommandPromptWithStart()
- let _cmdstr = input( getcwd() . "> " )
- if (_cmdstr != "")
- execute "!start " . _cmdstr
- endif
- endfunction
Add Comment
Please, Sign In to add comment