1

How do I select words with Ctrl+Shift+Right and Ctrl+Shift+Left, like in other editors?

I tried with:

set keymodel=startsel,stopsel
set selectmode+=key

but it selects till the beginning of the next word.

I also tried:

nnoremap <C-S-Right> ve

but then it enters visual mode, not select mode. How do I enter select mode?

3
  • 1
    Welcome to Vi&Vim SE. You are, of course, free to use Vim however you please but trying to force a convention commonly used in other editors into Vim is not the path to nirvana, i.e. The Vim Way™. ;) Select mode, for instance, isn't used all that often by many Vim aficionados and is more of a concession to lure mouse-heavy users, I'd say. Just FYI.
    – B Layer
    Nov 13, 2020 at 12:50
  • 2
    (Select isn't used directly by such users, I should say. It is used behind the scenes in some places; for example, by some snippets plugins. Also, I realize you might have a very particular reason for wanting to what you want to do and being Vim-like isn't relevant. The above is not meant for that kind of scenario. Cheers.)
    – B Layer
    Nov 13, 2020 at 13:00
  • Hi, Thanks for the welcome. So What is then the more efficient way or the Vim Way to select text? Let's say i want to indent few lines, why would i press Esc, then v and then Up or j when i can create a more convenient shortcut like Alt+Up for this? I'm new to Vim and i noticed it is highly customizable, so why shouldn't i take advantage of this?
    – JacopoDT
    Nov 13, 2020 at 19:06

2 Answers 2

2

You can use ctrl-G to to enter select mode from visual mode (see :help v_CTRL-G).

:nnoremap <C-S-Right> ve<C-G>
2

This answer is perhaps a bit more broad than what you specifically asked in your question... But if you're interested in using select mode and motions such as Ctrl+Shift+Right to select to the end of the word, perhaps you should consider Vim's easy mode.

You can start it by running the evim command, which typically starts a GUI version of Vim with easy mode enabled, or you can use vim -y which works on the terminal too. See :help -y.

(Easy mode Vim on the Terminal is an odd duck though, since what makes easy mode easy is access to a menu and a toolbar, which you typically don't have on the Terminal version and, even when you do enable them and set up mappings for them, it's not that easy to navigate them with arrow keys. Furthermore, easy mode uses commands such as :promptfind which only work on the GUI version of Vim.)

If you're running easy mode Vim, you can still have access to normal mode, except that instead of using Esc to exit insert mode, you should use Ctrl+L to go to normal mode, then from there you can actually use Esc to return to insert mode! See :help 'insertmode' for more details, option :set insertmode is what implements most of easy mode behavior.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.