Skip to content

Instantly share code, notes, and snippets.

@gerane
Created May 13, 2016 16:22
Show Gist options
  • Save gerane/16294a7b5b7abd0f3c1444407d36a018 to your computer and use it in GitHub Desktop.
Save gerane/16294a7b5b7abd0f3c1444407d36a018 to your computer and use it in GitHub Desktop.
Import-Module -Name Emojis
function Invoke-Emoji {
$context = $psEditor.GetEditorContext()
$EmojiText = $context.CurrentFile.GetTextLines($context.SelectedRange)
$Emoji = Get-Emoji -Name $EmojiText
if ($Emoji)
{
$context.CurrentFile.InsertText($Emoji, $context.SelectedRange)
}
}
Register-EditorCommand `
-Name "MyModule.Invoke-Emoji" `
-DisplayName "Replace selected text with emoji" `
-Function Invoke-Emoji
"Turn airplane into and emoji: airplane"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment