when i travel between files using a shortcut over a pathfile, then it seems like i don't just travel between files.
i go to a file using >, within that file i change location of the cursor and do something, then i press <. but instead of going to the previous file, it first goes to the original location i was at when i entered the file, then i need to press < again to actually get to the previous file.
that's a nuisance for it doesn't allow me to change the stored location within the destination file. it always remains the same so i always enter at the same place, plus this requires two clicks to travel when only one is necessary. and this makes the system behavior more confusing.
this problem only seems to arise when i enter very large files. with the small ones the location works fine.
how do i make the < button move me to the previous file i was in, directly, always?
p.s.
is use the following mapping in my vimrc:
noremap > gf
noremap < <C-o>
i have tried substituting <C-o> with <C-6>, but that doesn't work, for some reason.
Switch between files Here, N is capital (Type SHIFT+n). Start editing the files as the way you do with Vim editor. Press 'i' to switch to interactive mode and modify the contents as per your liking. Once done, press ESC to go back to normal mode.
Type "gg" in command mode. This brings the cursor to the first line.
If we are in the vim editor, then simply do this, “Press the ENTER key, write the Line number, and press Shift+ g”: Again the output is the same.
Ctrl-w = tells Vim to assign an equal number of lines to each viewport.
You can use :bp
in your mapping (previous buffer):
:noremap < :bp<CR>
Mapping to <C-6>
doesn't work for me either, but <C-^>
does.
It seems to me that you're looking for a way to move directly to a certain buffer rather than a previous buffer. Using <C-o>
takes you backwards through the jumplist, which is why you lose position in the edited file.
Do your pathfiles usually have a certain extension? If not you could give them a unique extension and try a mapping something like this:
noremap < :b *.pf
.pf being whatever extension you choose. This switches to the buffer with that name.
Unfortunately if you have more than one buffer with that extension it'll fail, in which case it's probably best to do a quick :b
followed by the name.
I use this mapping for when I'm working with a handful of buffers:
nnoremap <Leader>ls :ls<CR>:b
Using this I can just hit ,ls
, look at the list, type the buffer I want and hit enter to move to that buffer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With