tags:

views:

166

answers:

4

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.

+3  A: 

You can use :bp in your mapping (previous buffer):

:noremap < :bp<CR>
jhwist
If i go into a file, then back, then go into another file, then when i try to go back, i go into the file i went into the first time. So something is wrong.
Hermann Ingjaldsson
+3  A: 

Mapping to <C-6> doesn't work for me either, but <C-^> does.

Curt Nelson
but if i travel to a pathfile using :e ~/somepathfile and then go again to some other, then when i try to go my way back i cant get past where i entered a new file by the :e method.
Hermann Ingjaldsson
A: 

You can try the bufmru plugin, it works like Ctrl-^, using the space key, but allows you also to go past the two most recently buffers using the f and b keys. These are of course default mappings.

ergosys
+3  A: 

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.

Alligator