diff options
-rw-r--r-- | .flake8 | 2 | ||||
-rwxr-xr-x | ranger/config/commands.py | 8 | ||||
-rw-r--r-- | ranger/config/rc.conf | 1 | ||||
-rw-r--r-- | ranger/container/directory.py | 5 | ||||
-rw-r--r-- | ranger/core/main.py | 5 | ||||
-rw-r--r-- | ranger/ext/direction.py | 4 | ||||
-rw-r--r-- | ranger/ext/img_display.py | 16 | ||||
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 4 | ||||
-rw-r--r-- | ranger/gui/widgets/view_base.py | 4 |
9 files changed, 28 insertions, 21 deletions
diff --git a/.flake8 b/.flake8 index f5072c08..b77e4e6c 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] max-line-length = 99 -ignore = E221 +ignore = E221,W503 diff --git a/ranger/config/commands.py b/ranger/config/commands.py index 8d444dd6..dc987051 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -1725,6 +1725,7 @@ class yank(Command): modes = { '': 'basename', + 'name_without_extension': '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..3725c400 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_without_extension # Filesystem Operations map = chmod diff --git a/ranger/container/directory.py b/ranger/container/directory.py index 18b1687c..e281e6c9 100644 --- a/ranger/container/directory.py +++ b/ranger/container/directory.py @@ -338,8 +338,9 @@ class Directory( # pylint: disable=too-many-instance-attributes,too-many-public dirlist = [ os.path.join("/", dirpath, d) for d in dirnames - if self.flat == -1 or - (dirpath.count(os.path.sep) - mypath.count(os.path.sep)) <= self.flat + if self.flat == -1 + or (dirpath.count(os.path.sep) + - mypath.count(os.path.sep)) <= self.flat ] filelist += dirlist filelist += [os.path.join("/", dirpath, f) for f in filenames] diff --git a/ranger/core/main.py b/ranger/core/main.py index ae7a691c..b5d0af77 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -443,9 +443,8 @@ def load_settings( # pylint: disable=too-many-locals,too-many-branches,too-many custom_conf_is_readable = os.access(custom_conf, os.R_OK) system_conf_is_readable = os.access(system_conf, os.R_OK) - if (os.environ.get('RANGER_LOAD_DEFAULT_RC', 'TRUE').upper() != - 'FALSE' or - not (custom_conf_is_readable or system_conf_is_readable)): + if (os.environ.get('RANGER_LOAD_DEFAULT_RC', 'TRUE').upper() != 'FALSE' + or not (custom_conf_is_readable or system_conf_is_readable)): fm.source(default_conf) if system_conf_is_readable: fm.source(system_conf) diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py index 7df45556..33ebb604 100644 --- a/ranger/ext/direction.py +++ b/ranger/ext/direction.py @@ -97,8 +97,8 @@ class Direction(dict): return self.get('cycle') in (True, 'true', 'on', 'yes') def one_indexed(self): - return ('one_indexed' in self and - self.get('one_indexed') in (True, 'true', 'on', 'yes')) + return ('one_indexed' in self + and self.get('one_indexed') in (True, 'true', 'on', 'yes')) def multiply(self, n): for key in ('up', 'right', 'down', 'left'): diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index 67941e27..78d71cb2 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -434,20 +434,20 @@ class URXVTImageDisplayer(ImageDisplayer, FileManagerAware): pct_width, pct_height = self._get_sizes() sys.stdout.write( - self.display_protocol + - path + - ";{pct_width}x{pct_height}+{pct_x}+{pct_y}:op=keep-aspect".format( + self.display_protocol + + path + + ";{pct_width}x{pct_height}+{pct_x}+{pct_y}:op=keep-aspect".format( pct_width=pct_width, pct_height=pct_height, pct_x=pct_x, pct_y=pct_y - ) + - self.close_protocol + ) + + self.close_protocol ) sys.stdout.flush() def clear(self, start_x, start_y, width, height): sys.stdout.write( - self.display_protocol + - ";100x100+1000+1000" + - self.close_protocol + self.display_protocol + + ";100x100+1000+1000" + + self.close_protocol ) sys.stdout.flush() diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index b3272cbc..cf322409 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -318,8 +318,8 @@ class BrowserColumn(Pager): # pylint: disable=too-many-instance-attributes text = current_linemode.filetitle(drawn, metadata) - if drawn.marked and (self.main_column or - self.settings.display_tags_in_all_columns): + if drawn.marked and (self.main_column + or self.settings.display_tags_in_all_columns): text = " " + text # Computing predisplay data. predisplay contains a list of lists diff --git a/ranger/gui/widgets/view_base.py b/ranger/gui/widgets/view_base.py index 80061004..4493443e 100644 --- a/ranger/gui/widgets/view_base.py +++ b/ranger/gui/widgets/view_base.py @@ -72,8 +72,8 @@ class ViewBase(Widget, DisplayableContainer): # pylint: disable=too-many-instan sorted_bookmarks = sorted( ( item for item in self.fm.bookmarks - if self.fm.settings.show_hidden_bookmarks or - '/.' not in item[1].path + if self.fm.settings.show_hidden_bookmarks + or '/.' not in item[1].path ), key=lambda t: t[0].lower(), ) |