How to do forward / back navigation in VSCode but disregard manual cursor (eg: up/down) motion? - visual-studio-code

In VSCode, is there a way to disregard cursor motion in the code navigation history? That is, when I jump into a definition, I usually move the cursor a bit (eg: up/down) to inspect the surrounding code. When I issue the "navigate back" command, it incorporates the cursor movement into the navigation history stream. That is, navigating back will just move up/down one line. I almost always want to disregard manual cursor movement when navigating code. The JetBrains IntelliJ suite of tools behaves this way. Can VSCode be configured to do the same?

Turned out to be a conflict with VSCode/VIM causing this behavior. VSCode/VIM affects the code navigation history it looks like, injecting cursor movements into the command stream so that VSCode's native "Go Back" traverses the cursor movement stream, which is generally undesirable.
The VIM jump list behaves correctly though so I've switched to using ctrl+o and ctrl+i to navigate back/forward.

Related

How to fix tab key in VS Code to the code editor window only

When editing code and I hit TAB I expect the typical 4 spaces to be inserted and the cursor to move. In VS Code, if I hit TAB it takes me to the ... in the upper right of the application, tab again it goes to the Open Editors. Its like TAB is jumping around the editor instead of tabbing into my document.
How does one fix that. Or was a setting changed?
At the bottom of the application, I noticed a Tabs move Focus was lit. I clicked it and it turned off. Not sure how it turned on or what turns it on, but if I click it off, tabs go back to normal. Strange.

VS Code search inside the editor without rollover

If I search inside the actual editor of VS Code without an match below the current line, VS Code rollover the search from the top of the page.
How can I disable this?
One thing you can do instead of disabling this (which I don't thing this is configurable) is to use ctrl+U. It's soft undo, moves the cursor back to it's previous location. This is particularly useful when you need to move down in a long file to copy a variable or function name and then go back to your original position. So when vscode goes to the top of the page, put the cursor there, and then press ctrl+U to go back to the previous line you where editing.

In Eclipse, a way to see code errors without moving the mouse?

I've programmed in Emacs for a while, and I'm starting to learn Java in Eclipse. I prefer not to have to take my hands off the keyboard in order to see errors that Eclipse marks in the code... so I'd rather not hover over them, (plus the red X on the left margin is annoyingly small and hard to target for a hover)... is there a way to get them to pop up simply by moving the cursor to that point?
The "Show Tooltip Description" command usually has the keybinding of F2. You can change it on the Keys preference page if you like.

How to navigate to the last cursor position in Eclipse if it is in the same file and was not edited?

I had used Eclipse earlier, afterwards I switched to IntelliJ for a while and now back to Eclipse. There is one thing from IntelliJ which I can't find in Eclipse: Navigating to the real last cursor position - even in the same file and even if the cursor was moved between the lines using the arrow keys on the keyboard or the mouse. IntelliJ is able to do it and I found it really useful.
For example:
I move the cursor using the keyboard's down arrow key successively on lines 10, 20, 30.
Now I am on line 30 and when I press Alt+left I would like the cursor to go to the line 20.
After pressing Alt+left again I would like the cursor to go to line 10.
After pressing Alt+right afterwards I would like the cursor to go to the line 20 again.
The following shortcuts are available in Eclipse:
Alt+left - it navigates back to the last cursor position in a different file, not to the last cursor position in the current file even if I already moved my cursor in the same file
Alt+right - it navigates forward to the next cursor position in a different file, not to the next cursor position in the current file even if I already moved my cursor in the same file
Ctrl+Q - moves the cursor to the last edit location
The latest version of Eclipse in which I tested the above-mentioned shortcuts: Eclipse Luna 4.4.0.
I found the following discussion about the same problem (lacking such functionality in Eclipse) which is quite old, but it seems that this functionality has not been implemented in Eclipse since that discussion in eclipse forum.
Does anyone of you know if this functionality will be implemented in Eclipse? Is there a plugin for Eclipse which provides such functionality of navigating back to the last cursor position?
Please note, that due to the reasons described above, I'm not satisfied with the solutions provided as an answer to this SO question 'How to navigate to the last cursor position in Eclipse?' or to the other SO question 'How to go back in Eclipse?'.
Go to Preferences / General / Keys. You'll be able to see or edit the bindings for:
Backward History: default is Alt←
Forward History: default is Alt→
You may also use those shortcuts (and see the key bindings) in the toolbar:
answered Sep 7 '12 at 8:27
Denys Séguret
There is Alt+left arrow and Alt+right arrow to navigate to previous/next cursor positions, and CtrlQ to go to the last edited position
Use bookmarks for that because there is no another way of tracking the necessary code lines. Here is the link about how to use bookmarks http://www.luisdelarosa.com/2005/02/16/eclipse-tip-use-bookmarks-to-track-important-places-in-your-code/
Screenshot of the aforementioned article's content in the link:
I use the side buttons of my mouse and it works for me
The key combination Ctrl + Q brings you back to the last locations, where editing was done.
Use Ctrl + L for an overview of shortcuts. See also Eclipse shortcuts or this Eclipse cheat sheet.
Navigate > Back (Alt+Left_Arrow) already allows to navigate back to previous cursor positions even in the same file. E.g. after you Ctrl+Click on a reference to a local variable (to go to the declaration), then Alt+Left puts the caret back to the reference.
Exlpanation source

How can I configure emacs to switch to a particular buffer when I click the mouse in it?

I'm using iTerm2 on my mac to ssh into a Linux box and run emacs in the terminal. On a big monitor, I like to split the window to see multiple buffers side-by-side. I'd like to be able to switch to a particular buffer by clicking the mouse in it (rather than doing C-x o).
What seems to be happening is that if I click the mouse anywhere outside the currently active buffer e.g. in the next buffer, on the mode line etc., the click is being interpreted as which is bound to (tmm-menubar-mouse EVENT).
I have disabled the menubar by doing the following in my .emacs_d/init.el:
(menu-bar-mode -1)
This seems to disable the visible display of the menu bar at the top of the window, but the mouse click behavior I described is still happening.
I think what I need is to have the click interpreted as something other than and then bind that to some function that detects which buffer the click happened in and switch to it. But, I don't know how to do that and the searching I've done hasn't yielded any clear answer. Can anyone help?
Alternatively, I looked into using windmove to enable switching between buffers with SHIFT and the arrow keys. I did (windmove-default-keybindings) but emacs then seems to respond to SHIFT left-arrow by inserting "2C" into the buffer and SHIFT-right-arrow by inserting "2D". If anyone has any tips on making this work too, I'd love to hear them.
Thanks
I ran into this problem a while ago, where clicking on column > 95 was interpreted as <menu-bar> <mouse-1>, which invokes tmm-menubar-mouse. It turned out to be a bug:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6594
There hasn't been a formal release since this bug was fixed, but you can get the patch here:
http://bzr.savannah.gnu.org/lh/emacs/emacs-23/revision/100618
If I recall correctly, you should be able to just drop the modified file into your existing emacs installation and byte-compile it (assuming you're running the 23.3.1, the latest release).