Vim (vimscript) get exact character under the cursor

前端 未结 3 1257
盖世英雄少女心
盖世英雄少女心 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:34

    Though I cannot reproduce the problem you're describing, there's another problem with your code: Because of the string indexing (and this is one of the uglier sides of Vimscript), it only works with single-byte characters, but will fail to capture chars like Ä or

提交回复
热议问题