Created
February 21, 2018 17:34
-
-
Save v3l0c1r4pt0r/ad3343b7ddca805f410ab7769121528c to your computer and use it in GitHub Desktop.
Vim script to insert ANSi escape codes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! Icolorify(color) | |
normal `>a[0m | |
execute "normal `<i\<C-V>\<C-[>[" . a:color . "m" | |
endfunction | |
" Foreground | |
command! -range CBlack call Icolorify(30) | |
command! -range CRed call Icolorify(31) | |
command! -range CGreen call Icolorify(32) | |
command! -range CYellow call Icolorify(33) | |
command! -range CBlue call Icolorify(34) | |
command! -range CMagenta call Icolorify(35) | |
command! -range CCyan call Icolorify(36) | |
command! -range CWhite call Icolorify(37) | |
" Background | |
command! -range CBlackBg call Icolorify(40) | |
command! -range CRedBg call Icolorify(41) | |
command! -range CGreenBg call Icolorify(42) | |
command! -range CYellowBg call Icolorify(43) | |
command! -range CBlueBg call Icolorify(44) | |
command! -range CMagentaBg call Icolorify(45) | |
command! -range CCyanBg call Icolorify(46) | |
command! -range CWhiteBg call Icolorify(47) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment