From c39363954e2c4511375f624a7708c61f43078b86 Mon Sep 17 00:00:00 2001 From: Zeioth Date: Wed, 17 May 2023 15:08:29 +0200 Subject: [PATCH 01/10] Update ranger.vim --- plugin/ranger.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/ranger.vim b/plugin/ranger.vim index 03d5d2b..bbba937 100644 --- a/plugin/ranger.vim +++ b/plugin/ranger.vim @@ -67,6 +67,7 @@ if has('nvim') else call termopen(s:ranger_command . ' --choosefiles=' . s:choice_file_path . ' --selectfile="' . currentPath . '"', rangerCallback) endif + setfiletype rnvimr startinsert endfunction else From e9ae3ec5c5c24a7c417b4f30efdc9014d860f830 Mon Sep 17 00:00:00 2001 From: Zeioth Date: Wed, 17 May 2023 15:15:51 +0200 Subject: [PATCH 02/10] Added: Mouse scroll support on neovim --- plugin/ranger.vim | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/plugin/ranger.vim b/plugin/ranger.vim index bbba937..0f4fb3e 100644 --- a/plugin/ranger.vim +++ b/plugin/ranger.vim @@ -67,7 +67,7 @@ if has('nvim') else call termopen(s:ranger_command . ' --choosefiles=' . s:choice_file_path . ' --selectfile="' . currentPath . '"', rangerCallback) endif - setfiletype rnvimr + setfiletype rangervim startinsert endfunction else @@ -140,3 +140,32 @@ if !exists('g:ranger_map_keys') || g:ranger_map_keys map f :Ranger 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 set_mouse_with_rnvimr() + augroup end + + if match(n_mouse, '[a|h|n]') >= 0 + augroup RnvimrMouse + autocmd TermEnter,WinEnter call nvim_set_option('mouse', '') + execute printf("autocmd WinLeave call nvim_set_option('mouse', '%s')", n_mouse) + augroup END + endif + + if system('tmux display -p "#{mouse}"')[0] + augroup RnvimrMouse + autocmd TermEnter,WinEnter call system('tmux set mouse off') + autocmd WinLeave call system('tmux set mouse on') + augroup END + endif +endfunction + +augroup RnvimrMouse + autocmd FileType rnvimr call set_mouse_with_rnvimr() +augroup END From 33e4e06f96c1edc297d3a673204fd75fec335ee3 Mon Sep 17 00:00:00 2001 From: Zeioth Date: Wed, 17 May 2023 15:16:30 +0200 Subject: [PATCH 03/10] typo fixed --- plugin/ranger.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/ranger.vim b/plugin/ranger.vim index 0f4fb3e..b9da8d3 100644 --- a/plugin/ranger.vim +++ b/plugin/ranger.vim @@ -167,5 +167,5 @@ function s:set_mouse_with_rnvimr() abort endfunction augroup RnvimrMouse - autocmd FileType rnvimr call set_mouse_with_rnvimr() + autocmd FileType rangervim call set_mouse_with_rnvimr() augroup END From 069d8a6fdd2edef259352de7217263506bfa21f0 Mon Sep 17 00:00:00 2001 From: Zeioth Date: Wed, 17 May 2023 15:36:17 +0200 Subject: [PATCH 04/10] Added lazy.vim setup example --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 3980f9d..6ecd30f 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,34 @@ If you use neovim, you have to add the dependency to the plugin bclose.vim: Plug 'rbgrouleff/bclose.vim' +lazy.vim lua example +``` +{ + "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 this to your terminal in case you wanna call 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 ------------- From 10ca18b6fed3fd6892d5e3abeed52f352628b2bc Mon Sep 17 00:00:00 2001 From: Zeioth Date: Wed, 17 May 2023 15:36:42 +0200 Subject: [PATCH 05/10] add lua syntax to the example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ecd30f..3d415c3 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you use neovim, you have to add the dependency to the plugin bclose.vim: Plug 'rbgrouleff/bclose.vim' lazy.vim lua example -``` +```lua { "zeioth/ranger.vim", dependencies = {"rbgrouleff/bclose.vim"}, From c43917f4e885b863127229055b93feedab8e1f62 Mon Sep 17 00:00:00 2001 From: Zeioth Date: Wed, 17 May 2023 15:39:17 +0200 Subject: [PATCH 06/10] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d415c3..fc2d5cb 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,8 @@ lazy.vim lua example init = function() vim.g.ranger_map_keys = 0 - -- Change this to your terminal in case you wanna call a terminal from inside ranger. + -- 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 From ec51e3869c8bf589161d4ac7ab727129082a849a Mon Sep 17 00:00:00 2001 From: Zeioth Date: Wed, 17 May 2023 15:41:51 +0200 Subject: [PATCH 07/10] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fc2d5cb..e7efe29 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ 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 example +lazy.vim lua configuration example ```lua { "zeioth/ranger.vim", From b4e7f1b2604ed1695d4539774c0d72ffac6debff Mon Sep 17 00:00:00 2001 From: Zeioth Date: Wed, 17 May 2023 16:35:14 +0200 Subject: [PATCH 08/10] Enable the hack only in nvim --- plugin/ranger.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin/ranger.vim b/plugin/ranger.vim index b9da8d3..a55fa0d 100644 --- a/plugin/ranger.vim +++ b/plugin/ranger.vim @@ -166,6 +166,8 @@ function s:set_mouse_with_rnvimr() abort endif endfunction -augroup RnvimrMouse - autocmd FileType rangervim call set_mouse_with_rnvimr() -augroup END +if has('nvim') + augroup RnvimrMouse + autocmd FileType rangervim call set_mouse_with_rnvimr() + augroup END +endif From e450cd657122058f10b1a378207d6e66a0b084bd Mon Sep 17 00:00:00 2001 From: Zeioth Date: Fri, 2 Jun 2023 04:27:20 +0200 Subject: [PATCH 09/10] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index e7efe29..2f5dd67 100644 --- a/README.md +++ b/README.md @@ -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, that onlyl enables mousewheeel). + +If you are on vim, refer to upstream [ranger.vim](https://github.com/francoiscabrol/ranger.vim) + Ranger.vim ========== From 34664489f8781c3b3c528d1774615239cc7e1c54 Mon Sep 17 00:00:00 2001 From: Zeioth Date: Fri, 2 Jun 2023 04:27:47 +0200 Subject: [PATCH 10/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f5dd67..5149665 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ARCHIVED -Please if you are on neovim use [rnvimr](https://github.com/kevinhwang91/rnvimr) instead, which now implements full mouse support (unlike this, that onlyl enables mousewheeel). +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)