Skip to main content

Posts

Showing posts from October, 2017

Powershell as a Visual Studio External Tool

It's handy to be able to open Powershell at the current solution directory, e.g. for invoking scripts or git commands etc.
Click the Tools menu  -> External Tools -> Add
Title: Powershell, or whatever you want
Command: your PS directory, e.g C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments: -ExecutionPolicy RemoteSigned -NoExit -Command "Set-Location '$(SolutionDir)' | Clear-Host"
Initial directory: $(SolutionDir)

Useful Vim Stuff

!ls - execute ls in shell
Ctrl+q - block select
Ctrl+q, I  - insert mode across multi-line block selection (operates across selection after Esc is pressed)
qx  - record macro x
@@  - replay last macro
2@x  - replay x twice
Ctrl+6 - edit last file  (think of it like Ctrl+^ or ^^)

g;  - previous change
gq  - reformat
O  - other end of visual selection
:split - horizontal split the current file
:vsplit - vertical split the current file
Ctrl+W, n - horizontal split, New file
Ctrl+W, v - vertical split
Ctrl+W, hjkl - move between window splits in a direction
Ctrl+W, w - cycle between window splits
Ctrl+W, o - get rid of all splits except one ("Only One")

cgn - change next match of last search (like pressing n but removes the match), useful for replacing all matches with .  (e.g. search for "bar", then cgnFoo<Esc>...... to replace every match)

Ctrl+o / Ctrl+i  - jump through locations
'.  - last edited line
[^\x00-\x7F]  - find non-acii chars

Open explorer   :!…