diff options
author | hut <hut@hut.pm> | 2018-05-15 22:53:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-15 22:53:16 +0200 |
commit | c81b211347b0f8cc5fb7abdb7c421f3e108f7b80 (patch) | |
tree | 15334b21311eb61cb90ee387b4986e842d9f1aa6 | |
parent | 2c02126b566f042d8c6058f7e37309fe063a584b (diff) | |
parent | e93680ebfad8ac1c22723f48cac6ed83114c5f14 (diff) | |
download | ranger-c81b211347b0f8cc5fb7abdb7c421f3e108f7b80.tar.gz |
Merge pull request #1174 from rod-stuchi/yank_without_ext
Yank name without extension
-rwxr-xr-x | ranger/config/commands.py | 8 | ||||
-rw-r--r-- | ranger/config/rc.conf | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py index 8d444dd6..63331c8c 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -1725,6 +1725,7 @@ class yank(Command): modes = { '': 'basename', + 'name_no_ext': 'splitext', 'name': 'basename', 'dir': 'dirname', 'path': 'path', @@ -1757,7 +1758,12 @@ class yank(Command): clipboard_commands = clipboards() - selection = self.get_selection_attr(self.modes[self.arg(1)]) + mode = self.modes[self.arg(1)] + if mode == "splitext": + selection = [os.path.splitext(self.get_selection_attr('basename')[0])[0]] + else: + selection = self.get_selection_attr(mode) + new_clipboard_contents = "\n".join(selection) for command in clipboard_commands: process = subprocess.Popen(command, universal_newlines=True, diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index 342c22d9..f80f699b 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -413,6 +413,7 @@ map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh map yp yank path map yd yank dir map yn yank name +map yw yank name_no_ext # Filesystem Operations map = chmod |