Skip to content

Instantly share code, notes, and snippets.

@romainfrancois
Created August 17, 2017 10:10
Show Gist options
  • Save romainfrancois/dc772b5c7ef55c8a82041900603b5a15 to your computer and use it in GitHub Desktop.
Save romainfrancois/dc772b5c7ef55c8a82041900603b5a15 to your computer and use it in GitHub Desktop.
emoji completion hack
.original.rs.getCompletionsFile <- .rs.getCompletionsFile
assign( ".rs.getCompletionsFile", function (token, path = getwd(), quote = FALSE, directoriesOnly = FALSE) {
if( grepl( ".*[:]", token ) ){
tok <- sub( ".*[:]", "", token)
start <- sub( "[:].*", "", token)
.rs.makeCompletions(
token = token , results = paste0( start, emo::ji_completion(tok) ) ,
excludeOtherCompletions = TRUE, type= .rs.acCompletionTypes$STRING,
quote = FALSE
)
} else {
.original.rs.getCompletionsFile( token, path, quote, directoriesOnly )
}
}, as.environment("tools:rstudio") )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment