vim

What's a common use case of "selection mode" in Vim?


It's the first time i noticed about the selection mode in Vim when I accidentally triggered it from visual-line mode by <c-g>.

Vim already has visual mode for text selection what's the use case of selection mode, can anyone give me a hint on this?


Note

I've checked the manual page which describes it as

a resemblance of MS Windows text selection

but I still cannot quite understand why do we need any mouse actions in Vim.


Solution

  • Select-mode is commonly used in snippet plugins such as vim-snipmate. Mappings can be created that are unique to select-mode so as not to interfere with regular visual mode behaviour.

    Here is an excerpt from Practical Vim by Drew Neil:

    If you are happy to embrace the modal nature of Vim, then you should find little use for Select mode, which holds the hand of users who want to make Vim behave more like other text editors. I can think of only one place where I consistently use Select mode: when using a plugin that emulates TextMate's snippet functionality, Select mode highlights the active placeholder.