Created
April 25, 2012 15:27
-
-
Save ilbelkyr/2490651 to your computer and use it in GitHub Desktop.
Line-drawing character mappings in insert mode for Vim
This file contains 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
" Vimscript file to allow easy insertion of line-drawing | |
" characters in insert mode. | |
" Currently based on the numeric keyboard layout of most | |
" keyboards - other possibilities include using + for ┼, etc. | |
"789+ ┌┬┐│ | |
"456 ├┼┤ | |
"123 └┴┘ | |
"0 ─ | |
function LineD () | |
inoremap 1 └ | |
inoremap 2 ┴ | |
inoremap 3 ┘ | |
inoremap 4 ├ | |
inoremap 5 ┼ | |
inoremap 6 ┤ | |
inoremap 7 ┌ | |
inoremap 8 ┬ | |
inoremap 9 ┐ | |
inoremap 0 ─ | |
inoremap + │ | |
endfunc | |
function LineT () | |
" Ensure mappings exist to avoid error messages | |
inoremap 1 . | |
inoremap 2 . | |
inoremap 3 . | |
inoremap 4 . | |
inoremap 5 . | |
inoremap 6 . | |
inoremap 7 . | |
inoremap 8 . | |
inoremap 9 . | |
inoremap 0 . | |
inoremap + . | |
iunmap 1 | |
iunmap 2 | |
iunmap 3 | |
iunmap 4 | |
iunmap 5 | |
iunmap 6 | |
iunmap 7 | |
iunmap 8 | |
iunmap 9 | |
iunmap 0 | |
iunmap + | |
endfunc | |
command LLine call LineD() | |
command LText call LineT() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment