vim特殊字符输入及整理 (2)

A fake leader for vim

Rykka posted @ 2012年6月04日 01:53 in vim , 7008 阅读

When we using the '<Space>' as a mapleader in vim.
The disadvantage is you can not see it with 'showcmd' ,
it's a whitespace!
This will lead to some unwanted behavior as
you don't know whether you have pressed it or not.

So I write a small function in vimrc to show it.

" using expr to return a map , which can autoload plugin files
map <expr><Space> <SID>fake_leader()
fun! s:fake_leader() "{{{
    " A fake leader to display the status of <Space>.
    " you should set your mapleader to a key other than '<Space>'
    " disadvantage: only recevie 2 key mapping
    "        e.g. <leader>vv but no <leader>v or <leader>vvv
    echohl WarningMsg | echo "F:<Space>+" | echohl Normal
    let n1 = getchar()
    let c1 = nr2char(n1)
    let t=""
    if c1 == "\<Space>"
        echon "<Space>"
        let t = g:mapleader . g:mapleader
    elseif c1 == "\<Esc>"
        echon "<Escape>"
    elseif c1 == "\\"
        echon "<Bslash>"
        let t = g:mapleader . "\\"
    elseif n1 == "\<BS>"
        echon "<BS>"
        echon c1
        let c2 = nr2char(getchar())
        let t = g:mapleader .c1.c2
    redraw | echo 
    return t 
endfun "}}}




Madison Gill 说:
2018年10月01日 13:29

Designers of fake leader can get help from here that solves their problem in short way without any back draw. Instead waste of time in fake writers hire professional writing services online for writing of your best works.

frank 说:
2022年7月21日 23:09

we are all good

eminent 说:
2022年11月23日 14:03

one who has visions or positive ideas about future

eminent 说:
2022年11月23日 14:10

Positive words starting with the letter

eminent 说:
2022年11月23日 14:31

unconditional commitment

eminent 说:
2022年11月23日 14:45

remarkable in performance, execution or design

eminent 说:
2023年2月12日 16:04

Savastan0 is the best cc shop.

eminent 说:
2023年2月12日 16:05 offers logs,

eminent 说:
2023年2月12日 16:05

cc and more. For savastan0cc,

登录 *

loading captcha image...
or Ctrl+Enter