Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to open file in the same window in Vertical or Horizontal split ? #75

Open
Migacz85 opened this issue Feb 22, 2019 · 6 comments
Open

Comments

@Migacz85
Copy link

Hi I just can't figure it out how I can open another file that will be open vertically or horizontally in new window ? I checked ranger tab methond and that is working fine. But still could not find the way how to open file in new window without closing original file where ranger method was triggered. Maybe this was just not coded ?
Thanks !

@francoiscabrol
Copy link
Owner

yes there is no command for doing that currently. The way to open a file in a splitted window is to first create the new splitted window and then run ranger inside.

@Migacz85
Copy link
Author

Migacz85 commented Mar 1, 2019

Workaround :)

@xuta
Copy link

xuta commented Mar 4, 2020

Fair enough.

@andyjessop
Copy link

andyjessop commented Sep 23, 2020

I'm trying to get this to work too.

If I call :split then :Ranger, it opens in the full window rather than the split even if though split is focussed.

Edit: sorry, I misread the issue. I'm asking about opening the explorer itself. I can open a new issue if necessary.

@raghavmallampalli
Copy link

A very simple one line map for what you want:

map <leader>r :vnew<CR>:RangerWorkingDirectory<CR>

To remap the existing command as recommended in the README.md:

let g:ranger_map_keys = 0
map <leader>f :vnew<CR>:RangerWorkingDirectory<CR>

Using :new instead of :vnew will let you open a horizontal split instead of a vertical one.

Incidentally @andyjessop consider switching to neovim since I don't have that issue in neovim. Make sure to install the additional dependency if you do.

@ahmedfawzy98
Copy link

ahmedfawzy98 commented Jan 8, 2021

Just in case anyone wants to open the current working directory rather than the working directory, we can modify the line map that @raghavmallampalli mentioned to open split from the current buffer:

map <leader>r :sp<cr>:RangerCurrentDirectory<cr> " for horizontal split

and :vs instead of :sp for vertical split.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants