diff options
-rwxr-xr-x | ranger/config/commands.py | 7 | ||||
-rw-r--r-- | ranger/config/rc.conf | 2 | ||||
-rw-r--r-- | ranger/container/fsobject.py | 6 | ||||
-rw-r--r-- | ranger/core/tab.py | 8 |
4 files changed, 10 insertions, 13 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py index a2492369..7f5fc764 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -1727,7 +1727,7 @@ class yank(Command): modes = { '': 'basename', - 'name_without_extension': 'splitext', + 'name_without_extension': 'basename_without_extension', 'name': 'basename', 'dir': 'dirname', 'path': 'path', @@ -1761,10 +1761,7 @@ class yank(Command): clipboard_commands = clipboards() 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) + selection = self.get_selection_attr(mode) new_clipboard_contents = "\n".join(selection) for command in clipboard_commands: diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index 3725c400..6b0802bb 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -413,7 +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_without_extension +map y. yank name_without_extension # Filesystem Operations map = chmod diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py index 0c9f70f6..37151ecf 100644 --- a/ranger/container/fsobject.py +++ b/ranger/container/fsobject.py @@ -6,7 +6,7 @@ from __future__ import (absolute_import, division, print_function) import re from grp import getgrgid from os import lstat, stat -from os.path import abspath, basename, dirname, realpath, relpath +from os.path import abspath, basename, dirname, realpath, relpath, splitext from pwd import getpwuid from time import time @@ -171,6 +171,10 @@ class FileSystemObject( # pylint: disable=too-many-instance-attributes,too-many return basename_list @lazy_property + def basename_without_extension(self): + return splitext(self.basename)[0] + + @lazy_property def safe_basename(self): return self.basename.translate(_SAFE_STRING_TABLE) diff --git a/ranger/core/tab.py b/ranger/core/tab.py index 7bb45d75..1d5e69d4 100644 --- a/ranger/core/tab.py +++ b/ranger/core/tab.py @@ -4,7 +4,7 @@ from __future__ import (absolute_import, division, print_function) import os -from os.path import abspath, normpath, join, expanduser, isdir, dirname +from os.path import abspath, normpath, join, expanduser, isdir import sys from ranger.container import settings @@ -123,11 +123,9 @@ class Tab(FileManagerAware, SettingsAware): # pylint: disable=too-many-instance # get the absolute path path = normpath(join(self.path, expanduser(path))) - selectfile = None if not isdir(path): - selectfile = path - path = dirname(path) + return False new_thisdir = self.fm.get_directory(path) try: @@ -157,8 +155,6 @@ class Tab(FileManagerAware, SettingsAware): # pylint: disable=too-many-instance self.thisdir.sort_directories_first = self.fm.settings.sort_directories_first self.thisdir.sort_reverse = self.fm.settings.sort_reverse self.thisdir.sort_if_outdated() - if selectfile: - self.thisdir.move_to_obj(selectfile) if previous and previous.path != path: self.thisfile = self.thisdir.pointed_obj else: |