Guest User

Untitled

a guest
Sep 10th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 1.31 KB | None | 0 0
  1. set shell=powershell.exe
  2. set shellcmdflag=-STA\ -NoLogo\ -NoProfile\ -NonInteractive\ -ExecutionPolicy\ Bypass\ -Command
  3. set shellpipe=|
  4. set shellredir=>
  5.  
  6. # Before PowerShell ISE came along
  7. noremap \rf :map \rf :!&{.'%:p'}<Enter>
  8.  
  9. " Launch the command under the visual selection or typed at the prompt (with the shell)
  10. nnoremap <silent> <F5> :call RunCommandPrompt()<CR>
  11. inoremap <silent> <F5> <C-O>:call RunCommandPrompt()<CR>
  12. vnoremap <silent> <F5> :<C-U>let old_reg=@"<CR>gv""y:! <C-R><C-R>"<CR>:let @"=old_reg<CR>
  13.  
  14. " Captures the output of a command under the visual selection or typed at the prompt
  15. nnoremap <silent> <S-F5> :call RunCommandPromptWithCapture()<CR>
  16. inoremap <silent> <S-F5> <C-O>:call RunCommandPromptWithCapture()<CR>
  17. vnoremap <silent> <S-F5> :<C-U>let old_reg=@"<CR>gv""y:r ! <C-R><C-R>"<CR>:let @"=old_reg<CR>
  18.  
  19. function! RunCommandPrompt()
  20.     let _cmdstr = input( getcwd() . "> " )
  21.     if (_cmdstr != "")
  22.         execute "! " . _cmdstr
  23.     endif
  24. endfunction
  25.  
  26. function! RunCommandPromptWithCapture()
  27.     let _cmdstr = input( getcwd() . "> " )
  28.     if (_cmdstr != "")
  29.         execute "r ! " . _cmdstr
  30.     endif
  31. endfunction
  32.  
  33. function! RunCommandPromptWithStart()
  34.     let _cmdstr = input( getcwd() . "> " )
  35.     if (_cmdstr != "")
  36.         execute "!start " . _cmdstr
  37.     endif
  38. endfunction
Add Comment
Please, Sign In to add comment