How do I specify “the word under the cursor” on VIM's commandline?

前端 未结 8 977
后悔当初
后悔当初 2021-01-30 02:14

I want to write a command that specifies \"the word under the cursor\" in VIM. For instance, let\'s say I have the cursor on a word and I make it appear twice. For instance, i

8条回答
  •  攒了一身酷
    2021-01-30 02:45

    yiwP
    

    yiw: Yank inner word (the word under the cursor). This command also moves the cursor to the beginning of the word.

    P: Paste before the cursor.

    You can then map the e.g.: < ALT > - D to this command:

    :nmap < ALT >-D yiwP
    

提交回复
热议问题