Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# ARCHIVED
Please if you are on neovim use [rnvimr](https://github.com/kevinhwang91/rnvimr) instead, which now implements full mouse support (unlike this fork, that onlyl enables neovim mousewheeel support).

If you are on vim, refer to upstream [ranger.vim](https://github.com/francoiscabrol/ranger.vim)

Ranger.vim
==========

Expand All @@ -10,11 +15,40 @@ Installation

Install it with your favorite plugin manager. Example with vim-plug:

Plug 'francoiscabrol/ranger.vim'
Plug 'francoiscabrol/ranger.vim'

If you use neovim, you have to add the dependency to the plugin bclose.vim:

Plug 'rbgrouleff/bclose.vim'
Plug 'rbgrouleff/bclose.vim'

lazy.vim lua configuration example
```lua
{
"zeioth/ranger.vim",
dependencies = {"rbgrouleff/bclose.vim"},
cmd = {
"Ranger"
"RangerCurrentFile"
"RangerCurrentDirectory"
"RangerWorkingDirectory"
"RangerNewTab"
"RangerCurrentFileNewTab"
"RangerCurrentDirectoryNewTab"
"RangerWorkingDirectoryNewTab"
"RangerCurrentFileExistingOrNewTab"
"RangerCurrentDirectoryExistingOrNewTab"
"RangerWorkingDirectoryExistingOrNewTab"
},
init = function()
vim.g.ranger_map_keys = 0

-- Change terminal and TERMCMD to enable this feature:
-- Calling a terminal from inside ranger.
vim.g.ranger_terminal = 'foot'
vim.g.ranger_command_override = 'LC_ALL=es_ES.UTF8 TERMCMD="foot -a \"scratchpad\"" ranger'
end
},
```

How to use it
-------------
Expand Down
32 changes: 32 additions & 0 deletions plugin/ranger.vim
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ if has('nvim')
else
call termopen(s:ranger_command . ' --choosefiles=' . s:choice_file_path . ' --selectfile="' . currentPath . '"', rangerCallback)
endif
setfiletype rangervim
startinsert
endfunction
else
Expand Down Expand Up @@ -139,3 +140,34 @@ if !exists('g:ranger_map_keys') || g:ranger_map_keys
map <leader>f :Ranger<CR>
endif

"----------------------------------------------------------------------------------------------"
" HACK: Enable mouse scroll support on neovim"
" Credits: kevinhwang91 → https://github.com/kevinhwang91/rnvimr/issues/58
"----------------------------------------------------------------------------------------------"
function s:set_mouse_with_rnvimr() abort
let n_mouse = &mouse
augroup RnvimrMouse
autocmd!
autocmd FileType rnvimr call <SID>set_mouse_with_rnvimr()
augroup end

if match(n_mouse, '[a|h|n]') >= 0
augroup RnvimrMouse
autocmd TermEnter,WinEnter <buffer> call nvim_set_option('mouse', '')
execute printf("autocmd WinLeave <buffer> call nvim_set_option('mouse', '%s')", n_mouse)
augroup END
endif

if system('tmux display -p "#{mouse}"')[0]
augroup RnvimrMouse
autocmd TermEnter,WinEnter <buffer> call system('tmux set mouse off')
autocmd WinLeave <buffer> call system('tmux set mouse on')
augroup END
endif
endfunction

if has('nvim')
augroup RnvimrMouse
autocmd FileType rangervim call <SID>set_mouse_with_rnvimr()
augroup END
endif