Sublime Cursor History - sublimetext3

I know Sublime Text offers a feature to jump back and forth.
But, when I browse through my source code using "Go To Definition" a couple of times, and use "Jump back" to jump back to where I started it won't take me there. It works for a couple of previous cursor positions but not all the way through.
Is it because there is a limit as to how many cursor locations it can hold, or does it have like a timer to flush the data?
How can I make it work, so I can jump back to as many positions as I want?
Build-3176

Related

How to prevent neovim from placing cursor at the last line?

Recently I am trying to switch to neovim but there is some annoying cursor movement as you can see below:
Each echoed text may be followed by cursor at the end. Saving file is quite often command so it is very annoying. The problem may occur when leaving insert mode or even with popup menu when completion takes some time (cursor is placed after the first line of menu). Another example:
Completion menu based on completefunc. It is quite slow and unstable yet but what the hell is this cursor doing?

Is there a way for ctrl-6 to jump back to EXACT the same page content of the previous file

I used ctrl-6 to jump between two files and compare these two files page by page, But each time when I switch back, the page content is changed. That is, a new page with previous cursor line in the middle of screen now is shown instead.
Is there a way to keep the page position in the screen unchanged when I switched back.
Thanks a lot!
May I suggest using tabs (C-PgUp and C-PgDn to switch)?
You can always start by doing C-wsC-^C-wT
Otherwise see this odler answer of mine for hints on restoring cursor positions:
After a :windo, how do I get the cursor back where it was?
Vim buffer position change on window split (annoyance)
This might not be what you're looking for, but just in case: For a different approach to the task you're doing (visually comparing two files), see :help scrollbind. You would do :set scrollbind in two side-by-side windows and open one file in each, then scroll through them together, linked. See also vimdiff for even more functionality.

Vim/MacVim: when I scroll with mouse, the text cursor moves too!

I've been getting used to Vim/MacVim for the last few weeks. One of main problems I seem to be having is when I scroll around using the mouse (especially when I'm trying to select large portions of text) the text insertion cursor moves too and doesn't stay where it was (like in TextMate for example). This means I've selected a large piece of text, when I scroll back up to review my selection the cursor will move which messes with the selection that I've made.
I do realise I should get used to text selection with visual mode, and I am one bit of a time, but sometimes it's the best tool to use the mouse.
Is there a way of fixing this behaviour?
:help scrolling tells you:
These commands move the contents of
the window. If the cursor position is
moved off of the window, the cursor is
moved onto the window (with
'scrolloff' screen lines around it).
So basically I would say that it is not possible to leave the cursor where it was when you are scrolling. The cursor is always visible in your window, and therefore your visual selection will extend.
Probably you would like to xnoremap <ScrollWheelUp> <esc><ScrollWheelUp> and same for ScrollWheelDown. Use then gv to restore your selection.
I made a screencast about Vim's changelist and jumplist which addresses the issue of Vim's cursor always being on screen. The changelist maintains a list of all of the places in your document where you have made an edit. You can move back and forward through the list with the commands g; and g, respectively. Or if you want to put your cursor back on the last place where you made an edit and go into insert mode, just press gi.
As Alois Cochard pointed out, the o key is very useful when you are in visual mode. It moves the cursor between the start and the beginning of your selection. So if your selection is larger than your screen, it will move you from one end to the other.

How to jump back and forth between previous/next cursor positions, limited to current buffer only?

I like the functionality of <C-O> and <C-I> to go back and forth to different positions. But many times I would prefer to stay within the current buffer, and always get taken by surprise when a new buffer opens up replacing the one I was looking at.
(1) Is there a way to achieve this? i.e., limit <C-O> and <C-I> to the same buffer?
(2) Is there a way to visit all cursor moves, even those that are not normally considered jumps, e.g. 10k?
As for moving in the same file, check out the '' command. It will jump back and forth between the current location and the last jump.

Vim keep cursor location while scrolling

Is there a way to keep the cusror location off-screen in Vim / gVim while scrolling? Similar to many Windows editors.
I know about marks, and do use them. I also know the '.' mark (last edit location), But looking for other ideas.
I'm asking this because sometimes i want to keep the cursor at some location, scroll to another place using the mouse-wheel, and then just press an arow key or something to get me back to that location.
No. vim is a console application, so it doesn't really make sense to have the cursour off-screen (it's possible, but would just be confusing)
An alternative solution, to paraphrase posts from this thread from comp.editors:
Ctrl+o goes to the previous cursor location, Ctrl+i goes to the next (like undo/redo for motions)
Marks seem like the other solution..
Also, use marks. Marks are named by letters. For instance typing ma remembers
the current location under mark a. To jump to the line containing mark a,
type 'a. To the exact location use `a.
Lower-case-letter marks are per-file. Upper-case-letter marks are global;
`A will switch to the file containing mark A, to the exact location.
Basically ma, move around, then `a to jump back.
Another option which Paul suggested,
gi command switches Vim to Insert mode and places cursor in the same position as where Insert mode was stopped last time.
Why don't you split the window, look at what you wanted to look at, and then close the split?
:split
or
:vsplit (if you want to split vertically)
The only similar behavior that I've found in Vim:
zt or zENTER "scroll the screen down as far as possible without moving the cursor"
zb "scroll as far up as possible".
Ctrl+E "scroll one line down, if possible"
Ctrl+Y"scroll one line up, if possible"
Sometimes you can avoid jumping to marks before entering text — gi command switches Vim to Insert mode and places cursor in the same position as where Insert mode was stopped last time.
Google says that the cursor (and therefore current line) must be visible in Vi, so you'll have to use marks.
Also very useful are the '' (2x single quotes) and `` (2x back quotes).
The former jumps back to the line you were prior to the last jump (for instance, a page down).
The latter jumps back to the line and column you were prior to the last jump.

Resources