From b7009615dcb44e890a4d2f624da8f3f1f6e3b5a7 Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Wed, 24 Aug 2016 13:41:20 +0300 Subject: [PATCH] mapping validity for insert mode only --- vim/ansi.vim | 177 +++++++++++++++++++++++++--------------------- vim/checklist.vim | 2 +- 2 files changed, 97 insertions(+), 82 deletions(-) diff --git a/vim/ansi.vim b/vim/ansi.vim index 001bf8c..4a7c4b2 100644 --- a/vim/ansi.vim +++ b/vim/ansi.vim @@ -9,118 +9,133 @@ map c5 :call CharDraw_doubleverlines() map c6 :call CharDraw_arrows() map c7 :call CharDraw_extrachars() map c0 :call CharDraw_clear() +map ck :call CharDraw_noNumPad() function! CharDraw_clear () - mapclear! -set laststatus=2 - echo 'N to create 80,25 empty drawing. Select ANSI 437 chars and draw with numpad' + imapclear + set laststatus=2 + echo 'N to create 80,25 empty drawing. Select ANSI 437 chars and draw with numpad, ck to assign t-m "keypad"' map N 80i yy24p( - set statusline=%f\ %=\ \[c1-1:chars\ c0:clr]\ (%v,%l)\ HEX:%B + set statusline=%f\ %=\ \[c1-1:chars\ c0:clr ck:key]\ (%v,%l)\ HEX:%B endfunction call CharDraw_clear() +function! CharDraw_noNumPad () + imap b 1 + imap n 2 + imap m 3 + imap g 4 + imap h 5 + imap j 6 + imap t 7 + imap y 8 + imap u 9 + imap i - + imap k + +endfunction + function! CharDraw_blocks () - mapclear! - map! 1 ░ - map! 2 ▀ - map! 3 ▒ - map! 4 ▐ - map! 5 ■ - map! 6 ▌ - map! 7 ▓ - map! 8 ▄ - map! 9 █ - map! 0   - map! - ▞ - map! + ▚ + imapclear + imap 1 ░ + imap 2 ▀ + imap 3 ▒ + imap 4 ▐ + imap 5 ■ + imap 6 ▌ + imap 7 ▓ + imap 8 ▄ + imap 9 █ + imap 0   + imap - ▞ + imap + ▚ set statusline=%f\ %=\ [░▀▒▐■▌▓▄█ ▞▚]\(%v,%l)\ HEX:%B endfunction function! CharDraw_lines () - mapclear! - map! 1 └ - map! 2 ┴ - map! 3 ┘ - map! 4 ├ - map! 5 ┼ - map! 6 ┤ - map! 7 ┌ - map! 8 ┬ - map! 9 ┐ - map! - ─ - map! + │ + imapclear + imap 1 └ + imap 2 ┴ + imap 3 ┘ + imap 4 ├ + imap 5 ┼ + imap 6 ┤ + imap 7 ┌ + imap 8 ┬ + imap 9 ┐ + imap - ─ + imap + │ set statusline=%f\ %=\ [└┴┘├┼┤┌┬┐─│]\(%v,%l)\ HEX:%B endfunction function! CharDraw_doublehorlines () - mapclear! - map! 7 ╒ - map! 8 ╤ - map! 9 ╕ - map! 4 ╞ - map! 5 ╪ - map! 6 ╡ - map! 1 ╘ - map! 2 ╧ - map! 3 ╛ - map! - ═ - map! + │ + imapclear + imap 7 ╒ + imap 8 ╤ + imap 9 ╕ + imap 4 ╞ + imap 5 ╪ + imap 6 ╡ + imap 1 ╘ + imap 2 ╧ + imap 3 ╛ + imap - ═ + imap + │ set statusline=%f\ %=\ [╘╧╛╞╪╡╒╤╕═│]\(%v,%l)\ HEX:%B endfunction function! CharDraw_doubleverlines () - mapclear! - map! 7 ╓ - map! 8 ╥ - map! 9 ╖ - map! 4 ╟ - map! 5 ╫ - map! 6 ╢ - map! 1 ╙ - map! 2 ╨ - map! 3 ╜ - map! + ║ - map! - ─ + imapclear + imap 7 ╓ + imap 8 ╥ + imap 9 ╖ + imap 4 ╟ + imap 5 ╫ + imap 6 ╢ + imap 1 ╙ + imap 2 ╨ + imap 3 ╜ + imap + ║ + imap - ─ set statusline=%f\ %=\ [╙╨╜╟╫╢╓╥╖─║]\(%v,%l)\ HEX:%B endfunction function! CharDraw_doublelines () - mapclear! - map! 1 ╚ - map! 2 ╩ - map! 3 ╝ - map! 4 ╠ - map! 5 ╬ - map! 6 ╣ - map! 7 ╔ - map! 8 ╦ - map! 9 ╗ - map! - ═ - map! + ║ + imapclear + imap 1 ╚ + imap 2 ╩ + imap 3 ╝ + imap 4 ╠ + imap 5 ╬ + imap 6 ╣ + imap 7 ╔ + imap 8 ╦ + imap 9 ╗ + imap - ═ + imap + ║ set statusline=%f\ %=\ [╚╩╝╠╬╣╔╦╗═║]\(%v,%l)\ HEX:%B endfunction function! CharDraw_extrachars () - mapclear! - map! 1 © - map! 2 · - map! 3 × - map! 4 « - map! 5 ° - map! 6 » - map! 7 ╲ - map! 8 ╳ - map! 9 ╱ + imapclear + imap 1 © + imap 2 · + imap 3 × + imap 4 « + imap 5 ° + imap 6 » + imap 7 ╲ + imap 8 ╳ + imap 9 ╱ set statusline=%f\ %=\ [©·×«°»╲╳╱]\(%v,%l)\ HEX:%B endfunction function! CharDraw_arrows () - mapclear! - map! 2 ▼ - map! 4 ◀ - map! 5 ◆ - map! 6 ▶ - map! 8 ▲ + imapclear + imap 2 ▼ + imap 4 ◀ + imap 5 ◆ + imap 6 ▶ + imap 8 ▲ set statusline=%f\ %=\ [▲▶▼◀◆]\(%v,%l)\ HEX:%B endfunction diff --git a/vim/checklist.vim b/vim/checklist.vim index deb1c5a..bf27ff5 100644 --- a/vim/checklist.vim +++ b/vim/checklist.vim @@ -1,7 +1,7 @@ function! Box_clear () mapclear! map :call Flip_box()j^ - map! [ ] + imap [ ] set laststatus=2 set statusline=%f\ %=\ ([x]\ spc,^b)\ (%v,%l) hi StatusLine ctermfg=cyan ctermbg=black