From 098c94b8789b8126d3dbed384166342cd422e51b Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 28 Sep 2016 19:34:16 +0100 Subject: [PATCH] Do not automatically enable ranger on directory open errors Use an explicit command that does that 'ranger-open-on-edit-directory' and remove the file_manager option that is not needed anymore. --- rc/extra/ranger.kak | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/rc/extra/ranger.kak b/rc/extra/ranger.kak index 116e800a..134249e3 100644 --- a/rc/extra/ranger.kak +++ b/rc/extra/ranger.kak @@ -1,21 +1,13 @@ # http://ranger.nongnu.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -# the file manager option is used to decide which one should be used when trying to edit a directory. -decl str file_manager - -hook global KakBegin .* %{ %sh{ - if [ -z "$kak_opt_file_manager" ]; then - echo set global file_manager ranger - fi -}} - -hook global RuntimeError "\d+:\d+: '\w+' (.*): is a directory" %{ %sh{ - directory=$(expr $kak_hook_param : "[0-9]*:[0-9]*: '[a-z]*' \\(.*\\): is a directory") - if [ "$kak_opt_file_manager" = ranger ]; then - echo ranger $directory - fi -}} +def ranger-open-on-edit-directory \ + -docstring 'fallback on ranger when trying to open a directory' %{ + hook global RuntimeError "\d+:\d+: '\w+' (.*): is a directory" %{ %sh{ + directory=$(expr $kak_hook_param : "[0-9]*:[0-9]*: '[a-z]*' \\(.*\\): is a directory") + echo ranger $directory + }} +} def ranger -docstring 'ranger file manager' \ -params .. \