I want to jump out from quotes. When I was not using ReSharper 'Tap' key helped to jump out from double quotes, but it is not working when using ReSharper.
Of course I do not want to use right arrow key.
Help please.
If you're looking to jump out of the method arguments altogether, use Ctrl+Shift+Enter (Complete Statement).
If your intention is to quit the current string value to start entering the next argument, then I'm not sure anything apart from the right arrow or Ctrl + right arrow will work.
What's the 'Tap' key btw?
As a workaround you can also use Ctrl+W which is 'Expand selection'. Pressing it around three times will select the entire string literal. Then you can press → to go to the right side of selection.
I'm not sure whether there is such a command in Resharper, but if you're saying that this command there was in VS before Resharper then you can find this command in Options->Environment->Keyboard
Related
I was coding on sublime text 3 and I wanted to copy and paste a section of my code somewhere else.
So I did ctrl + arrow keys. But it didn't copy and paste like usual. It only moved the thing. So I tried again, but in vain. Also, I wanted to make a doc string. So I typed double quote two times and then moved the cursor in between the quotes to wright. But when I began to wright, it replaced the last double quote with my text. I tried again and it had the same result. I tried reinstalling it, but it didn't work. I searched on stack overflow and they didn't have my question. How can I fix it?
You accidentally pressed the Insert key or otherwise got your system into overwrite mode, instead of the standard insert mode. By pressing Insert again, this is reverted, and things will be back to working as normal.
Frequently when I am doing a find and replace in vi I will do it like this:
:%s/find/replace/gc
This gives you the option to skip by pressing n, or replace by pressing y. But, sometimes I will accidentally skip over one in a large file by pressing n when I meant to press y.
How do I go backwards to the previous one and give me a second change?
Essentially, how to I find (search) the other direction temporarily? thanks.
I'm not sure if you would like to interrupt current find-replace operation and resume it again. But if that is acceptable, here is my suggestion:
Start your find-replace the way you mentioned:
:%s/find/replace/gc
After you accidentally skip over a substitution by pressing n, interrupt the search by pressing <ctrl-C>
Press <shift-N> to go back to the previous occurrence of your find term
Run find-replace a little differently while you are at this word: :.,$s/find/replace/gc
Continue the operation
All this functionality works with vim native capabilities without having to install any addon.
Note: The .,$ range specifier indicates to perform :s (substitute) operation over a range of lines that start with current line (indicated by .) and until last line (indicated by $).
Note2: It might be known to you, but reiterating for anyone else who stumbles upon this post searching for something similar - The % range specifier indicates to perform :s (substitute) operation over all lines of currently active buffer.
This is not answer to the question, but a very good alternative. I recently discovered the CtrlSF plugin and it improves the search /replace process dramatically.
Basically, you have the search results in a buffer and you can do all the replacements in this single buffer.
In your scenario, you first do :CtrlSF find, get a buffer with all the matches in all files and then you do /find and move with n over your targets and change them (of course, you can actually change only the first one and then repeat the replacement with .).
If you miss some target, you just hit N to go back to the previous result and replace it.
Seems like you can't back to previous match using this pattern. Appeared bar propose following commands y/n/a/q/l/^E/^Y but no one of them will return backward to previous match.
But you can use little different pattern described bellow:
Type this /pattern replacing pattern with interested word;
Your cursor is navigated to first occurrence, if you don't need to change it press n it will navigates you to the next occurrence;
Since you understand you need to replace a word, do this by typing cw, this command cuts the forward word and turns you to insertion mode;
Type in desired text on the released place and press ESC to switch back to command mode;
Now again press n until desired occurrence;
Since you realize that you need to change an occurrence, just press on . it will repeat previously mentioned actions;
If you want to go back just use N.
Seeing the help of vim I have problem to understand what refers the word count I see it many times while reading the manual:
i Insert text before the cursor [count] times
It would be awesome if you give an example for it.
Vim's "Count" allows you to repeat an operator or command several times. For example, if you are on the first cursor of this line:
Hello world, how are you?
And you type dw you will have
world, how are you?
Rather than typing dwdwdwdw, you may simply type 4dw or d4w and you will have
are you?
More specific to your example, you may type something like 5ihello<esc> and this will insert
hellohellohellohellohello
Like Kevin said in a comment, you can read up more in the help docs with :h count, which says:
*count* *[count]*
[count] An optional number that may precede the command to multiply
or iterate the command. If no number is given, a count of one
is used, unless otherwise noted. Note that in this manual the
[count] is not mentioned in the description of the command,
but only in the explanation. This was done to make the
commands easier to look up. If the 'showcmd' option is on,
the (partially) entered count is shown at the bottom of the
window. You can use <Del> to erase the last digit (|N<Del>|).
Just in case somebody is wondering how count plus insert works, you have to type a number before pressing i, then it will enter in insert mode, where you can type what you want, after you press esc to go back to normal mode, it will repeat count times what you typed.
Can you provide a link to the place in the documentation where you are confused? I would have posted this as a comment instead of an answer, but my reputation is not high enough. In attempting to answer your question without clarification:
Usually [count] can be substituted with a number.
For example; consider the delete command d. If you position your cursor in the middle of a text line and type :d[count] (ex: :d4) then press an arrow key (left or right arrow); you will end up deleting [count] (e.g. 4 characters) in the corresponding direction of the arrow key.
In the case of insert I am not sure to what the argumentcount is referring.
EDIT: I forgot to mention that you must hit the enter key after :d4. Then press the left arrow key. Of course, in order for VIM to realize that you are entering a command you must exit insert mode by pressing the esc key prior to entering the command :d4.
So Intellij/Eclipse have this nice functionality where typing a ' or ( automatically inserts the closing ' or ).
While this is great in normal operation, using the Vim mode/vim keybindings makes this more of a pain.
So for example I am typing a function which takes 2 strings as an argument:
new MyObject('arg1','arg2');
when I type the opening ', Intellij will automatically insert the closing '. Now when I have to type the second argument, I will have to:
Press Esc to leave insert mode
Use l to move caret after the closing '
Enter back into insert mode.
Not to mention this issue occurs when you have to type the semi colon at the end of the function call (to skip the closing )).
This seems like too many operations. Moving your hand to press escape breaks the flow of typing and the auto completion of intellj here causes more hassle than productivity.
Is there a better way around this or am I stuck with just disabling this particular auto insertion stuff?
Please check if turning Settings/Editor/Smart keys/Insert pair quote off helps
I am trying to get off of using the arrow keys to navigate in VIM, so that I dont have to move my hands off the home rows. The problem I am having is finding the End Key equivalent. I used it a ton to go to the end of a line. I can still use it, but then I have to move my hands off the home rows, making this adjustment pointless. $ moves my cursor to the last character in the line, not after the last character in the line, which is where I want it to go. Why would I want to insert right before the last character on the line?
How can I remap the functionality of End Key (which can be used in insert and visual mode) to something else?
Thank you
It looks like you are doing $i which is the wrong approach.
$ is the right command to reach the end of the line but i is used to enter insert mode before the current character. You are supposed to use a to enter insert mode after the current character.
So you seem to be blocked because you don't know about a which is just as basic as i, IMO.
$a would solve your immediate problem.
But there's more, did you know that you can use I to enter insert mode at the beginning of the line? What command could we use to enter insert mode at the end of the line?
You are right, the correct command to enter insert mode at the end of the line is simply A, as #dusan commented.
You don't need to remap anything. What you need is a second (first?) injection of $ vimtutor.