diff options
author | Rodrigo Stuchi <rod.stuchi@gmail.com> | 2018-05-14 23:03:44 -0300 |
---|---|---|
committer | Rodrigo Stuchi <rod.stuchi@gmail.com> | 2018-05-14 23:57:31 -0300 |
commit | 5fcaeafa4001584211c83c5a28dc3b4bd15bdb1f (patch) | |
tree | 57c55f08147a697d4203ee4b61a662d082cd252b | |
parent | 42c0d2a65b2b370ac20838aa4507a263cdec24b6 (diff) | |
download | ranger-5fcaeafa4001584211c83c5a28dc3b4bd15bdb1f.tar.gz |
Yank name without extension
yw map to yank a filename without extension closes #1162 removed unnecessary semicolon
-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 |