Vim (vimscript) get exact character under the cursor

前端 未结 3 1274
盖世英雄少女心
盖世英雄少女心 2020-12-31 05:52

I am getting the character under the cursor in vimscript the following way:

getline(\'.\')[col(\'.\')-1] 

It works exactly like it should,

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-31 06:18

    nr2char(strgetchar(getline('.')[col('.') - 1:], 0))
    

    or

    strcharpart(getline('.')[col('.') - 1:], 0, 1)
    

提交回复
热议问题