Skip to content

Instantly share code, notes, and snippets.

@AndrewRadev
Created March 4, 2021 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewRadev/94de963bb438709d2050d254c7ebb1a6 to your computer and use it in GitHub Desktop.
Save AndrewRadev/94de963bb438709d2050d254c7ebb1a6 to your computer and use it in GitHub Desktop.
Proof-of-concept of a faster "artify" plugin
let s:tbl = {
\ 'bold': {
\ '0': '๐ŸŽ', '1': '๐Ÿ', '2': '๐Ÿ', '3': '๐Ÿ‘', '4': '๐Ÿ’',
\ '5': '๐Ÿ“', '6': '๐Ÿ”', '7': '๐Ÿ•', '8': '๐Ÿ–', '9': '๐Ÿ—',
\ 'A': '๐€', 'B': '๐', 'C': '๐‚', 'D': '๐ƒ', 'E': '๐„',
\ 'F': '๐…', 'G': '๐†', 'H': '๐‡', 'I': '๐ˆ', 'J': '๐‰',
\ 'K': '๐Š', 'L': '๐‹', 'M': '๐Œ', 'N': '๐', 'O': '๐Ž',
\ 'P': '๐', 'Q': '๐', 'R': '๐‘', 'S': '๐’', 'T': '๐“',
\ 'U': '๐”', 'V': '๐•', 'W': '๐–', 'X': '๐—', 'Y': '๐˜',
\ 'Z': '๐™',
\ 'a': '๐š', 'b': '๐›', 'c': '๐œ', 'd': '๐', 'e': '๐ž',
\ 'f': '๐Ÿ', 'g': '๐ ', 'h': '๐ก', 'i': '๐ข', 'j': '๐ฃ',
\ 'k': '๐ค', 'l': '๐ฅ', 'm': '๐ฆ', 'n': '๐ง', 'o': '๐จ',
\ 'p': '๐ฉ', 'q': '๐ช', 'r': '๐ซ', 's': '๐ฌ', 't': '๐ญ',
\ 'u': '๐ฎ', 'v': '๐ฏ', 'w': '๐ฐ', 'x': '๐ฑ', 'y': '๐ฒ',
\ 'z': '๐ณ',
\ },
\ }
function! ArtifyFast(string, type)
let table = s:tbl[a:type]
return join(map(split(a:string, '\zs'), {_, c-> get(table, c, c)}), '')
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment