select the same words in the Vim - vim

I know there is a lot of information on how to do it, but I can't do it anyway. I use vs with vim expansion.
I have text with variables, I want to select for example variable btn in all text and change it to button. How can I do it?
I tried with select and press key n,but it selects all text until next btn;
also '*' is not working, it's just jumping to next btn;
Thank you!

You can use the *or viw to visually select the word under the cursor.

Found a good solution:
:%s/oldText/newText/g
more here: https://www.thegeekstuff.com/2009/04/vi-vim-editor-search-and-replace-examples/

Related

Multiple cursors from find result

I have a regex in my find box and want a cursor at each found location (I'm actually trying to delete a load of new lines in paragraphs but there's far to many to do by hand).
How can I get a cursor at each location that matches [\w]$?
Click the "Find All" button at the far right of the find panel, and ST will select all the matches.
The shortcut Opt + Enter should work if you're looking to stay on the keyboard.
If you want to search for a simple string, you may select it right in editor and use Find All:
Windows/Linux: Alt+F3
Mac: ⌃+⌘+G

Incremental search in Idea the word under cursor

I would like to search in current file the word under cursor like Alt+F3, except manually selecting current word? Is there alike keyboard shortcut?
Not entirely sure what you are looking to do when you say "manually selecting current word", but F3 (Next) and Shift+F3 (previous) will search for the word under the cursor. You can use Ctrl+W (Extend selection) to select the word under the cursor. Finally Ctrl+F will open the find/search tool. More options are listed in help: https://www.jetbrains.com/help/idea/search.html
EDIT
I forgot to mention, if you first use the mouse or Ctrl+W to select the word, and then open the search bar using Ctrl+F, or search & replace using Ctrl+R, IDEA will populate the search field with the selected text.
Ctrl+F3 - Find Next
Unfortunately, I have failed to find any keyboard shortcut for Find Previous shortcut.

Highlighting Text With Keyboard Between Limits On Sublime Text

In Sublime Text I can highlight text between specific locations by holding down shift and clicking the start of the region I want highlighted and then the end.
How do I do this with just the keyboard?
Method 1
Explore the commands in the Edit > Mark submenu.
Move your cursor to the start of the desired selection and run Set Mark (Ctrl+K, Ctrl+space).
Then move your cursor to the end of the desired selection and run Select to Mark (Ctrl+K, Ctrl+A).
Method 2
Or, as noted in the comments, hold down Shift as you move across the desired selection (using arrows, etc.).
Try the key command Ctrl+Shift+End on Windows when you are at the beginning or in the middle somewhere of a document. This works with any program.

Vim command: how to select a word under cursor in normal mode

I'm looking for a Vim command to select a word under cursor in normal mode, like double-clicking by mouse. Does it exist like this?
You can use * and/or # to search for the word under the cursor or viw to visually select the word under the cursor.
viw does a visual select inside the word. Similarly yiw copies (yanks) the word.
Personally, I am prefering vaw, yaw instead of viw or yiw as a indicates around.
On the similar lines. I use
vat to select tag.
va( or va{
v% to select matching closing tag. In some other places ev%
It is making more sense to me as the intention is to select the complete word not inside.
At the end, it all comes down to our personal preference.
To select a word under a cursor I use the combination of bve
Be aware though that if the cursor points to a first character you just need ve combination.
After using *, if you want to use the text in a command you can do the <C-r> <C-w> trick too (after pressing : or your equivalent).

vim: highlight words in visual block mode

Below is a screenshot of me entering visual block mode and pressing "w" to select by word:
How can I select every word in the rows I have selected? Meaning I want the full word in the rows highlighted instead of it getting cut off as shown in the screenshot.
edit: What I want to be able to do is delete a column of words of varying length. In the example screenshot I want to delete the words between the tags, But it could be any column of words.
There are a bunch of plugins for multiple selection, look them up on vim.org.
But I must remind you that visually selecting text is more often than not an unnecessary step. Why don't you explain what you actually want to achieve instead of your failed attempts? Maybe there's a better way...
[edit]
:'<,'>norm dit
seems to be the simplest way to achieve your goal without selecting every word:
and :,+7norm dit would be even better because you don't select anything.
The highlight modes can only select blocks (by cursor, by line, or by rectangular block). You can use a plugin such as vim-multiple-cursors to do what you are trying to do.
The only place where Vim allows a non-rectangular, "jagged edge" visual selection is at the end of the lines, i.e. by extending the blockwise selection with $. Therefore, you'd need to (temporarily) get rid of the trailing </th> (or include it in the selection, but operate in such a way that they are kept intact).
You shouldn't need a selection to work with the text. For example, to delete the text inside the tags, you can use a substitution:
:%s#<th>\zs.*\ze</th>##
You can't. You can only select rectangular blocks in block select mode. Maybe a plugin solves this?

Resources