Powershell ISE + vim
The last weaks i searched for a way to use psISE in combination with vim (i found out its possible but hard for me to code without the ISE-comfort)In the end i created a function/submenu in the ISE that:
- With a keyboard-shortcut ([AltGr]+[v]) starts vim with the current file and waits for the process to end
- When I'm finished editing in vim and saved the file its removed from the ISE
- And loaded again (bacause in v3 there is no file "refreshing")
# one-line$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("edit with Vim",{$cur=$psISE.CurrentFile; saps "C:\Program Files (x86)\vim\vim74\gvim.exe" $cur.FullPath -wait; $psise.currentpowershelltab.files.remove($cur); $psISE.currentpowershelltab.files.add($cur.fullpath) },'Ctrl+Alt+v')
You have to save it first or it will not be removed
(maybe you add the $psise.CurrentFile.Save()
-function)
(for permanent ISE-changes you have to put it into the $profile...)
*saps --> start-process alias
I may be misunderstanding the question, but the closest I've come to getting vim-like ability while using PS ISE is to install gvim74 for Windows, and create this function:
function vim { if ($args) { start-process 'C:\Program Files (x86)\Vim\vim74\vim.exe' $args } else { start-process 'C:\Program Files (x86)\Vim\vim74\vim.exe' }}
Unfortunately, ISE does not play nicely with console input, so the best I can get is starting vi in a new PS window. Not perfect, but I get my ability to "vim fileToEdit", which I do A LOT in non-Windows world.
The best thing I've found is VSCode with the PowerShell and VIM plugin installed. The Powershell plugin used to be a lot worse than ISE, but recently the Intellisense has gotten much cleaner.