lambdalisue/vim-fern

How to open fern on a parent directory of a current buffer and focus on file?

Closed this issue · 2 comments

How to open fern on a parent directory of a current buffer and focus on file?

I tried this:

:Fern %:h -wait -reveal=%

But it obviously doesn't work. Maybe I missed something when was reading the doc?

Thanks!

Maybe

:Fern %:p:h -wait -reveal=%

If that doesn't work, use <C-r>= like <C-r>=expand('%:p:h')

							*c_CTRL-R_=*
			'='	the expression register: you are prompted to
				enter an expression (see |expression|)
				(doesn't work at the expression prompt; some
				things such as changing the buffer or current
				window are not allowed to avoid side effects)
				When the result is a |List| the items are used
				as lines.  They can have line breaks inside
				too.
				When the result is a Float it's automatically
				converted to a String.
				Note that when you only want to move the
				cursor and not insert anything, you must make
				sure the expression evaluates to an empty
				string.  E.g.: >
					<C-R><C-R>=setcmdpos(2)[-1]<CR>
:Fern %:p:h -wait -reveal=%

That worked, thanks!