More flavours stuff and ranger files
This commit is contained in:
parent
9438236bb1
commit
6a934b2266
|
|
@ -0,0 +1,82 @@
|
||||||
|
shell = "zsh -c '{}'"
|
||||||
|
|
||||||
|
#[[item]]
|
||||||
|
#file = "~/.config/sway/border.svg"
|
||||||
|
#template = "svg-circle"
|
||||||
|
#rewrite = true
|
||||||
|
#hook = "~/.config/sway/rendersvg.sh border"
|
||||||
|
|
||||||
|
#[[item]]
|
||||||
|
#file = "~/.config/sway/border-selected.svg"
|
||||||
|
#template = "svg-circle"
|
||||||
|
#subtemplate = "selected"
|
||||||
|
#rewrite = true
|
||||||
|
#hook = "~/.config/sway/rendersvg.sh border-selected"
|
||||||
|
|
||||||
|
[[item]]
|
||||||
|
file = "~/.config/nvim/colors/base16.vim"
|
||||||
|
template = "vim"
|
||||||
|
rewrite = true
|
||||||
|
hook = "reloadnvim"
|
||||||
|
|
||||||
|
[[item]]
|
||||||
|
file= "~/.config/zathura/zathurarc"
|
||||||
|
template = "zathura"
|
||||||
|
|
||||||
|
[[item]]
|
||||||
|
file = "~/.config/rofi/themes/colors.rasi"
|
||||||
|
template = "rofi"
|
||||||
|
subtemplate = "colors"
|
||||||
|
rewrite = true
|
||||||
|
|
||||||
|
[[item]]
|
||||||
|
file = "~/.config/kitty/colors.conf"
|
||||||
|
template = "kitty"
|
||||||
|
subtemplate = "default-256"
|
||||||
|
|
||||||
|
[[item]]
|
||||||
|
file = "~/.config/polybar/colors.ini"
|
||||||
|
template = "polybar"
|
||||||
|
rewrite = true
|
||||||
|
hook="killall -q polybar && ~/.config/polybar/launch.sh"
|
||||||
|
|
||||||
|
[[item]]
|
||||||
|
file = "~/.config/twmn/twmn.conf"
|
||||||
|
template = "twmn"
|
||||||
|
rewrite = true
|
||||||
|
|
||||||
|
[[item]]
|
||||||
|
file = "~/.config/i3/config"
|
||||||
|
template = "i3"
|
||||||
|
light = false
|
||||||
|
hook = "i3-msg reload"
|
||||||
|
|
||||||
|
[[item]]
|
||||||
|
file = "~/.themes/FlatColor/colors3"
|
||||||
|
template = "gtk-flatcolor"
|
||||||
|
subtemplate = "gtk-3"
|
||||||
|
rewrite = true
|
||||||
|
hook = "xsettings"
|
||||||
|
|
||||||
|
[[item]]
|
||||||
|
file = "~/.themes/FlatColor/colors2"
|
||||||
|
template = "gtk-flatcolor"
|
||||||
|
subtemplate = "gtk-2"
|
||||||
|
rewrite = true
|
||||||
|
|
||||||
|
[[item]]
|
||||||
|
file = "~/.config/alacritty/alacritty.yml"
|
||||||
|
template = "alacritty"
|
||||||
|
subtemplate = "default-256"
|
||||||
|
|
||||||
|
[[item]]
|
||||||
|
file = "~/.config/lightdm-mini-greeter/mini-greeter.conf"
|
||||||
|
template = "mini-greeter"
|
||||||
|
rewrite = false
|
||||||
|
|
||||||
|
[[item]]
|
||||||
|
file = "~/.fzf/fzf-base16.conf"
|
||||||
|
template = "fzf"
|
||||||
|
rewrite = true
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -94,7 +94,9 @@ from __future__ import (absolute_import, division, print_function)
|
||||||
from collections import deque
|
from collections import deque
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
from io import open
|
||||||
|
|
||||||
|
from ranger import PY3
|
||||||
from ranger.api.commands import Command
|
from ranger.api.commands import Command
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -243,8 +245,9 @@ class cd(Command):
|
||||||
|
|
||||||
paths = self._tab_fuzzy_match(basepath, tokens)
|
paths = self._tab_fuzzy_match(basepath, tokens)
|
||||||
if not os.path.isabs(dest):
|
if not os.path.isabs(dest):
|
||||||
paths_rel = basepath
|
paths_rel = self.fm.thisdir.path
|
||||||
paths = [os.path.relpath(path, paths_rel) for path in paths]
|
paths = [os.path.relpath(os.path.join(basepath, path), paths_rel)
|
||||||
|
for path in paths]
|
||||||
else:
|
else:
|
||||||
paths_rel = ''
|
paths_rel = ''
|
||||||
return paths, paths_rel
|
return paths, paths_rel
|
||||||
|
|
@ -274,7 +277,7 @@ class cd(Command):
|
||||||
return None
|
return None
|
||||||
if len(paths) == 1:
|
if len(paths) == 1:
|
||||||
return start + paths[0] + sep
|
return start + paths[0] + sep
|
||||||
return [start + dirname for dirname in paths]
|
return [start + dirname + sep for dirname in paths]
|
||||||
|
|
||||||
|
|
||||||
class chain(Command):
|
class chain(Command):
|
||||||
|
|
@ -282,6 +285,7 @@ class chain(Command):
|
||||||
|
|
||||||
Calls multiple commands at once, separated by semicolons.
|
Calls multiple commands at once, separated by semicolons.
|
||||||
"""
|
"""
|
||||||
|
resolve_macros = False
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
if not self.rest(1).strip():
|
if not self.rest(1).strip():
|
||||||
|
|
@ -335,7 +339,7 @@ class open_with(Command):
|
||||||
def execute(self):
|
def execute(self):
|
||||||
app, flags, mode = self._get_app_flags_mode(self.rest(1))
|
app, flags, mode = self._get_app_flags_mode(self.rest(1))
|
||||||
self.fm.execute_file(
|
self.fm.execute_file(
|
||||||
files=[f for f in self.fm.thistab.get_selection()],
|
files=self.fm.thistab.get_selection(),
|
||||||
app=app,
|
app=app,
|
||||||
flags=flags,
|
flags=flags,
|
||||||
mode=mode)
|
mode=mode)
|
||||||
|
|
@ -478,36 +482,106 @@ class set_(Command):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class setlocal(set_):
|
class setlocal_(set_):
|
||||||
""":setlocal path=<regular expression> <option name>=<python expression>
|
"""Shared class for setinpath and setinregex
|
||||||
|
|
||||||
Gives an option a new value.
|
By implementing the _arg abstract propery you can affect what the name of
|
||||||
|
the pattern/path/regex argument can be, this should be a regular expression
|
||||||
|
without match groups.
|
||||||
|
|
||||||
|
By implementing the _format_arg abstract method you can affect how the
|
||||||
|
argument is formatted as a regular expression.
|
||||||
"""
|
"""
|
||||||
PATH_RE_DQUOTED = re.compile(r'^setlocal\s+path="(.*?)"')
|
from abc import (ABCMeta, abstractmethod, abstractproperty)
|
||||||
PATH_RE_SQUOTED = re.compile(r"^setlocal\s+path='(.*?)'")
|
|
||||||
PATH_RE_UNQUOTED = re.compile(r'^path=(.*?)$')
|
__metaclass__ = ABCMeta
|
||||||
|
|
||||||
|
@property
|
||||||
|
@abstractmethod
|
||||||
|
def _arg(self):
|
||||||
|
"""The name of the option for the path/regex"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(setlocal_, self).__init__(*args, **kwargs)
|
||||||
|
# We require quoting of paths with whitespace so we have to take care
|
||||||
|
# not to match escaped quotes.
|
||||||
|
self.path_re_dquoted = re.compile(
|
||||||
|
r'^set.+?\s+{arg}="(.*?[^\\])"'.format(arg=self._arg)
|
||||||
|
)
|
||||||
|
self.path_re_squoted = re.compile(
|
||||||
|
r"^set.+?\s+{arg}='(.*?[^\\])'".format(arg=self._arg)
|
||||||
|
)
|
||||||
|
self.path_re_unquoted = re.compile(
|
||||||
|
r'^{arg}=(.+?)$'.format(arg=self._arg)
|
||||||
|
)
|
||||||
|
|
||||||
def _re_shift(self, match):
|
def _re_shift(self, match):
|
||||||
if not match:
|
if not match:
|
||||||
return None
|
return None
|
||||||
path = os.path.expanduser(match.group(1))
|
path = match.group(1)
|
||||||
for _ in range(len(path.split())):
|
# Prepend something that behaves like "path=" in case path starts with
|
||||||
|
# whitespace
|
||||||
|
for _ in "={0}".format(path).split():
|
||||||
self.shift()
|
self.shift()
|
||||||
return path
|
return os.path.expanduser(path)
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def _format_arg(self, arg):
|
||||||
|
"""How to format the argument as a regular expression"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
path = self._re_shift(self.PATH_RE_DQUOTED.match(self.line))
|
arg = self._re_shift(self.path_re_dquoted.match(self.line))
|
||||||
if path is None:
|
if arg is None:
|
||||||
path = self._re_shift(self.PATH_RE_SQUOTED.match(self.line))
|
arg = self._re_shift(self.path_re_squoted.match(self.line))
|
||||||
if path is None:
|
if arg is None:
|
||||||
path = self._re_shift(self.PATH_RE_UNQUOTED.match(self.arg(1)))
|
arg = self._re_shift(self.path_re_unquoted.match(self.arg(1)))
|
||||||
if path is None and self.fm.thisdir:
|
if arg is None and self.fm.thisdir:
|
||||||
path = self.fm.thisdir.path
|
arg = self.fm.thisdir.path
|
||||||
if not path:
|
if arg is None:
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
arg = self._format_arg(arg)
|
||||||
|
|
||||||
name, value, _ = self.parse_setting_line()
|
name, value, _ = self.parse_setting_line()
|
||||||
self.fm.set_option_from_string(name, value, localpath=path)
|
self.fm.set_option_from_string(name, value, localpath=arg)
|
||||||
|
|
||||||
|
|
||||||
|
class setinpath(setlocal_):
|
||||||
|
""":setinpath path=<path> <option name>=<python expression>
|
||||||
|
|
||||||
|
Sets an option when in a directory that matches <path>, relative paths can
|
||||||
|
match multiple directories, for example, ``path=build`` would match a build
|
||||||
|
directory in any directory. If the <path> contains whitespace it needs to
|
||||||
|
be quoted and nested quotes need to be backslash-escaped. The "path"
|
||||||
|
argument can also be named "pattern" to allow for easier switching with
|
||||||
|
``setinregex``.
|
||||||
|
"""
|
||||||
|
_arg = "(?:path|pattern)"
|
||||||
|
|
||||||
|
def _format_arg(self, arg):
|
||||||
|
return "{0}$".format(re.escape(arg))
|
||||||
|
|
||||||
|
|
||||||
|
class setlocal(setinpath):
|
||||||
|
""":setlocal is an alias for :setinpath"""
|
||||||
|
|
||||||
|
|
||||||
|
class setinregex(setlocal_):
|
||||||
|
""":setinregex re=<regex> <option name>=<python expression>
|
||||||
|
|
||||||
|
Sets an option when in a specific directory. If the <regex> contains
|
||||||
|
whitespace it needs to be quoted and nested quotes need to be
|
||||||
|
backslash-escaped. Special characters need to be escaped if they are
|
||||||
|
intended to match literally as documented in the ``re`` library
|
||||||
|
documentation. The "re" argument can also be named "regex" or "pattern,"
|
||||||
|
which allows for easier switching with ``setinpath``.
|
||||||
|
"""
|
||||||
|
_arg = "(?:re(?:gex)?|pattern)"
|
||||||
|
|
||||||
|
def _format_arg(self, arg):
|
||||||
|
return arg
|
||||||
|
|
||||||
|
|
||||||
class setintag(set_):
|
class setintag(set_):
|
||||||
|
|
@ -572,7 +646,7 @@ class default_linemode(Command):
|
||||||
class quit(Command): # pylint: disable=redefined-builtin
|
class quit(Command): # pylint: disable=redefined-builtin
|
||||||
""":quit
|
""":quit
|
||||||
|
|
||||||
Closes the current tab, if there's only one tab.
|
Closes the current tab, if there's more than one tab.
|
||||||
Otherwise quits if there are no tasks in progress.
|
Otherwise quits if there are no tasks in progress.
|
||||||
"""
|
"""
|
||||||
def _exit_no_work(self):
|
def _exit_no_work(self):
|
||||||
|
|
@ -591,7 +665,7 @@ class quit(Command): # pylint: disable=redefined-builtin
|
||||||
class quit_bang(Command):
|
class quit_bang(Command):
|
||||||
""":quit!
|
""":quit!
|
||||||
|
|
||||||
Closes the current tab, if there's only one tab.
|
Closes the current tab, if there's more than one tab.
|
||||||
Otherwise force quits immediately.
|
Otherwise force quits immediately.
|
||||||
"""
|
"""
|
||||||
name = 'quit!'
|
name = 'quit!'
|
||||||
|
|
@ -695,10 +769,86 @@ class delete(Command):
|
||||||
return self._tab_directory_content()
|
return self._tab_directory_content()
|
||||||
|
|
||||||
def _question_callback(self, files, answer):
|
def _question_callback(self, files, answer):
|
||||||
if answer == 'y' or answer == 'Y':
|
if answer.lower() == 'y':
|
||||||
self.fm.delete(files)
|
self.fm.delete(files)
|
||||||
|
|
||||||
|
|
||||||
|
class trash(Command):
|
||||||
|
""":trash
|
||||||
|
|
||||||
|
Tries to move the selection or the files passed in arguments (if any) to
|
||||||
|
the trash, using rifle rules with label "trash".
|
||||||
|
The arguments use a shell-like escaping.
|
||||||
|
|
||||||
|
"Selection" is defined as all the "marked files" (by default, you
|
||||||
|
can mark files with space or v). If there are no marked files,
|
||||||
|
use the "current file" (where the cursor is)
|
||||||
|
|
||||||
|
When attempting to trash non-empty directories or multiple
|
||||||
|
marked files, it will require a confirmation.
|
||||||
|
"""
|
||||||
|
|
||||||
|
allow_abbrev = False
|
||||||
|
escape_macros_for_shell = True
|
||||||
|
|
||||||
|
def execute(self):
|
||||||
|
import shlex
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
|
def is_directory_with_files(path):
|
||||||
|
return os.path.isdir(path) and not os.path.islink(path) and len(os.listdir(path)) > 0
|
||||||
|
|
||||||
|
if self.rest(1):
|
||||||
|
file_names = shlex.split(self.rest(1))
|
||||||
|
files = self.fm.get_filesystem_objects(file_names)
|
||||||
|
if files is None:
|
||||||
|
return
|
||||||
|
many_files = (len(files) > 1 or is_directory_with_files(files[0].path))
|
||||||
|
else:
|
||||||
|
cwd = self.fm.thisdir
|
||||||
|
tfile = self.fm.thisfile
|
||||||
|
if not cwd or not tfile:
|
||||||
|
self.fm.notify("Error: no file selected for deletion!", bad=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
files = self.fm.thistab.get_selection()
|
||||||
|
# relative_path used for a user-friendly output in the confirmation.
|
||||||
|
file_names = [f.relative_path for f in files]
|
||||||
|
many_files = (cwd.marked_items or is_directory_with_files(tfile.path))
|
||||||
|
|
||||||
|
confirm = self.fm.settings.confirm_on_delete
|
||||||
|
if confirm != 'never' and (confirm != 'multiple' or many_files):
|
||||||
|
self.fm.ui.console.ask(
|
||||||
|
"Confirm deletion of: %s (y/N)" % ', '.join(file_names),
|
||||||
|
partial(self._question_callback, files),
|
||||||
|
('n', 'N', 'y', 'Y'),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# no need for a confirmation, just delete
|
||||||
|
self._trash_files_catch_arg_list_error(files)
|
||||||
|
|
||||||
|
def tab(self, tabnum):
|
||||||
|
return self._tab_directory_content()
|
||||||
|
|
||||||
|
def _question_callback(self, files, answer):
|
||||||
|
if answer.lower() == 'y':
|
||||||
|
self._trash_files_catch_arg_list_error(files)
|
||||||
|
|
||||||
|
def _trash_files_catch_arg_list_error(self, files):
|
||||||
|
"""
|
||||||
|
Executes the fm.execute_file method but catches the OSError ("Argument list too long")
|
||||||
|
that occurs when moving too many files to trash (and would otherwise crash ranger).
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
self.fm.execute_file(files, label='trash')
|
||||||
|
except OSError as err:
|
||||||
|
if err.errno == 7:
|
||||||
|
self.fm.notify("Error: Command too long (try passing less files at once)",
|
||||||
|
bad=True)
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
class jump_non(Command):
|
class jump_non(Command):
|
||||||
""":jump_non [-FLAGS...]
|
""":jump_non [-FLAGS...]
|
||||||
|
|
||||||
|
|
@ -767,21 +917,31 @@ class mark_tag(Command):
|
||||||
|
|
||||||
|
|
||||||
class console(Command):
|
class console(Command):
|
||||||
""":console <command>
|
""":console [-p N | -s sep] <command>
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
-p N Set position at N index
|
||||||
|
-s sep Set position at separator(any char[s] sequence), example '#'
|
||||||
Open the console with the given command.
|
Open the console with the given command.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
position = None
|
position = None
|
||||||
|
command = self.rest(1)
|
||||||
if self.arg(1)[0:2] == '-p':
|
if self.arg(1)[0:2] == '-p':
|
||||||
|
command = self.rest(2)
|
||||||
try:
|
try:
|
||||||
position = int(self.arg(1)[2:])
|
position = int(self.arg(1)[2:])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
else:
|
elif self.arg(1)[0:2] == '-s':
|
||||||
self.shift()
|
command = self.rest(3)
|
||||||
self.fm.open_console(self.rest(1), position=position)
|
sentinel = self.arg(2)
|
||||||
|
pos = command.find(sentinel)
|
||||||
|
if pos != -1:
|
||||||
|
command = command.replace(sentinel, '', 1)
|
||||||
|
position = pos
|
||||||
|
self.fm.open_console(command, position=position)
|
||||||
|
|
||||||
|
|
||||||
class load_copy_buffer(Command):
|
class load_copy_buffer(Command):
|
||||||
|
|
@ -792,20 +952,19 @@ class load_copy_buffer(Command):
|
||||||
copy_buffer_filename = 'copy_buffer'
|
copy_buffer_filename = 'copy_buffer'
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
import sys
|
|
||||||
from ranger.container.file import File
|
|
||||||
from os.path import exists
|
from os.path import exists
|
||||||
|
from ranger.container.file import File
|
||||||
fname = self.fm.datapath(self.copy_buffer_filename)
|
fname = self.fm.datapath(self.copy_buffer_filename)
|
||||||
unreadable = IOError if sys.version_info[0] < 3 else OSError
|
unreadable = OSError if PY3 else IOError
|
||||||
try:
|
try:
|
||||||
fobj = open(fname, 'r')
|
with open(fname, "r", encoding="utf-8") as fobj:
|
||||||
|
self.fm.copy_buffer = set(
|
||||||
|
File(g) for g in fobj.read().split("\n") if exists(g)
|
||||||
|
)
|
||||||
except unreadable:
|
except unreadable:
|
||||||
return self.fm.notify(
|
return self.fm.notify(
|
||||||
"Cannot open %s" % (fname or self.copy_buffer_filename), bad=True)
|
"Cannot open %s" % (fname or self.copy_buffer_filename), bad=True)
|
||||||
|
|
||||||
self.fm.copy_buffer = set(File(g)
|
|
||||||
for g in fobj.read().split("\n") if exists(g))
|
|
||||||
fobj.close()
|
|
||||||
self.fm.ui.redraw_main_column()
|
self.fm.ui.redraw_main_column()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
@ -818,17 +977,15 @@ class save_copy_buffer(Command):
|
||||||
copy_buffer_filename = 'copy_buffer'
|
copy_buffer_filename = 'copy_buffer'
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
import sys
|
|
||||||
fname = None
|
fname = None
|
||||||
fname = self.fm.datapath(self.copy_buffer_filename)
|
fname = self.fm.datapath(self.copy_buffer_filename)
|
||||||
unwritable = IOError if sys.version_info[0] < 3 else OSError
|
unwritable = OSError if PY3 else IOError
|
||||||
try:
|
try:
|
||||||
fobj = open(fname, 'w')
|
with open(fname, "w", encoding="utf-8") as fobj:
|
||||||
|
fobj.write("\n".join(fobj.path for fobj in self.fm.copy_buffer))
|
||||||
except unwritable:
|
except unwritable:
|
||||||
return self.fm.notify("Cannot open %s" %
|
return self.fm.notify("Cannot open %s" %
|
||||||
(fname or self.copy_buffer_filename), bad=True)
|
(fname or self.copy_buffer_filename), bad=True)
|
||||||
fobj.write("\n".join(fobj.path for fobj in self.fm.copy_buffer))
|
|
||||||
fobj.close()
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -868,11 +1025,16 @@ class touch(Command):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
from os.path import join, expanduser, lexists
|
from os.path import join, expanduser, lexists, dirname
|
||||||
|
from os import makedirs
|
||||||
|
|
||||||
fname = join(self.fm.thisdir.path, expanduser(self.rest(1)))
|
fname = join(self.fm.thisdir.path, expanduser(self.rest(1)))
|
||||||
|
dirname = dirname(fname)
|
||||||
if not lexists(fname):
|
if not lexists(fname):
|
||||||
open(fname, 'a').close()
|
if not lexists(dirname):
|
||||||
|
makedirs(dirname)
|
||||||
|
with open(fname, 'a', encoding="utf-8"):
|
||||||
|
pass # Just create the file
|
||||||
else:
|
else:
|
||||||
self.fm.notify("file/directory exists!", bad=True)
|
self.fm.notify("file/directory exists!", bad=True)
|
||||||
|
|
||||||
|
|
@ -1064,45 +1226,49 @@ class bulkrename(Command):
|
||||||
After you close it, it will be executed.
|
After you close it, it will be executed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(bulkrename, self).__init__(*args, **kwargs)
|
||||||
|
self.flags, _ = self.parse_flags()
|
||||||
|
if not self.flags:
|
||||||
|
self.flags = "w"
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
# pylint: disable=too-many-locals,too-many-statements,too-many-branches
|
# pylint: disable=too-many-locals,too-many-statements,too-many-branches
|
||||||
import sys
|
|
||||||
import tempfile
|
import tempfile
|
||||||
from ranger.container.file import File
|
from ranger.container.file import File
|
||||||
from ranger.ext.shell_escape import shell_escape as esc
|
from ranger.ext.shell_escape import shell_escape as esc
|
||||||
py3 = sys.version_info[0] >= 3
|
|
||||||
|
|
||||||
# Create and edit the file list
|
# Create and edit the file list
|
||||||
filenames = [f.relative_path for f in self.fm.thistab.get_selection()]
|
filenames = [f.relative_path for f in self.fm.thistab.get_selection()]
|
||||||
listfile = tempfile.NamedTemporaryFile(delete=False)
|
with tempfile.NamedTemporaryFile(delete=False) as listfile:
|
||||||
listpath = listfile.name
|
listpath = listfile.name
|
||||||
|
if PY3:
|
||||||
if py3:
|
listfile.write("\n".join(filenames).encode(
|
||||||
listfile.write("\n".join(filenames).encode("utf-8"))
|
encoding="utf-8", errors="surrogateescape"))
|
||||||
else:
|
else:
|
||||||
listfile.write("\n".join(filenames))
|
listfile.write("\n".join(filenames))
|
||||||
listfile.close()
|
|
||||||
self.fm.execute_file([File(listpath)], app='editor')
|
self.fm.execute_file([File(listpath)], app='editor')
|
||||||
listfile = open(listpath, 'r')
|
with open(
|
||||||
|
listpath, "r", encoding="utf-8", errors="surrogateescape"
|
||||||
|
) as listfile:
|
||||||
new_filenames = listfile.read().split("\n")
|
new_filenames = listfile.read().split("\n")
|
||||||
listfile.close()
|
|
||||||
os.unlink(listpath)
|
os.unlink(listpath)
|
||||||
if all(a == b for a, b in zip(filenames, new_filenames)):
|
if all(a == b for a, b in zip(filenames, new_filenames)):
|
||||||
self.fm.notify("No renaming to be done!")
|
self.fm.notify("No renaming to be done!")
|
||||||
return
|
return
|
||||||
|
|
||||||
# Generate script
|
# Generate script
|
||||||
cmdfile = tempfile.NamedTemporaryFile()
|
with tempfile.NamedTemporaryFile() as cmdfile:
|
||||||
script_lines = []
|
script_lines = []
|
||||||
script_lines.append("# This file will be executed when you close the"
|
script_lines.append("# This file will be executed when you close"
|
||||||
" editor.")
|
" the editor.")
|
||||||
script_lines.append("# Please double-check everything, clear the file"
|
script_lines.append("# Please double-check everything, clear the"
|
||||||
" to abort.")
|
" file to abort.")
|
||||||
new_dirs = []
|
new_dirs = []
|
||||||
for old, new in zip(filenames, new_filenames):
|
for old, new in zip(filenames, new_filenames):
|
||||||
if old != new:
|
if old != new:
|
||||||
basepath, _ = os.path.split(new)
|
basepath, _ = os.path.split(new)
|
||||||
if (basepath is not None and basepath not in new_dirs
|
if (basepath and basepath not in new_dirs
|
||||||
and not os.path.isdir(basepath)):
|
and not os.path.isdir(basepath)):
|
||||||
script_lines.append("mkdir -vp -- {dir}".format(
|
script_lines.append("mkdir -vp -- {dir}".format(
|
||||||
dir=esc(basepath)))
|
dir=esc(basepath)))
|
||||||
|
|
@ -1111,21 +1277,21 @@ class bulkrename(Command):
|
||||||
old=esc(old), new=esc(new)))
|
old=esc(old), new=esc(new)))
|
||||||
# Make sure not to forget the ending newline
|
# Make sure not to forget the ending newline
|
||||||
script_content = "\n".join(script_lines) + "\n"
|
script_content = "\n".join(script_lines) + "\n"
|
||||||
if py3:
|
if PY3:
|
||||||
cmdfile.write(script_content.encode("utf-8"))
|
cmdfile.write(script_content.encode(encoding="utf-8",
|
||||||
|
errors="surrogateescape"))
|
||||||
else:
|
else:
|
||||||
cmdfile.write(script_content)
|
cmdfile.write(script_content)
|
||||||
cmdfile.flush()
|
cmdfile.flush()
|
||||||
|
|
||||||
# Open the script and let the user review it, then check if the script
|
# Open the script and let the user review it, then check if the
|
||||||
# was modified by the user
|
# script was modified by the user
|
||||||
self.fm.execute_file([File(cmdfile.name)], app='editor')
|
self.fm.execute_file([File(cmdfile.name)], app='editor')
|
||||||
cmdfile.seek(0)
|
cmdfile.seek(0)
|
||||||
script_was_edited = (script_content != cmdfile.read())
|
script_was_edited = (script_content != cmdfile.read())
|
||||||
|
|
||||||
# Do the renaming
|
# Do the renaming
|
||||||
self.fm.run(['/bin/sh', cmdfile.name], flags='w')
|
self.fm.run(['/bin/sh', cmdfile.name], flags=self.flags)
|
||||||
cmdfile.close()
|
|
||||||
|
|
||||||
# Retag the files, but only if the script wasn't changed during review,
|
# Retag the files, but only if the script wasn't changed during review,
|
||||||
# because only then we know which are the source and destination files.
|
# because only then we know which are the source and destination files.
|
||||||
|
|
@ -1244,7 +1410,7 @@ class copycmap(copymap):
|
||||||
|
|
||||||
|
|
||||||
class copytmap(copymap):
|
class copytmap(copymap):
|
||||||
""":copycmap <keys> <newkeys1> [<newkeys2>...]
|
""":copytmap <keys> <newkeys1> [<newkeys2>...]
|
||||||
|
|
||||||
Copies a "taskview" keybinding from <keys> to <newkeys>
|
Copies a "taskview" keybinding from <keys> to <newkeys>
|
||||||
"""
|
"""
|
||||||
|
|
@ -1263,30 +1429,69 @@ class unmap(Command):
|
||||||
self.fm.ui.keymaps.unbind(self.context, arg)
|
self.fm.ui.keymaps.unbind(self.context, arg)
|
||||||
|
|
||||||
|
|
||||||
class cunmap(unmap):
|
class uncmap(unmap):
|
||||||
""":cunmap <keys> [<keys2>, ...]
|
""":uncmap <keys> [<keys2>, ...]
|
||||||
|
|
||||||
Remove the given "console" mappings
|
Remove the given "console" mappings
|
||||||
"""
|
"""
|
||||||
context = 'browser'
|
context = 'console'
|
||||||
|
|
||||||
|
|
||||||
class punmap(unmap):
|
class cunmap(uncmap):
|
||||||
""":punmap <keys> [<keys2>, ...]
|
""":cunmap <keys> [<keys2>, ...]
|
||||||
|
|
||||||
|
Remove the given "console" mappings
|
||||||
|
|
||||||
|
DEPRECATED in favor of uncmap.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def execute(self):
|
||||||
|
self.fm.notify("cunmap is deprecated in favor of uncmap!")
|
||||||
|
super(cunmap, self).execute()
|
||||||
|
|
||||||
|
|
||||||
|
class unpmap(unmap):
|
||||||
|
""":unpmap <keys> [<keys2>, ...]
|
||||||
|
|
||||||
Remove the given "pager" mappings
|
Remove the given "pager" mappings
|
||||||
"""
|
"""
|
||||||
context = 'pager'
|
context = 'pager'
|
||||||
|
|
||||||
|
|
||||||
class tunmap(unmap):
|
class punmap(unpmap):
|
||||||
""":tunmap <keys> [<keys2>, ...]
|
""":punmap <keys> [<keys2>, ...]
|
||||||
|
|
||||||
|
Remove the given "pager" mappings
|
||||||
|
|
||||||
|
DEPRECATED in favor of unpmap.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def execute(self):
|
||||||
|
self.fm.notify("punmap is deprecated in favor of unpmap!")
|
||||||
|
super(punmap, self).execute()
|
||||||
|
|
||||||
|
|
||||||
|
class untmap(unmap):
|
||||||
|
""":untmap <keys> [<keys2>, ...]
|
||||||
|
|
||||||
Remove the given "taskview" mappings
|
Remove the given "taskview" mappings
|
||||||
"""
|
"""
|
||||||
context = 'taskview'
|
context = 'taskview'
|
||||||
|
|
||||||
|
|
||||||
|
class tunmap(untmap):
|
||||||
|
""":tunmap <keys> [<keys2>, ...]
|
||||||
|
|
||||||
|
Remove the given "taskview" mappings
|
||||||
|
|
||||||
|
DEPRECATED in favor of untmap.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def execute(self):
|
||||||
|
self.fm.notify("tunmap is deprecated in favor of untmap!")
|
||||||
|
super(tunmap, self).execute()
|
||||||
|
|
||||||
|
|
||||||
class map_(Command):
|
class map_(Command):
|
||||||
""":map <keysequence> <command>
|
""":map <keysequence> <command>
|
||||||
|
|
||||||
|
|
@ -1360,22 +1565,21 @@ class scout(Command):
|
||||||
Multiple flags can be combined. For example, ":scout -gpt" would create
|
Multiple flags can be combined. For example, ":scout -gpt" would create
|
||||||
a :filter-like command using globbing.
|
a :filter-like command using globbing.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=bad-whitespace
|
|
||||||
AUTO_OPEN = 'a'
|
AUTO_OPEN = "a"
|
||||||
OPEN_ON_ENTER = 'e'
|
OPEN_ON_ENTER = "e"
|
||||||
FILTER = 'f'
|
FILTER = "f"
|
||||||
SM_GLOB = 'g'
|
SM_GLOB = "g"
|
||||||
IGNORE_CASE = 'i'
|
IGNORE_CASE = "i"
|
||||||
KEEP_OPEN = 'k'
|
KEEP_OPEN = "k"
|
||||||
SM_LETTERSKIP = 'l'
|
SM_LETTERSKIP = "l"
|
||||||
MARK = 'm'
|
MARK = "m"
|
||||||
UNMARK = 'M'
|
UNMARK = "M"
|
||||||
PERM_FILTER = 'p'
|
PERM_FILTER = "p"
|
||||||
SM_REGEX = 'r'
|
SM_REGEX = "r"
|
||||||
SMART_CASE = 's'
|
SMART_CASE = "s"
|
||||||
AS_YOU_TYPE = 't'
|
AS_YOU_TYPE = "t"
|
||||||
INVERT = 'v'
|
INVERT = "v"
|
||||||
# pylint: enable=bad-whitespace
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(scout, self).__init__(*args, **kwargs)
|
super(scout, self).__init__(*args, **kwargs)
|
||||||
|
|
@ -1593,7 +1797,7 @@ class filter_stack(Command):
|
||||||
elif subcommand == "clear":
|
elif subcommand == "clear":
|
||||||
self.fm.thisdir.filter_stack = []
|
self.fm.thisdir.filter_stack = []
|
||||||
elif subcommand == "rotate":
|
elif subcommand == "rotate":
|
||||||
rotate_by = int(self.arg(2) or 1)
|
rotate_by = int(self.arg(2) or self.quantifier or 1)
|
||||||
self.fm.thisdir.filter_stack = (
|
self.fm.thisdir.filter_stack = (
|
||||||
self.fm.thisdir.filter_stack[-rotate_by:]
|
self.fm.thisdir.filter_stack[-rotate_by:]
|
||||||
+ self.fm.thisdir.filter_stack[:-rotate_by]
|
+ self.fm.thisdir.filter_stack[:-rotate_by]
|
||||||
|
|
@ -1606,7 +1810,7 @@ class filter_stack(Command):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self.fm.notify(
|
self.fm.notify(
|
||||||
"Unknown subcommand: {}".format(subcommand),
|
"Unknown subcommand: {sub}".format(sub=subcommand),
|
||||||
bad=True
|
bad=True
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
@ -1622,7 +1826,7 @@ class grep(Command):
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
if self.rest(1):
|
if self.rest(1):
|
||||||
action = ['grep', '--line-number']
|
action = ['grep', '-n']
|
||||||
action.extend(['-e', self.rest(1), '-r'])
|
action.extend(['-e', self.rest(1), '-r'])
|
||||||
action.extend(f.path for f in self.fm.thistab.get_selection())
|
action.extend(f.path for f in self.fm.thistab.get_selection())
|
||||||
self.fm.execute_command(action, flags='p')
|
self.fm.execute_command(action, flags='p')
|
||||||
|
|
@ -1754,7 +1958,7 @@ class meta(prompt_metadata):
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
key = self.arg(1)
|
key = self.arg(1)
|
||||||
update_dict = dict()
|
update_dict = {}
|
||||||
update_dict[key] = self.rest(2)
|
update_dict[key] = self.rest(2)
|
||||||
selection = self.fm.thistab.get_selection()
|
selection = self.fm.thistab.get_selection()
|
||||||
for fobj in selection:
|
for fobj in selection:
|
||||||
|
|
@ -1797,79 +2001,9 @@ class linemode(default_linemode):
|
||||||
for col in self.fm.ui.browser.columns:
|
for col in self.fm.ui.browser.columns:
|
||||||
col.need_redraw = True
|
col.need_redraw = True
|
||||||
|
|
||||||
class fzf_select(Command):
|
|
||||||
"""
|
|
||||||
:fzf_select
|
|
||||||
|
|
||||||
Find a file using fzf.
|
|
||||||
|
|
||||||
With a prefix argument select only directories.
|
|
||||||
|
|
||||||
See: https://github.com/junegunn/fzf
|
|
||||||
"""
|
|
||||||
def execute(self):
|
|
||||||
import subprocess
|
|
||||||
import os.path
|
|
||||||
if self.quantifier:
|
|
||||||
# match only directories
|
|
||||||
command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
|
|
||||||
-o -type d -print 2> /dev/null | sed 1d | cut -b3- | fzf +m"
|
|
||||||
else:
|
|
||||||
# match files and directories
|
|
||||||
command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
|
|
||||||
-o -print 2> /dev/null | sed 1d | cut -b3- | fzf +m"
|
|
||||||
fzf = self.fm.execute_command(command, universal_newlines=True, stdout=subprocess.PIPE)
|
|
||||||
stdout, stderr = fzf.communicate()
|
|
||||||
if fzf.returncode == 0:
|
|
||||||
fzf_file = os.path.abspath(stdout.rstrip('\n'))
|
|
||||||
if os.path.isdir(fzf_file):
|
|
||||||
self.fm.cd(fzf_file)
|
|
||||||
else:
|
|
||||||
self.fm.select_file(fzf_file)
|
|
||||||
|
|
||||||
# fzf_fasd - Fasd + Fzf + Ranger (Interactive Style)
|
|
||||||
class fzf_fasd(Command):
|
|
||||||
"""
|
|
||||||
:fzf_fasd
|
|
||||||
|
|
||||||
Jump to a file or folder using Fasd and fzf
|
|
||||||
|
|
||||||
URL: https://github.com/clvv/fasd
|
|
||||||
URL: https://github.com/junegunn/fzf
|
|
||||||
"""
|
|
||||||
def execute(self):
|
|
||||||
import subprocess
|
|
||||||
if self.quantifier:
|
|
||||||
command="fasd | fzf -e -i --tac --no-sort | awk '{print $2}'"
|
|
||||||
else:
|
|
||||||
command="fasd | fzf -e -i --tac --no-sort | awk '{print $2}'"
|
|
||||||
fzf = self.fm.execute_command(command, stdout=subprocess.PIPE)
|
|
||||||
stdout, stderr = fzf.communicate()
|
|
||||||
if fzf.returncode == 0:
|
|
||||||
fzf_file = os.path.abspath(stdout.decode('utf-8').rstrip('\n'))
|
|
||||||
if os.path.isdir(fzf_file):
|
|
||||||
self.fm.cd(fzf_file)
|
|
||||||
else:
|
|
||||||
self.fm.select_file(fzf_file)
|
|
||||||
|
|
||||||
# Fasd with ranger (Command Line Style)
|
|
||||||
# https://github.com/ranger/ranger/wiki/Commands
|
|
||||||
class fasd(Command):
|
|
||||||
"""
|
|
||||||
:fasd
|
|
||||||
|
|
||||||
Jump to directory using fasd
|
|
||||||
URL: https://github.com/clvv/fasd
|
|
||||||
"""
|
|
||||||
def execute(self):
|
|
||||||
import subprocess
|
|
||||||
arg = self.rest(1)
|
|
||||||
if arg:
|
|
||||||
directory = subprocess.check_output(["fasd", "-d"]+arg.split(), universal_newlines=True).strip()
|
|
||||||
self.fm.cd(directory)
|
|
||||||
|
|
||||||
class yank(Command):
|
class yank(Command):
|
||||||
""":yank [name|dir|path]
|
""":yank [name|dir|path|name_without_extension]
|
||||||
|
|
||||||
Copies the file's name (default), directory or path into both the primary X
|
Copies the file's name (default), directory or path into both the primary X
|
||||||
selection and the clipboard.
|
selection and the clipboard.
|
||||||
|
|
@ -1897,11 +2031,14 @@ class yank(Command):
|
||||||
['xsel'],
|
['xsel'],
|
||||||
['xsel', '-b'],
|
['xsel', '-b'],
|
||||||
],
|
],
|
||||||
|
'wl-copy': [
|
||||||
|
['wl-copy'],
|
||||||
|
],
|
||||||
'pbcopy': [
|
'pbcopy': [
|
||||||
['pbcopy'],
|
['pbcopy'],
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
ordered_managers = ['pbcopy', 'xclip', 'xsel']
|
ordered_managers = ['pbcopy', 'xclip', 'xsel', 'wl-copy']
|
||||||
executables = get_executables()
|
executables = get_executables()
|
||||||
for manager in ordered_managers:
|
for manager in ordered_managers:
|
||||||
if manager in executables:
|
if manager in executables:
|
||||||
|
|
@ -1915,8 +2052,9 @@ class yank(Command):
|
||||||
|
|
||||||
new_clipboard_contents = "\n".join(selection)
|
new_clipboard_contents = "\n".join(selection)
|
||||||
for command in clipboard_commands:
|
for command in clipboard_commands:
|
||||||
process = subprocess.Popen(command, universal_newlines=True,
|
with subprocess.Popen(
|
||||||
stdin=subprocess.PIPE)
|
command, universal_newlines=True, stdin=subprocess.PIPE
|
||||||
|
) as process:
|
||||||
process.communicate(input=new_clipboard_contents)
|
process.communicate(input=new_clipboard_contents)
|
||||||
|
|
||||||
def get_selection_attr(self, attr):
|
def get_selection_attr(self, attr):
|
||||||
|
|
@ -1930,36 +2068,33 @@ class yank(Command):
|
||||||
if mode
|
if mode
|
||||||
)
|
)
|
||||||
|
|
||||||
import os
|
|
||||||
from ranger.core.loader import CommandLoader
|
|
||||||
|
|
||||||
class extracthere(Command):
|
class paste_ext(Command):
|
||||||
|
"""
|
||||||
|
:paste_ext
|
||||||
|
|
||||||
|
Like paste but tries to rename conflicting files so that the
|
||||||
|
file extension stays intact (e.g. file_.ext).
|
||||||
|
"""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def make_safe_path(dst):
|
||||||
|
if not os.path.exists(dst):
|
||||||
|
return dst
|
||||||
|
|
||||||
|
dst_name, dst_ext = os.path.splitext(dst)
|
||||||
|
|
||||||
|
if not dst_name.endswith("_"):
|
||||||
|
dst_name += "_"
|
||||||
|
if not os.path.exists(dst_name + dst_ext):
|
||||||
|
return dst_name + dst_ext
|
||||||
|
n = 0
|
||||||
|
test_dst = dst_name + str(n)
|
||||||
|
while os.path.exists(test_dst + dst_ext):
|
||||||
|
n += 1
|
||||||
|
test_dst = dst_name + str(n)
|
||||||
|
|
||||||
|
return test_dst + dst_ext
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
""" Extract copied files to current directory """
|
return self.fm.paste(make_safe_path=paste_ext.make_safe_path)
|
||||||
copied_files = tuple(self.fm.copy_buffer)
|
|
||||||
|
|
||||||
if not copied_files:
|
|
||||||
return
|
|
||||||
|
|
||||||
def refresh(_):
|
|
||||||
cwd = self.fm.get_directory(original_path)
|
|
||||||
cwd.load_content()
|
|
||||||
|
|
||||||
one_file = copied_files[0]
|
|
||||||
cwd = self.fm.thisdir
|
|
||||||
original_path = cwd.path
|
|
||||||
au_flags = ['-X', cwd.path]
|
|
||||||
au_flags += self.line.split()[1:]
|
|
||||||
au_flags += ['-e']
|
|
||||||
|
|
||||||
self.fm.copy_buffer.clear()
|
|
||||||
self.fm.cut_buffer = False
|
|
||||||
if len(copied_files) == 1:
|
|
||||||
descr = "extracting: " + os.path.basename(one_file.path)
|
|
||||||
else:
|
|
||||||
descr = "extracting files from: " + os.path.basename(one_file.dirname)
|
|
||||||
obj = CommandLoader(args=['aunpack'] + au_flags \
|
|
||||||
+ [f.path for f in copied_files], descr=descr, read=True)
|
|
||||||
|
|
||||||
obj.signal_bind('after', refresh)
|
|
||||||
self.fm.loader.add(obj)
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
# This tmux statusbar config was created by tmuxline.vim
|
|
||||||
# on Tue, 06 Aug 2019
|
|
||||||
|
|
||||||
set -g status-justify "centre"
|
|
||||||
set -g status "on"
|
|
||||||
set -g status-left-style "none"
|
|
||||||
set -g message-command-style "fg=#3B4252,bg=#81A1C1"
|
|
||||||
set -g status-right-style "none"
|
|
||||||
set -g pane-active-border-style "fg=#88C0D0"
|
|
||||||
set -g status-style "none,bg=#4C566A"
|
|
||||||
set -g message-style "fg=#3B4252,bg=#81A1C1"
|
|
||||||
set -g pane-border-style "fg=#81A1C1"
|
|
||||||
set -g status-right-length "100"
|
|
||||||
set -g status-left-length "100"
|
|
||||||
setw -g window-status-activity-style "none,fg=#88C0D0,bg=#4C566A"
|
|
||||||
setw -g window-status-separator ""
|
|
||||||
setw -g window-status-style "none,fg=#E5E9F0,bg=#4C566A"
|
|
||||||
set -g status-left "#[fg=#3B4252,bg=#88C0D0] #S #[fg=#88C0D0,bg=#81A1C1,nobold,nounderscore,noitalics]#[fg=#3B4252,bg=#81A1C1] #W #[fg=#81A1C1,bg=#4C566A,nobold,nounderscore,noitalics]#[fg=#E5E9F0,bg=#4C566A] #(~/.config/Scripts/showip) #[fg=#4C566A,bg=#4C566A,nobold,nounderscore,noitalics]"
|
|
||||||
set -g status-right "#[fg=#81A1C1,bg=#4C566A,nobold,nounderscore,noitalics]#[fg=#3B4252,bg=#81A1C1] %R %a %Y #[fg=#88C0D0,bg=#81A1C1,nobold,nounderscore,noitalics]#[fg=#3B4252,bg=#88C0D0] #H "
|
|
||||||
setw -g window-status-format "#[fg=#4C566A,bg=#4C566A,nobold,nounderscore,noitalics]#[default] #I #W #[fg=#4C566A,bg=#4C566A,nobold,nounderscore,noitalics]"
|
|
||||||
setw -g window-status-current-format "#[fg=#4C566A,bg=#81A1C1,nobold,nounderscore,noitalics]#[fg=#3B4252,bg=#81A1C1] #I #W #F #[fg=#81A1C1,bg=#4C566A,nobold,nounderscore,noitalics]"
|
|
||||||
|
|
@ -1,158 +1,415 @@
|
||||||
# '########:::::'###::::'##::: ##::'######:::'########:'########::
|
# ===================================================================
|
||||||
# ##.... ##:::'## ##::: ###:: ##:'##... ##:: ##.....:: ##.... ##:
|
# This file contains the default startup commands for ranger.
|
||||||
# ##:::: ##::'##:. ##:: ####: ##: ##:::..::: ##::::::: ##:::: ##:
|
# To change them, it is recommended to create either /etc/ranger/rc.conf
|
||||||
# ########::'##:::. ##: ## ## ##: ##::'####: ######::: ########::
|
# (system-wide) or ~/.config/ranger/rc.conf (per user) and add your custom
|
||||||
# ##.. ##::: #########: ##. ####: ##::: ##:: ##...:::: ##.. ##:::
|
# commands there.
|
||||||
# ##::. ##:: ##.... ##: ##:. ###: ##::: ##:: ##::::::: ##::. ##::
|
|
||||||
# ##:::. ##: ##:::: ##: ##::. ##:. ######::: ########: ##:::. ##:
|
|
||||||
# ..:::::..::..:::::..::..::::..:::......::::........::..:::::..::
|
|
||||||
#
|
#
|
||||||
###SETTINGS###
|
# If you copy this whole file there, you may want to set the environment
|
||||||
|
# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice.
|
||||||
|
#
|
||||||
|
# The purpose of this file is mainly to define keybindings and settings.
|
||||||
|
# For running more complex python code, please create a plugin in "plugins/" or
|
||||||
|
# a command in "commands.py".
|
||||||
|
#
|
||||||
|
# Each line is a command that will be run before the user interface
|
||||||
|
# is initialized. As a result, you can not use commands which rely
|
||||||
|
# on the UI such as :delete or :mark.
|
||||||
|
# ===================================================================
|
||||||
|
|
||||||
|
# ===================================================================
|
||||||
|
# == Options
|
||||||
|
# ===================================================================
|
||||||
|
|
||||||
|
# Which viewmode should be used? Possible values are:
|
||||||
|
# miller: Use miller columns which show multiple levels of the hierarchy
|
||||||
|
# multipane: Midnight-commander like multipane view showing all tabs next
|
||||||
|
# to each other
|
||||||
|
set viewmode miller
|
||||||
|
|
||||||
|
# How many columns are there, and what are their relative widths?
|
||||||
set column_ratios 1,3,4
|
set column_ratios 1,3,4
|
||||||
#set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
|
|
||||||
set hidden_filter ^\.|\.(?:pyc|vrb|pyo|bak|swp|aux|log|nav|out|snm|toc|bcf|run\.xml|synctex\.gz|blg|bbl)$|^lost\+found$|^__(py)?cache__$
|
# Which files should be hidden? (regular expression)
|
||||||
|
set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
|
||||||
|
|
||||||
|
# Show hidden files? You can toggle this by typing 'zh'
|
||||||
set show_hidden true
|
set show_hidden true
|
||||||
|
|
||||||
|
# Ask for a confirmation when running the "delete" command?
|
||||||
|
# Valid values are "always", "never", "multiple" (default)
|
||||||
|
# With "multiple", ranger will ask only if you delete multiple files at once.
|
||||||
set confirm_on_delete multiple
|
set confirm_on_delete multiple
|
||||||
set preview_script ~/.config/ranger/scope.sh
|
|
||||||
|
# Use non-default path for file preview script?
|
||||||
|
# ranger ships with scope.sh, a script that calls external programs (see
|
||||||
|
# README.md for dependencies) to preview images, archives, etc.
|
||||||
|
#set preview_script ~/.config/ranger/scope.sh
|
||||||
|
|
||||||
|
# Use the external preview script or display simple plain text or image previews?
|
||||||
set use_preview_script true
|
set use_preview_script true
|
||||||
|
|
||||||
|
# Automatically count files in the directory, even before entering them?
|
||||||
set automatically_count_files true
|
set automatically_count_files true
|
||||||
|
|
||||||
|
# Open all images in this directory when running certain image viewers
|
||||||
|
# like feh or sxiv? You can still open selected files by marking them.
|
||||||
set open_all_images true
|
set open_all_images true
|
||||||
|
|
||||||
|
# Be aware of version control systems and display information.
|
||||||
set vcs_aware true
|
set vcs_aware true
|
||||||
|
|
||||||
|
# State of the four backends git, hg, bzr, svn. The possible states are
|
||||||
|
# disabled, local (only show local info), enabled (show local and remote
|
||||||
|
# information).
|
||||||
set vcs_backend_git enabled
|
set vcs_backend_git enabled
|
||||||
set vcs_backend_hg disabled
|
set vcs_backend_hg disabled
|
||||||
set vcs_backend_bzr disabled
|
set vcs_backend_bzr disabled
|
||||||
|
set vcs_backend_svn disabled
|
||||||
|
|
||||||
|
# Truncate the long commit messages to this length when shown in the statusbar.
|
||||||
|
set vcs_msg_length 50
|
||||||
|
|
||||||
|
# Use one of the supported image preview protocols
|
||||||
set preview_images true
|
set preview_images true
|
||||||
set preview_images_method kitty
|
|
||||||
|
# Set the preview image method. Supported methods:
|
||||||
|
#
|
||||||
|
# * w3m (default):
|
||||||
|
# Preview images in full color with the external command "w3mimgpreview"?
|
||||||
|
# This requires the console web browser "w3m" and a supported terminal.
|
||||||
|
# It has been successfully tested with "xterm" and "urxvt" without tmux.
|
||||||
|
#
|
||||||
|
# * iterm2:
|
||||||
|
# Preview images in full color using iTerm2 image previews
|
||||||
|
# (http://iterm2.com/images.html). This requires using iTerm2 compiled
|
||||||
|
# with image preview support.
|
||||||
|
#
|
||||||
|
# This feature relies on the dimensions of the terminal's font. By default, a
|
||||||
|
# width of 8 and height of 11 are used. To use other values, set the options
|
||||||
|
# iterm2_font_width and iterm2_font_height to the desired values.
|
||||||
|
#
|
||||||
|
# * terminology:
|
||||||
|
# Previews images in full color in the terminology terminal emulator.
|
||||||
|
# Supports a wide variety of formats, even vector graphics like svg.
|
||||||
|
#
|
||||||
|
# * urxvt:
|
||||||
|
# Preview images in full color using urxvt image backgrounds. This
|
||||||
|
# requires using urxvt compiled with pixbuf support.
|
||||||
|
#
|
||||||
|
# * urxvt-full:
|
||||||
|
# The same as urxvt but utilizing not only the preview pane but the
|
||||||
|
# whole terminal window.
|
||||||
|
#
|
||||||
|
# * kitty:
|
||||||
|
# Preview images in full color using kitty image protocol.
|
||||||
|
# Requires python PIL or pillow library.
|
||||||
|
# If ranger does not share the local filesystem with kitty
|
||||||
|
# the transfer method is changed to encode the whole image;
|
||||||
|
# while slower, this allows remote previews,
|
||||||
|
# for example during an ssh session.
|
||||||
|
# Tmux is unsupported.
|
||||||
|
#
|
||||||
|
# * ueberzug:
|
||||||
|
# Preview images in full color with the external command "ueberzug".
|
||||||
|
# Images are shown by using a child window.
|
||||||
|
# Only for users who run X11 in GNU/Linux.
|
||||||
|
set preview_images_method ueberzug
|
||||||
|
|
||||||
|
# Delay in seconds before displaying an image with the w3m method.
|
||||||
|
# Increase it in case of experiencing display corruption.
|
||||||
|
set w3m_delay 0.02
|
||||||
|
|
||||||
|
# Manually adjust the w3mimg offset when using a terminal which needs this
|
||||||
|
set w3m_offset 0
|
||||||
|
|
||||||
|
# Default iTerm2 font size (see: preview_images_method: iterm2)
|
||||||
|
set iterm2_font_width 8
|
||||||
|
set iterm2_font_height 11
|
||||||
|
|
||||||
|
# Use a unicode "..." character to mark cut-off filenames?
|
||||||
set unicode_ellipsis false
|
set unicode_ellipsis false
|
||||||
set show_hidden_bookmarks false
|
|
||||||
|
# BIDI support - try to properly display file names in RTL languages (Hebrew, Arabic).
|
||||||
|
# Requires the python-bidi pip package
|
||||||
|
set bidi_support false
|
||||||
|
|
||||||
|
# Show dotfiles in the bookmark preview box?
|
||||||
|
set show_hidden_bookmarks true
|
||||||
|
|
||||||
|
# Which colorscheme to use? These colorschemes are available by default:
|
||||||
|
# default, jungle, snow, solarized
|
||||||
set colorscheme default
|
set colorscheme default
|
||||||
|
|
||||||
|
# Preview files on the rightmost column?
|
||||||
|
# And collapse (shrink) the last column if there is nothing to preview?
|
||||||
set preview_files true
|
set preview_files true
|
||||||
set preview_directories true
|
set preview_directories true
|
||||||
set collapse_preview true
|
set collapse_preview true
|
||||||
set save_console_history false
|
|
||||||
|
# Wrap long lines in plain text previews?
|
||||||
|
set wrap_plaintext_previews false
|
||||||
|
|
||||||
|
# Save the console history on exit?
|
||||||
|
set save_console_history true
|
||||||
|
|
||||||
|
# Draw the status bar on top of the browser window (default: bottom)
|
||||||
set status_bar_on_top false
|
set status_bar_on_top false
|
||||||
|
|
||||||
|
# Draw a progress bar in the status bar which displays the average state of all
|
||||||
|
# currently running tasks which support progress bars?
|
||||||
set draw_progress_bar_in_status_bar true
|
set draw_progress_bar_in_status_bar true
|
||||||
set draw_borders false
|
|
||||||
|
# Draw borders around columns? (separators, outline, both, or none)
|
||||||
|
# Separators are vertical lines between columns.
|
||||||
|
# Outline draws a box around all the columns.
|
||||||
|
# Both combines the two.
|
||||||
|
set draw_borders none
|
||||||
|
|
||||||
|
# Display the directory name in tabs?
|
||||||
set dirname_in_tabs true
|
set dirname_in_tabs true
|
||||||
|
|
||||||
|
# Enable the mouse support?
|
||||||
set mouse_enabled true
|
set mouse_enabled true
|
||||||
|
|
||||||
|
# Display the file size in the main column or status bar?
|
||||||
set display_size_in_main_column true
|
set display_size_in_main_column true
|
||||||
set display_size_in_status_bar true
|
set display_size_in_status_bar true
|
||||||
|
|
||||||
|
# Display the free disk space in the status bar?
|
||||||
|
set display_free_space_in_status_bar true
|
||||||
|
|
||||||
|
# Display files tags in all columns or only in main column?
|
||||||
set display_tags_in_all_columns true
|
set display_tags_in_all_columns true
|
||||||
|
|
||||||
|
# Set a title for the window? Updates both `WM_NAME` and `WM_ICON_NAME`
|
||||||
set update_title false
|
set update_title false
|
||||||
|
|
||||||
|
# Set the tmux/screen window-name to "ranger"?
|
||||||
set update_tmux_title true
|
set update_tmux_title true
|
||||||
|
|
||||||
|
# Shorten the title if it gets long? The number defines how many
|
||||||
|
# directories are displayed at once, 0 turns off this feature.
|
||||||
set shorten_title 3
|
set shorten_title 3
|
||||||
|
|
||||||
|
# Show hostname in titlebar?
|
||||||
|
set hostname_in_titlebar true
|
||||||
|
|
||||||
|
# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
|
||||||
set tilde_in_titlebar true
|
set tilde_in_titlebar true
|
||||||
|
|
||||||
|
# How many directory-changes or console-commands should be kept in history?
|
||||||
set max_history_size 20
|
set max_history_size 20
|
||||||
set max_console_history_size 50
|
set max_console_history_size 50
|
||||||
|
|
||||||
|
# Try to keep so much space between the top/bottom border when scrolling:
|
||||||
set scroll_offset 8
|
set scroll_offset 8
|
||||||
|
|
||||||
|
# Flush the input after each key hit? (Noticeable when ranger lags)
|
||||||
set flushinput true
|
set flushinput true
|
||||||
|
|
||||||
|
# Padding on the right when there's no preview?
|
||||||
|
# This allows you to click into the space to run the file.
|
||||||
set padding_right true
|
set padding_right true
|
||||||
set autosave_bookmarks false
|
|
||||||
|
# Save bookmarks (used with mX and `X) instantly?
|
||||||
|
# This helps to synchronize bookmarks between multiple ranger
|
||||||
|
# instances but leads to *slight* performance loss.
|
||||||
|
# When false, bookmarks are saved when ranger is exited.
|
||||||
|
set autosave_bookmarks true
|
||||||
|
|
||||||
|
# Save the "`" bookmark to disk. This can be used to switch to the last
|
||||||
|
# directory by typing "``".
|
||||||
|
set save_backtick_bookmark true
|
||||||
|
|
||||||
|
# You can display the "real" cumulative size of directories by using the
|
||||||
|
# command :get_cumulative_size or typing "dc". The size is expensive to
|
||||||
|
# calculate and will not be updated automatically. You can choose
|
||||||
|
# to update it automatically though by turning on this option:
|
||||||
set autoupdate_cumulative_size false
|
set autoupdate_cumulative_size false
|
||||||
|
|
||||||
|
# Turning this on makes sense for screen readers:
|
||||||
set show_cursor false
|
set show_cursor false
|
||||||
|
|
||||||
|
# One of: size, natural, basename, atime, ctime, mtime, type, random
|
||||||
set sort natural
|
set sort natural
|
||||||
|
|
||||||
|
# Additional sorting options
|
||||||
set sort_reverse false
|
set sort_reverse false
|
||||||
set sort_case_insensitive true
|
set sort_case_insensitive true
|
||||||
set sort_directories_first true
|
set sort_directories_first true
|
||||||
set sort_unicode false
|
set sort_unicode false
|
||||||
|
|
||||||
|
# Enable this if key combinations with the Alt Key don't work for you.
|
||||||
|
# (Especially on xterm)
|
||||||
set xterm_alt_key false
|
set xterm_alt_key false
|
||||||
set cd_bookmarks false
|
|
||||||
|
# Whether to include bookmarks in cd command
|
||||||
|
set cd_bookmarks true
|
||||||
|
|
||||||
|
# Changes case sensitivity for the cd command tab completion
|
||||||
|
set cd_tab_case sensitive
|
||||||
|
|
||||||
|
# Use fuzzy tab completion with the "cd" command. For example,
|
||||||
|
# ":cd /u/lo/b<tab>" expands to ":cd /usr/local/bin".
|
||||||
|
set cd_tab_fuzzy false
|
||||||
|
|
||||||
|
# Avoid previewing files larger than this size, in bytes. Use a value of 0 to
|
||||||
|
# disable this feature.
|
||||||
set preview_max_size 0
|
set preview_max_size 0
|
||||||
|
|
||||||
|
# The key hint lists up to this size have their sublists expanded.
|
||||||
|
# Otherwise the submaps are replaced with "...".
|
||||||
|
set hint_collapse_threshold 10
|
||||||
|
|
||||||
|
# Add the highlighted file to the path in the titlebar
|
||||||
set show_selection_in_titlebar true
|
set show_selection_in_titlebar true
|
||||||
|
|
||||||
|
# The delay that ranger idly waits for user input, in milliseconds, with a
|
||||||
|
# resolution of 100ms. Lower delay reduces lag between directory updates but
|
||||||
|
# increases CPU load.
|
||||||
set idle_delay 2000
|
set idle_delay 2000
|
||||||
|
|
||||||
|
# When the metadata manager module looks for metadata, should it only look for
|
||||||
|
# a ".metadata.json" file in the current directory, or do a deep search and
|
||||||
|
# check all directories above the current one as well?
|
||||||
set metadata_deep_search false
|
set metadata_deep_search false
|
||||||
|
|
||||||
|
# Clear all existing filters when leaving a directory
|
||||||
|
set clear_filters_on_dir_change false
|
||||||
|
|
||||||
|
# Disable displaying line numbers in main column.
|
||||||
|
# Possible values: false, absolute, relative.
|
||||||
|
set line_numbers false
|
||||||
|
|
||||||
|
# When line_numbers=relative show the absolute line number in the
|
||||||
|
# current line.
|
||||||
|
set relative_current_zero false
|
||||||
|
|
||||||
|
# Start line numbers from 1 instead of 0
|
||||||
|
set one_indexed false
|
||||||
|
|
||||||
|
# Save tabs on exit
|
||||||
|
set save_tabs_on_exit false
|
||||||
|
|
||||||
|
# Enable scroll wrapping - moving down while on the last item will wrap around to
|
||||||
|
# the top and vice versa.
|
||||||
|
set wrap_scroll false
|
||||||
|
|
||||||
|
# Set the global_inode_type_filter to nothing. Possible options: d, f and l for
|
||||||
|
# directories, files and symlinks respectively.
|
||||||
|
set global_inode_type_filter
|
||||||
|
|
||||||
|
# This setting allows to freeze the list of files to save I/O bandwidth. It
|
||||||
|
# should be 'false' during start-up, but you can toggle it by pressing F.
|
||||||
|
set freeze_files false
|
||||||
|
|
||||||
|
# Print file sizes in bytes instead of the default human-readable format.
|
||||||
|
set size_in_bytes false
|
||||||
|
|
||||||
|
# Warn at startup if RANGER_LEVEL env var is greater than 0, in other words
|
||||||
|
# give a warning when you nest ranger in a subshell started by ranger.
|
||||||
|
# Special value "error" makes the warning more visible.
|
||||||
|
set nested_ranger_warning true
|
||||||
|
|
||||||
|
# ===================================================================
|
||||||
|
# == Local Options
|
||||||
|
# ===================================================================
|
||||||
|
# You can set local options that only affect a single directory.
|
||||||
|
|
||||||
|
# Examples:
|
||||||
|
# setlocal path=~/downloads sort mtime
|
||||||
|
|
||||||
|
# ===================================================================
|
||||||
|
# == Command Aliases in the Console
|
||||||
|
# ===================================================================
|
||||||
|
|
||||||
###ALIASES###
|
|
||||||
alias e edit
|
alias e edit
|
||||||
alias q quit
|
alias q quit
|
||||||
alias q! quitall
|
alias q! quit!
|
||||||
alias qa quitall
|
alias qa quitall
|
||||||
|
alias qa! quitall!
|
||||||
alias qall quitall
|
alias qall quitall
|
||||||
|
alias qall! quitall!
|
||||||
alias setl setlocal
|
alias setl setlocal
|
||||||
|
|
||||||
alias filter scout -prt
|
alias filter scout -prts
|
||||||
alias find scout -aeit
|
alias hide scout -prtsv
|
||||||
|
alias find scout -aets
|
||||||
alias mark scout -mr
|
alias mark scout -mr
|
||||||
alias unmark scout -Mr
|
alias unmark scout -Mr
|
||||||
alias search scout -rs
|
alias search scout -rs
|
||||||
alias search_inc scout -rts
|
alias search_inc scout -rts
|
||||||
alias travel scout -aefiklst
|
alias travel scout -aefklst
|
||||||
|
|
||||||
|
# ===================================================================
|
||||||
|
# == Define keys for the browser
|
||||||
|
# ===================================================================
|
||||||
|
|
||||||
###BASIC KEYS###
|
# Basic
|
||||||
|
map Q quitall
|
||||||
#BASIC
|
|
||||||
map Q quit!
|
|
||||||
map q quit
|
map q quit
|
||||||
copymap q ZZ ZQ
|
copymap q ZZ ZQ
|
||||||
|
|
||||||
map R reload_cwd
|
map R reload_cwd
|
||||||
|
map F set freeze_files!
|
||||||
map <C-r> reset
|
map <C-r> reset
|
||||||
#map <C-l> redraw_window
|
map <C-l> redraw_window
|
||||||
map <C-c> abort
|
map <C-c> abort
|
||||||
map <esc> change_mode normal
|
map <esc> change_mode normal
|
||||||
|
map ~ set viewmode!
|
||||||
|
|
||||||
map i display_file
|
map i display_file
|
||||||
|
map <A-j> scroll_preview 1
|
||||||
|
map <A-k> scroll_preview -1
|
||||||
map ? help
|
map ? help
|
||||||
#map W display_log
|
map W display_log
|
||||||
map w taskview_open
|
map w taskview_open
|
||||||
map S shell $SHELL
|
map S shell $SHELL
|
||||||
|
|
||||||
map : console
|
map : console
|
||||||
map ; console
|
map ; console
|
||||||
map ! console shell%space
|
map ! console shell%space
|
||||||
map @ console -p6 shell %s
|
map @ console -p6 shell %%s
|
||||||
map # console shell -p%space
|
map # console shell -p%space
|
||||||
#map s console shell%space
|
map s console shell%space
|
||||||
map r chain draw_possible_programs; console open_with%space
|
map r chain draw_possible_programs; console open_with%space
|
||||||
map f console find%space
|
map f console find%space
|
||||||
map cd console cd%space
|
map cd console cd%space
|
||||||
|
|
||||||
|
map <C-p> chain console; eval fm.ui.console.history_move(-1)
|
||||||
|
|
||||||
# Change the line mode
|
# Change the line mode
|
||||||
#map Mf linemode filename
|
map Mf linemode filename
|
||||||
#map Mi linemode fileinfo
|
map Mi linemode fileinfo
|
||||||
#map Mp linemode permissions
|
map Mm linemode mtime
|
||||||
#map Mt linemode metatitle
|
map Mh linemode humanreadablemtime
|
||||||
|
map Mp linemode permissions
|
||||||
#moc
|
map Ms linemode sizemtime
|
||||||
#map Mc shell mocp -c
|
map MH linemode sizehumanreadablemtime
|
||||||
#map Ma shell mocp -a %s
|
map Mt linemode metatitle
|
||||||
#map Ms shell mocp -p
|
|
||||||
#map MS shell mocp -S
|
|
||||||
#map Mp shell mocp -G
|
|
||||||
#map Mn shell mocp -f
|
|
||||||
#map Mb shell mocp -r
|
|
||||||
#map MN shell mocp -s && mocp -c && mocp -a %s && mocp -p
|
|
||||||
#map Mo shell mocp -j 0%%
|
|
||||||
#map MK shell killall mocp
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Tagging / Marking
|
# Tagging / Marking
|
||||||
map at tag_toggle
|
map t tag_toggle
|
||||||
map ut tag_remove
|
map ut tag_remove
|
||||||
map "<any> tag_toggle tag=%any
|
map "<any> tag_toggle tag=%any
|
||||||
map <Space> mark_files toggle=True
|
map <Space> mark_files toggle=True
|
||||||
map va mark_files all=True toggle=True
|
map v mark_files all=True toggle=True
|
||||||
map uv mark_files all=True val=False
|
map uv mark_files all=True val=False
|
||||||
map vs toggle_visual_mode
|
map V toggle_visual_mode
|
||||||
map uV toggle_visual_mode reverse=True
|
map uV toggle_visual_mode reverse=True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# For the nostalgics: Midnight Commander bindings
|
# For the nostalgics: Midnight Commander bindings
|
||||||
map <F1> help
|
map <F1> help
|
||||||
|
map <F2> rename_append
|
||||||
map <F3> display_file
|
map <F3> display_file
|
||||||
map <F4> edit
|
map <F4> edit
|
||||||
map <F5> copy
|
map <F5> copy
|
||||||
map <F6> cut
|
map <F6> cut
|
||||||
map <F7> console mkdir%space
|
map <F7> console mkdir%space
|
||||||
map <F8> console delete
|
map <F8> console delete
|
||||||
|
#map <F8> console trash
|
||||||
map <F10> exit
|
map <F10> exit
|
||||||
|
|
||||||
|
|
||||||
# In case you work on a keyboard with dvorak layout
|
# In case you work on a keyboard with dvorak layout
|
||||||
map <UP> move up=1
|
map <UP> move up=1
|
||||||
map <DOWN> move down=1
|
map <DOWN> move down=1
|
||||||
|
|
@ -163,11 +420,10 @@ map <END> move to=-1
|
||||||
map <PAGEDOWN> move down=1 pages=True
|
map <PAGEDOWN> move down=1 pages=True
|
||||||
map <PAGEUP> move up=1 pages=True
|
map <PAGEUP> move up=1 pages=True
|
||||||
map <CR> move right=1
|
map <CR> move right=1
|
||||||
map <DELETE> console delete
|
#map <DELETE> console delete
|
||||||
map <INSERT> console touch%space
|
map <INSERT> console touch%space
|
||||||
|
|
||||||
|
# VIM-like
|
||||||
# nvim-like
|
|
||||||
copymap <UP> k
|
copymap <UP> k
|
||||||
copymap <DOWN> j
|
copymap <DOWN> j
|
||||||
copymap <LEFT> h
|
copymap <LEFT> h
|
||||||
|
|
@ -182,64 +438,50 @@ map K move up=0.5 pages=True
|
||||||
copymap J <C-D>
|
copymap J <C-D>
|
||||||
copymap K <C-U>
|
copymap K <C-U>
|
||||||
|
|
||||||
|
|
||||||
# Jumping around
|
# Jumping around
|
||||||
map H history_go -1
|
map H history_go -1
|
||||||
map L history_go 1
|
map L history_go 1
|
||||||
map ] move_parent 1
|
map ] move_parent 1
|
||||||
map [ move_parent -1
|
map [ move_parent -1
|
||||||
map } traverse
|
map } traverse
|
||||||
|
map { traverse_backwards
|
||||||
|
map ) jump_non
|
||||||
|
|
||||||
#DEFAULT MOVEMENT
|
map gh cd ~
|
||||||
map ge cd /etc
|
map ge cd /etc
|
||||||
map gu cd /usr
|
map gu cd /usr
|
||||||
#map gl cd -r .
|
map gd cd /dev
|
||||||
|
map gl cd -r .
|
||||||
map gL cd -r %f
|
map gL cd -r %f
|
||||||
#map gv cd /var
|
map go cd /opt
|
||||||
|
map gv cd /var
|
||||||
|
map gm cd /media
|
||||||
|
map gi eval fm.cd('/run/media/' + os.getenv('USER'))
|
||||||
map gM cd /mnt
|
map gM cd /mnt
|
||||||
|
map gs cd /srv
|
||||||
|
map gp cd /tmp
|
||||||
map gr cd /
|
map gr cd /
|
||||||
map gR eval fm.cd(ranger.RANGERDIR)
|
map gR eval fm.cd(ranger.RANGERDIR)
|
||||||
|
map g/ cd /
|
||||||
map g? cd /usr/share/doc/ranger
|
map g? cd /usr/share/doc/ranger
|
||||||
|
|
||||||
# Tabs
|
|
||||||
map <C-n> tab_new ~
|
|
||||||
map <C-w> tab_close
|
|
||||||
map <TAB> tab_move 1
|
|
||||||
map <S-TAB> tab_move -1
|
|
||||||
map <A-Right> tab_move 1
|
|
||||||
map <A-Left> tab_move -1
|
|
||||||
#map gt tab_move 1
|
|
||||||
#map gT tab_move -1
|
|
||||||
map gn tab_new ~
|
|
||||||
#map gc tab_close
|
|
||||||
map tt tab_close
|
|
||||||
map uq tab_restore
|
|
||||||
map <a-1> tab_open 1
|
|
||||||
map <a-2> tab_open 2
|
|
||||||
map <a-3> tab_open 3
|
|
||||||
map <a-4> tab_open 4
|
|
||||||
map <a-5> tab_open 5
|
|
||||||
map <a-6> tab_open 6
|
|
||||||
map <a-7> tab_open 7
|
|
||||||
map <a-8> tab_open 8
|
|
||||||
map <a-9> tab_open 9
|
|
||||||
|
|
||||||
|
|
||||||
# External Programs
|
# External Programs
|
||||||
map E edit
|
map E edit
|
||||||
map du shell -p du --max-depth=1 -h --apparent-size
|
map du shell -p (du --max-depth=1 --human-readable --apparent-size || du -d 1 -h) 2>/dev/null
|
||||||
map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
|
map dU shell -p (du --max-depth=1 --human-readable --apparent-size || du -d 1 -h) 2>/dev/null | sort -rh
|
||||||
map yp shell -f echo -n %%d/%%f | xsel -i; xsel -o | xsel -i -b
|
map yp yank path
|
||||||
map yd shell -f echo -n %%d | xsel -i; xsel -o | xsel -i -b
|
map yd yank dir
|
||||||
map yn shell -f echo -n %%f | xsel -i; xsel -o | xsel -i -b
|
map yn yank name
|
||||||
|
map y. yank name_without_extension
|
||||||
|
|
||||||
# Filesystem Operations
|
# Filesystem Operations
|
||||||
map = chmod
|
map = chmod
|
||||||
|
|
||||||
map cw console rename%space
|
map cw console rename%space
|
||||||
map aa rename_append
|
map a rename_append
|
||||||
map A eval fm.open_console('rename ' + fm.thisfile.relative_path)
|
map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
|
||||||
map I eval fm.open_console('rename ' + fm.thisfile.relative_path, position=7)
|
map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
|
||||||
|
|
||||||
map pp paste
|
map pp paste
|
||||||
map po paste overwrite=True
|
map po paste overwrite=True
|
||||||
map pP paste append=True
|
map pP paste append=True
|
||||||
|
|
@ -248,19 +490,24 @@ map pl paste_symlink relative=False
|
||||||
map pL paste_symlink relative=True
|
map pL paste_symlink relative=True
|
||||||
map phl paste_hardlink
|
map phl paste_hardlink
|
||||||
map pht paste_hardlinked_subtree
|
map pht paste_hardlinked_subtree
|
||||||
|
map pd console paste dest=
|
||||||
|
map p`<any> paste dest=%any_path
|
||||||
|
map p'<any> paste dest=%any_path
|
||||||
|
|
||||||
map dD console delete
|
map dD console delete
|
||||||
|
map dT console trash
|
||||||
|
|
||||||
map dd cut
|
map dd cut
|
||||||
map ud uncut
|
map ud uncut
|
||||||
map da cut mode=add
|
map da cut mode=add
|
||||||
map dr cut mode=remove
|
map dr cut mode=remove
|
||||||
|
map dt cut mode=toggle
|
||||||
|
|
||||||
map yy copy
|
map yy copy
|
||||||
map uy uncut
|
map uy uncut
|
||||||
map yc copy mode=add
|
map ya copy mode=add
|
||||||
map yr copy mode=remove
|
map yr copy mode=remove
|
||||||
|
map yt copy mode=toggle
|
||||||
|
|
||||||
# Temporary workarounds
|
# Temporary workarounds
|
||||||
map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
|
map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
|
||||||
|
|
@ -272,7 +519,6 @@ map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
|
||||||
map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
|
map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
|
||||||
map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
|
map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
|
||||||
|
|
||||||
|
|
||||||
# Searching
|
# Searching
|
||||||
map / console search%space
|
map / console search%space
|
||||||
map n search_next
|
map n search_next
|
||||||
|
|
@ -284,9 +530,32 @@ map cc search_next order=ctime
|
||||||
map cm search_next order=mtime
|
map cm search_next order=mtime
|
||||||
map ca search_next order=atime
|
map ca search_next order=atime
|
||||||
|
|
||||||
|
# Tabs
|
||||||
|
map <C-n> tab_new
|
||||||
|
map <C-w> tab_close
|
||||||
|
map <TAB> tab_move 1
|
||||||
|
map <S-TAB> tab_move -1
|
||||||
|
map <A-Right> tab_move 1
|
||||||
|
map <A-Left> tab_move -1
|
||||||
|
map gt tab_move 1
|
||||||
|
map gT tab_move -1
|
||||||
|
map gn tab_new
|
||||||
|
map gc tab_close
|
||||||
|
map uq tab_restore
|
||||||
|
map <a-1> tab_open 1
|
||||||
|
map <a-2> tab_open 2
|
||||||
|
map <a-3> tab_open 3
|
||||||
|
map <a-4> tab_open 4
|
||||||
|
map <a-5> tab_open 5
|
||||||
|
map <a-6> tab_open 6
|
||||||
|
map <a-7> tab_open 7
|
||||||
|
map <a-8> tab_open 8
|
||||||
|
map <a-9> tab_open 9
|
||||||
|
map <a-r> tab_shift 1
|
||||||
|
map <a-l> tab_shift -1
|
||||||
|
|
||||||
# Sorting
|
# Sorting
|
||||||
map or toggle_option sort_reverse
|
map or set sort_reverse!
|
||||||
map oz set sort=random
|
map oz set sort=random
|
||||||
map os chain set sort=size; set sort_reverse=False
|
map os chain set sort=size; set sort_reverse=False
|
||||||
map ob chain set sort=basename; set sort_reverse=False
|
map ob chain set sort=basename; set sort_reverse=False
|
||||||
|
|
@ -308,58 +577,79 @@ map oE chain set sort=extension; set sort_reverse=True
|
||||||
|
|
||||||
map dc get_cumulative_size
|
map dc get_cumulative_size
|
||||||
|
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
map zc toggle_option collapse_preview
|
map zc set collapse_preview!
|
||||||
map zd toggle_option sort_directories_first
|
map zd set sort_directories_first!
|
||||||
map zh toggle_option show_hidden
|
map zh set show_hidden!
|
||||||
map <C-h> toggle_option show_hidden
|
map <C-h> set show_hidden!
|
||||||
map zi toggle_option flushinput
|
copymap <C-h> <backspace>
|
||||||
map zm toggle_option mouse_enabled
|
copymap <backspace> <backspace2>
|
||||||
map zp toggle_option preview_files
|
map zI set flushinput!
|
||||||
map zP toggle_option preview_directories
|
map zi set preview_images!
|
||||||
map zs toggle_option sort_case_insensitive
|
map zm set mouse_enabled!
|
||||||
map zu toggle_option autoupdate_cumulative_size
|
map zp set preview_files!
|
||||||
map zv toggle_option use_preview_script
|
map zP set preview_directories!
|
||||||
|
map zs set sort_case_insensitive!
|
||||||
|
map zu set autoupdate_cumulative_size!
|
||||||
|
map zv set use_preview_script!
|
||||||
map zf console filter%space
|
map zf console filter%space
|
||||||
|
copymap zf zz
|
||||||
|
|
||||||
|
# Filter stack
|
||||||
|
map .d filter_stack add type d
|
||||||
|
map .f filter_stack add type f
|
||||||
|
map .l filter_stack add type l
|
||||||
|
map .m console filter_stack add mime%space
|
||||||
|
map .n console filter_stack add name%space
|
||||||
|
map .# console filter_stack add hash%space
|
||||||
|
map ." filter_stack add duplicate
|
||||||
|
map .' filter_stack add unique
|
||||||
|
map .| filter_stack add or
|
||||||
|
map .& filter_stack add and
|
||||||
|
map .! filter_stack add not
|
||||||
|
map .r filter_stack rotate
|
||||||
|
map .c filter_stack clear
|
||||||
|
map .* filter_stack decompose
|
||||||
|
map .p filter_stack pop
|
||||||
|
map .. filter_stack show
|
||||||
|
|
||||||
# Bookmarks
|
# Bookmarks
|
||||||
#map `<any> enter_bookmark %any
|
map `<any> enter_bookmark %any
|
||||||
#map '<any> enter_bookmark %any
|
map '<any> enter_bookmark %any
|
||||||
#map mm<any> set_bookmark %any
|
map m<any> set_bookmark %any
|
||||||
#map um<any> unset_bookmark %any
|
map um<any> unset_bookmark %any
|
||||||
|
|
||||||
#map m<bg> draw_bookmarks
|
|
||||||
#copymap m<bg> um<bg> `<bg> '<bg>
|
|
||||||
|
|
||||||
|
map m<bg> draw_bookmarks
|
||||||
|
copymap m<bg> um<bg> `<bg> '<bg> p`<bg> p'<bg>
|
||||||
|
|
||||||
# Generate all the chmod bindings with some python help:
|
# Generate all the chmod bindings with some python help:
|
||||||
eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg))
|
eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg))
|
||||||
eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg))
|
eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg))
|
||||||
eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg))
|
eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg))
|
||||||
eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg))
|
eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg))
|
||||||
eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg))
|
eval for arg in "rwxXst": cmd("map +{0} shell -f chmod +{0} %s".format(arg))
|
||||||
|
|
||||||
eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg))
|
eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg))
|
||||||
eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg))
|
eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg))
|
||||||
eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg))
|
eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg))
|
||||||
eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg))
|
eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg))
|
||||||
eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg))
|
eval for arg in "rwxXst": cmd("map -{0} shell -f chmod -{0} %s".format(arg))
|
||||||
|
|
||||||
|
# ===================================================================
|
||||||
|
# == Define keys for the console
|
||||||
|
# ===================================================================
|
||||||
|
# Note: Unmapped keys are passed directly to the console.
|
||||||
|
|
||||||
###CONSOLE KEYS###
|
|
||||||
# Basic
|
# Basic
|
||||||
cmap <tab> eval fm.ui.console.tab()
|
cmap <tab> eval fm.ui.console.tab()
|
||||||
cmap <s-tab> eval fm.ui.console.tab(-1)
|
cmap <s-tab> eval fm.ui.console.tab(-1)
|
||||||
cmap <ESC> eval fm.ui.console.close()
|
cmap <ESC> eval fm.ui.console.close()
|
||||||
cmap <CR> eval fm.ui.console.execute()
|
cmap <CR> eval fm.ui.console.execute()
|
||||||
#cmap <C-l> redraw_window
|
cmap <C-l> redraw_window
|
||||||
|
|
||||||
copycmap <ESC> <C-c>
|
copycmap <ESC> <C-c>
|
||||||
copycmap <CR> <C-j>
|
copycmap <CR> <C-j>
|
||||||
|
|
||||||
|
|
||||||
# Move around
|
# Move around
|
||||||
cmap <up> eval fm.ui.console.history_move(-1)
|
cmap <up> eval fm.ui.console.history_move(-1)
|
||||||
cmap <down> eval fm.ui.console.history_move(1)
|
cmap <down> eval fm.ui.console.history_move(1)
|
||||||
|
|
@ -367,7 +657,11 @@ cmap <left> eval fm.ui.console.move(left=1)
|
||||||
cmap <right> eval fm.ui.console.move(right=1)
|
cmap <right> eval fm.ui.console.move(right=1)
|
||||||
cmap <home> eval fm.ui.console.move(right=0, absolute=True)
|
cmap <home> eval fm.ui.console.move(right=0, absolute=True)
|
||||||
cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
|
cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
|
||||||
|
cmap <a-b> eval fm.ui.console.move_word(left=1)
|
||||||
|
cmap <a-f> eval fm.ui.console.move_word(right=1)
|
||||||
|
|
||||||
|
copycmap <a-b> <a-left>
|
||||||
|
copycmap <a-f> <a-right>
|
||||||
|
|
||||||
# Line Editing
|
# Line Editing
|
||||||
cmap <backspace> eval fm.ui.console.delete(-1)
|
cmap <backspace> eval fm.ui.console.delete(-1)
|
||||||
|
|
@ -377,17 +671,19 @@ cmap <A-d> eval fm.ui.console.delete_word(backward=False)
|
||||||
cmap <C-k> eval fm.ui.console.delete_rest(1)
|
cmap <C-k> eval fm.ui.console.delete_rest(1)
|
||||||
cmap <C-u> eval fm.ui.console.delete_rest(-1)
|
cmap <C-u> eval fm.ui.console.delete_rest(-1)
|
||||||
cmap <C-y> eval fm.ui.console.paste()
|
cmap <C-y> eval fm.ui.console.paste()
|
||||||
|
cmap <C-t> eval fm.ui.console.transpose_chars()
|
||||||
|
cmap <A-t> eval fm.ui.console.transpose_words()
|
||||||
|
|
||||||
# And of course the emacs way
|
# And of course the emacs way
|
||||||
#copycmap <up> <C-p>
|
copycmap <ESC> <C-g>
|
||||||
#copycmap <down> <C-n>
|
copycmap <up> <C-p>
|
||||||
#copycmap <left> <C-b>
|
copycmap <down> <C-n>
|
||||||
#copycmap <right> <C-f>
|
copycmap <left> <C-b>
|
||||||
#copycmap <home> <C-a>
|
copycmap <right> <C-f>
|
||||||
#copycmap <end> <C-e>
|
copycmap <home> <C-a>
|
||||||
#copycmap <delete> <C-d>
|
copycmap <end> <C-e>
|
||||||
#copycmap <backspace> <C-h>
|
copycmap <delete> <C-d>
|
||||||
|
copycmap <backspace> <C-h>
|
||||||
|
|
||||||
# Note: There are multiple ways to express backspaces. <backspace> (code 263)
|
# Note: There are multiple ways to express backspaces. <backspace> (code 263)
|
||||||
# and <backspace2> (code 127). To be sure, use both.
|
# and <backspace2> (code 127). To be sure, use both.
|
||||||
|
|
@ -396,9 +692,10 @@ copycmap <backspace> <backspace2>
|
||||||
# This special expression allows typing in numerals:
|
# This special expression allows typing in numerals:
|
||||||
cmap <allow_quantifiers> false
|
cmap <allow_quantifiers> false
|
||||||
|
|
||||||
|
# ===================================================================
|
||||||
|
# == Pager Keybindings
|
||||||
|
# ===================================================================
|
||||||
|
|
||||||
|
|
||||||
###PAGER KEYS###
|
|
||||||
# Movement
|
# Movement
|
||||||
pmap <down> pager_move down=1
|
pmap <down> pager_move down=1
|
||||||
pmap <up> pager_move up=1
|
pmap <up> pager_move up=1
|
||||||
|
|
@ -422,9 +719,8 @@ copypmap <C-u> u
|
||||||
copypmap <PAGEDOWN> n f <C-F> <Space>
|
copypmap <PAGEDOWN> n f <C-F> <Space>
|
||||||
copypmap <PAGEUP> p b <C-B>
|
copypmap <PAGEUP> p b <C-B>
|
||||||
|
|
||||||
|
|
||||||
# Basic
|
# Basic
|
||||||
#pmap <C-l> redraw_window
|
pmap <C-l> redraw_window
|
||||||
pmap <ESC> pager_close
|
pmap <ESC> pager_close
|
||||||
copypmap <ESC> q Q i <F3>
|
copypmap <ESC> q Q i <F3>
|
||||||
pmap E edit_file
|
pmap E edit_file
|
||||||
|
|
@ -460,42 +756,10 @@ tmap <pageup> eval -q fm.ui.taskview.task_move(0)
|
||||||
tmap <delete> eval -q fm.ui.taskview.task_remove()
|
tmap <delete> eval -q fm.ui.taskview.task_remove()
|
||||||
|
|
||||||
# Basic
|
# Basic
|
||||||
#tmap <C-l> redraw_window
|
tmap <C-l> redraw_window
|
||||||
tmap <ESC> taskview_close
|
tmap <ESC> taskview_close
|
||||||
copytmap <ESC> q Q w <C-c>
|
copytmap <ESC> q Q w <C-c>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
map sp console shell bash ~/.config/Scripts/speedvid.sh %f%space
|
|
||||||
map x shell chmod -x %s
|
|
||||||
map TT shell i3 exec urxvt "%d"
|
|
||||||
map vc shell ~/.config/Scripts/concatenate.sh %s
|
|
||||||
|
|
||||||
#General
|
|
||||||
map V console shell nvim%space
|
|
||||||
map cW bulkrename %s
|
|
||||||
map mkd console mkdir%space
|
|
||||||
map sc console shell ln -sT%space
|
|
||||||
map D console delete
|
|
||||||
map X shell dtrx %f
|
|
||||||
map Z shell tar -cvzf %f.tar.gz %f
|
|
||||||
map <C-f> fzf_select
|
|
||||||
map <C-l> fzf_locate
|
|
||||||
map zz fzf_fasd
|
|
||||||
map zo console fasd%space
|
|
||||||
|
|
||||||
#Document Manipulation
|
|
||||||
map p1s shell lpr -o sides=one-sided %f
|
|
||||||
map p2s shell lpr -o sides=two-sided-long-edge %f
|
|
||||||
map MP shell pandoc %f -o %f.pdf
|
|
||||||
map MX shell xelatex %f
|
|
||||||
map ML shell latex %f
|
|
||||||
map TC shell ~/.config/Scripts/texclear
|
|
||||||
map Txa console shell cp ~/Documents/LaTeX/article.tex%space
|
|
||||||
map Txs console shell cp ~/Documents/LaTeX/beamer.tex%space
|
|
||||||
map Txh console shell cp ~/Documents/LaTeX/handout.tex%space
|
|
||||||
|
|
||||||
#Yadm commands
|
#Yadm commands
|
||||||
map ya shell yadm add %f
|
map ya shell yadm add %f
|
||||||
|
|
||||||
|
|
@ -509,35 +773,7 @@ map bv shell wal -c -a "90" -l -i %f && cp %f ~/.config/wall.png #&& ~/.config/S
|
||||||
map C shell killall w3mimgdisplay && convert -rotate 90 %s %s
|
map C shell killall w3mimgdisplay && convert -rotate 90 %s %s
|
||||||
map F shell killall w3mimgdisplay && convert -flop %s %s
|
map F shell killall w3mimgdisplay && convert -flop %s %s
|
||||||
map bl shell killall w3mimgdisplay && convert %s -resize 1920x1080\> bl_%s
|
map bl shell killall w3mimgdisplay && convert %s -resize 1920x1080\> bl_%s
|
||||||
map TR shell convert %s -transparent white %s
|
|
||||||
|
|
||||||
#torrent
|
|
||||||
map st shell stig add %f
|
|
||||||
|
|
||||||
#Music (mpd) shortcuts
|
|
||||||
map MS shell mpd
|
|
||||||
map MK shell killall mpd
|
|
||||||
map Ma shell mpc add "%s"
|
|
||||||
map Ms shell mpc play
|
|
||||||
map Mp shell mpc toggle
|
|
||||||
map Mn shell mpc next
|
|
||||||
map Mb shell mpc prev
|
|
||||||
map MN shell mpc stop && mpc clear && mpc add "%s"
|
|
||||||
map Mo shell mpc seek 0%
|
|
||||||
|
|
||||||
#Audio tagging (Requires eyeD3)
|
|
||||||
map Ta eval fm.open_console('shell eyeD3 -a ' + fm.thisfile.relative_path, position=15)
|
|
||||||
#Artist
|
|
||||||
map TA eval fm.open_console('shell eyeD3 -A ' + fm.thisfile.relative_path, position=15)
|
|
||||||
#Album
|
|
||||||
map Tb eval fm.open_console('shell eyeD3 -b ' + fm.thisfile.relative_path, position=15)
|
|
||||||
#Album artist
|
|
||||||
map Tt eval fm.open_console('shell eyeD3 -t "" ' + fm.thisfile.relative_path, position=16)
|
|
||||||
map Tn eval fm.open_console('shell eyeD3 -n "" ' + fm.thisfile.relative_path, position=16)
|
|
||||||
|
|
||||||
#Downloading
|
|
||||||
map ytv console shell youtube-dl -ic%space
|
|
||||||
map yta console shell youtube-dl -xic%space
|
|
||||||
|
|
||||||
# DO NOT DELETE LMAO
|
# DO NOT DELETE LMAO
|
||||||
map gh cd ~
|
map gh cd ~
|
||||||
|
|
@ -594,7 +830,7 @@ map cft shell nvim ~/.tmux.conf
|
||||||
map cfa shell nvim ~/.config/mutt/aliases
|
map cfa shell nvim ~/.config/mutt/aliases
|
||||||
map cfp shell nvim ~/.config/polybar/config
|
map cfp shell nvim ~/.config/polybar/config
|
||||||
map cfd shell nvim ~/.Xresources
|
map cfd shell nvim ~/.Xresources
|
||||||
# DO NOT DELETE LMAO
|
|
||||||
# a plugin that adds file glyphs / icon support to Ranger:
|
|
||||||
# https://github.com/alexanderjeurissen/ranger_devicons
|
# Ranger devicons
|
||||||
default_linemode devicons
|
default_linemode devicons
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
# directory | $1 is a directory
|
# directory | $1 is a directory
|
||||||
# number <n> | change the number of this command to n
|
# number <n> | change the number of this command to n
|
||||||
# terminal | stdin, stderr and stdout are connected to a terminal
|
# terminal | stdin, stderr and stdout are connected to a terminal
|
||||||
# X | $DISPLAY is not empty (i.e. Xorg runs)
|
# X | A graphical environment is available (darwin, Xorg, or Wayland)
|
||||||
#
|
#
|
||||||
# There are also pseudo-conditions which have a "side effect":
|
# There are also pseudo-conditions which have a "side effect":
|
||||||
# flag <flags> | Change how the program is run. See below.
|
# flag <flags> | Change how the program is run. See below.
|
||||||
|
|
@ -66,13 +66,13 @@ ext x?html?, has uzbl-tabbed, X, flag f = uzbl-tabbed -- "$@"
|
||||||
ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@"
|
ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@"
|
||||||
ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@"
|
ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@"
|
||||||
ext x?html?, has midori, X, flag f = midori -- "$@"
|
ext x?html?, has midori, X, flag f = midori -- "$@"
|
||||||
|
ext x?html?, has opera, X, flag f = opera -- "$@"
|
||||||
|
ext x?html?, has firefox, X, flag f = firefox -- "$@"
|
||||||
|
ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@"
|
||||||
|
ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@"
|
||||||
ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@"
|
ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@"
|
||||||
ext x?html?, has chromium, X, flag f = chromium -- "$@"
|
ext x?html?, has chromium, X, flag f = chromium -- "$@"
|
||||||
ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@"
|
ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@"
|
||||||
ext x?html?, has opera, X, flag f = opera -- "$@"
|
|
||||||
#ext x?html?, has firefox, X, flag f = firefox -- "$@"
|
|
||||||
ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@"
|
|
||||||
ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@"
|
|
||||||
ext x?html?, has epiphany, X, flag f = epiphany -- "$@"
|
ext x?html?, has epiphany, X, flag f = epiphany -- "$@"
|
||||||
ext x?html?, has konqueror, X, flag f = konqueror -- "$@"
|
ext x?html?, has konqueror, X, flag f = konqueror -- "$@"
|
||||||
ext x?html?, has elinks, terminal = elinks "$@"
|
ext x?html?, has elinks, terminal = elinks "$@"
|
||||||
|
|
@ -85,16 +85,16 @@ ext x?html?, has w3m, terminal = w3m "$@"
|
||||||
# Misc
|
# Misc
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
# Define the "editor" for text files as first action
|
# Define the "editor" for text files as first action
|
||||||
mime ^text, label editor = nvim -- "$@"
|
mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@"
|
||||||
mime ^text, label pager = "$PAGER" -- "$@"
|
mime ^text, label pager = $PAGER -- "$@"
|
||||||
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = nvim -- "$@"
|
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php|dart = ${VISUAL:-$EDITOR} -- "$@"
|
||||||
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
|
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php|dart = $PAGER -- "$@"
|
||||||
|
|
||||||
ext 1 = man "$1"
|
ext 1 = man "$1"
|
||||||
ext s[wmf]c, has zsnes, X = zsnes "$1"
|
ext s[wmf]c, has zsnes, X = zsnes "$1"
|
||||||
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
|
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
|
||||||
ext nes, has fceux, X = fceux "$1"
|
ext nes, has fceux, X = fceux "$1"
|
||||||
ext exe = wine "$1"
|
ext exe, has wine = wine "$1"
|
||||||
name ^[mM]akefile$ = make
|
name ^[mM]akefile$ = make
|
||||||
|
|
||||||
#--------------------------------------------
|
#--------------------------------------------
|
||||||
|
|
@ -106,6 +106,7 @@ ext rb = ruby -- "$1"
|
||||||
ext js = node -- "$1"
|
ext js = node -- "$1"
|
||||||
ext sh = sh -- "$1"
|
ext sh = sh -- "$1"
|
||||||
ext php = php -- "$1"
|
ext php = php -- "$1"
|
||||||
|
ext dart = dart run -- "$1"
|
||||||
|
|
||||||
#--------------------------------------------
|
#--------------------------------------------
|
||||||
# Audio without X
|
# Audio without X
|
||||||
|
|
@ -118,17 +119,19 @@ ext midi?, terminal, has wildmidi = wildmidi -- "$@"
|
||||||
#--------------------------------------------
|
#--------------------------------------------
|
||||||
# Video/Audio with a GUI
|
# Video/Audio with a GUI
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
|
mime ^video|^audio, has gmplayer, X, flag f = gmplayer -- "$@"
|
||||||
mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
|
mime ^video|^audio, has smplayer, X, flag f = smplayer "$@"
|
||||||
mime ^video, has mpv, X, flag f = mpv -- "$@"
|
mime ^video, has mpv, X, flag f = mpv -- "$@"
|
||||||
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
|
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
|
||||||
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
|
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
|
||||||
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
|
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
|
||||||
mime ^video, has mplayer, X, flag f = mplayer -- "$@"
|
mime ^video, has mplayer, X, flag f = mplayer -- "$@"
|
||||||
mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@"
|
mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@"
|
||||||
mime ^video|audio, has vlc, X, flag f = vlc -- "$@"
|
mime ^video|^audio, has vlc, X, flag f = vlc -- "$@"
|
||||||
mime ^video|audio, has totem, X, flag f = totem -- "$@"
|
mime ^video|^audio, has totem, X, flag f = totem -- "$@"
|
||||||
mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@"
|
mime ^video|^audio, has totem, X, flag f = totem --fullscreen -- "$@"
|
||||||
|
mime ^audio, has audacity, X, flag f = audacity -- "$@"
|
||||||
|
ext aup, has audacity, X, flag f = audacity -- "$@"
|
||||||
|
|
||||||
#--------------------------------------------
|
#--------------------------------------------
|
||||||
# Video without X
|
# Video without X
|
||||||
|
|
@ -153,7 +156,8 @@ ext pdf, has epdfview, X, flag f = epdfview -- "$@"
|
||||||
ext pdf, has qpdfview, X, flag f = qpdfview "$@"
|
ext pdf, has qpdfview, X, flag f = qpdfview "$@"
|
||||||
ext pdf, has open, X, flag f = open "$@"
|
ext pdf, has open, X, flag f = open "$@"
|
||||||
|
|
||||||
ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER"
|
ext sc, has sc, = sc -- "$@"
|
||||||
|
ext docx?, has catdoc, terminal = catdoc -- "$@" | $PAGER
|
||||||
|
|
||||||
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@"
|
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@"
|
||||||
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@"
|
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@"
|
||||||
|
|
@ -171,8 +175,12 @@ ext epub, has zathura, X, flag f = zathura -- "$@"
|
||||||
ext epub, has mupdf, X, flag f = mupdf -- "$@"
|
ext epub, has mupdf, X, flag f = mupdf -- "$@"
|
||||||
ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
|
ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
|
||||||
|
|
||||||
ext cbr, has zathura, X, flag f = zathura -- "$@"
|
ext cb[rz], has qcomicbook, X, flag f = qcomicbook "$@"
|
||||||
ext cbz, has zathura, X, flag f = zathura -- "$@"
|
ext cb[rz], has mcomix, X, flag f = mcomix -- "$@"
|
||||||
|
ext cb[rz], has zathura, X, flag f = zathura -- "$@"
|
||||||
|
ext cb[rz], has atril, X, flag f = atril -- "$@"
|
||||||
|
|
||||||
|
ext sla, has scribus, X, flag f = scribus -- "$@"
|
||||||
|
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
# Images
|
# Images
|
||||||
|
|
@ -183,7 +191,7 @@ mime ^image/svg, has display, X, flag f = display -- "$@"
|
||||||
mime ^image, has imv, X, flag f = imv -- "$@"
|
mime ^image, has imv, X, flag f = imv -- "$@"
|
||||||
mime ^image, has pqiv, X, flag f = pqiv -- "$@"
|
mime ^image, has pqiv, X, flag f = pqiv -- "$@"
|
||||||
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
|
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
|
||||||
mime ^image, has feh, X, flag f = feh -- "$@"
|
mime ^image, has feh, X, flag f, !ext gif = feh -- "$@"
|
||||||
mime ^image, has mirage, X, flag f = mirage -- "$@"
|
mime ^image, has mirage, X, flag f = mirage -- "$@"
|
||||||
mime ^image, has ristretto, X, flag f = ristretto "$@"
|
mime ^image, has ristretto, X, flag f = ristretto "$@"
|
||||||
mime ^image, has eog, X, flag f = eog -- "$@"
|
mime ^image, has eog, X, flag f = eog -- "$@"
|
||||||
|
|
@ -192,7 +200,10 @@ mime ^image, has nomacs, X, flag f = nomacs -- "$@"
|
||||||
mime ^image, has geeqie, X, flag f = geeqie -- "$@"
|
mime ^image, has geeqie, X, flag f = geeqie -- "$@"
|
||||||
mime ^image, has gpicview, X, flag f = gpicview -- "$@"
|
mime ^image, has gpicview, X, flag f = gpicview -- "$@"
|
||||||
mime ^image, has gwenview, X, flag f = gwenview -- "$@"
|
mime ^image, has gwenview, X, flag f = gwenview -- "$@"
|
||||||
|
mime ^image, has mcomix, X, flag f = mcomix -- "$@"
|
||||||
mime ^image, has gimp, X, flag f = gimp -- "$@"
|
mime ^image, has gimp, X, flag f = gimp -- "$@"
|
||||||
|
mime ^image, has krita, X, flag f = krita -- "$@"
|
||||||
|
ext kra, has krita, X, flag f = krita -- "$@"
|
||||||
ext xcf, X, flag f = gimp -- "$@"
|
ext xcf, X, flag f = gimp -- "$@"
|
||||||
|
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
|
|
@ -200,15 +211,15 @@ ext xcf, X, flag f = gimp -- "$@"
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
|
|
||||||
# avoid password prompt by providing empty password
|
# avoid password prompt by providing empty password
|
||||||
ext 7z, has 7z = 7z -p l "$@" | "$PAGER"
|
ext 7z, has 7z = 7z -p l "$@" | $PAGER
|
||||||
# This requires atool
|
# This requires atool
|
||||||
ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | "$PAGER"
|
ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | $PAGER
|
||||||
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | "$PAGER"
|
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | $PAGER
|
||||||
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@"
|
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@"
|
||||||
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@"
|
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@"
|
||||||
|
|
||||||
# Listing and extracting archives without atool:
|
# Listing and extracting archives without atool:
|
||||||
ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER"
|
ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | $PAGER
|
||||||
ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done
|
ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done
|
||||||
ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done
|
ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done
|
||||||
ext zip, has unzip = unzip -l "$1" | less
|
ext zip, has unzip = unzip -l "$1" | less
|
||||||
|
|
@ -217,6 +228,9 @@ ext ace, has unace = unace l "$1" | less
|
||||||
ext ace, has unace = for file in "$@"; do unace e "$file"; done
|
ext ace, has unace = for file in "$@"; do unace e "$file"; done
|
||||||
ext rar, has unrar = unrar l "$1" | less
|
ext rar, has unrar = unrar l "$1" | less
|
||||||
ext rar, has unrar = for file in "$@"; do unrar x "$file"; done
|
ext rar, has unrar = for file in "$@"; do unrar x "$file"; done
|
||||||
|
ext rar|zip, has qcomicbook, X, flag f = qcomicbook "$@"
|
||||||
|
ext rar|zip, has mcomix, X, flag f = mcomix -- "$@"
|
||||||
|
ext rar|zip, has zathura, X, flag f = zathura -- "$@"
|
||||||
|
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
# Fonts
|
# Fonts
|
||||||
|
|
@ -259,10 +273,26 @@ label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1"
|
||||||
label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
|
label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
|
||||||
label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
|
label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
|
||||||
|
|
||||||
# Define the editor for non-text files + pager as last action
|
#-------------------------------------------
|
||||||
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask
|
# Generic file openers
|
||||||
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = nvim -- "$@"
|
#-------------------------------------------
|
||||||
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
|
label open, has xdg-open = xdg-open "$@"
|
||||||
|
label open, has open = open -- "$@"
|
||||||
|
|
||||||
# The very last action, so that it's never triggered accidentally, is to execute a program:
|
# Define the editor for non-text files + pager as last action
|
||||||
|
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php|dart = ask
|
||||||
|
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php|dart = ${VISUAL:-$EDITOR} -- "$@"
|
||||||
|
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php|dart = $PAGER -- "$@"
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# The actions below are left so low down in this file on purpose, so #
|
||||||
|
# they are never triggered accidentally. #
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
# Execute a file as program/script.
|
||||||
mime application/x-executable = "$1"
|
mime application/x-executable = "$1"
|
||||||
|
|
||||||
|
# Move the file to trash using trash-cli.
|
||||||
|
label trash, has trash-put = trash-put -- "$@"
|
||||||
|
label trash = mkdir -p -- "${XDG_DATA_HOME:-$HOME/.local/share}/ranger/trash"; mv -- "$@" "${XDG_DATA_HOME:-$HOME/.local/share}/ranger/trash"
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,12 @@ FILE_EXTENSION_LOWER="$(printf "%s" "${FILE_EXTENSION}" | tr '[:upper:]' '[:lowe
|
||||||
|
|
||||||
## Settings
|
## Settings
|
||||||
HIGHLIGHT_SIZE_MAX=262143 # 256KiB
|
HIGHLIGHT_SIZE_MAX=262143 # 256KiB
|
||||||
HIGHLIGHT_TABWIDTH=${HIGHLIGHT_TABWIDTH:-8}
|
HIGHLIGHT_TABWIDTH="${HIGHLIGHT_TABWIDTH:-8}"
|
||||||
HIGHLIGHT_STYLE=${HIGHLIGHT_STYLE:-pablo}
|
HIGHLIGHT_STYLE="${HIGHLIGHT_STYLE:-pablo}"
|
||||||
HIGHLIGHT_OPTIONS="--replace-tabs=${HIGHLIGHT_TABWIDTH} --style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}"
|
HIGHLIGHT_OPTIONS="--replace-tabs=${HIGHLIGHT_TABWIDTH} --style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}"
|
||||||
PYGMENTIZE_STYLE=${PYGMENTIZE_STYLE:-autumn}
|
PYGMENTIZE_STYLE="${PYGMENTIZE_STYLE:-autumn}"
|
||||||
|
OPENSCAD_IMGSIZE="${RNGR_OPENSCAD_IMGSIZE:-1000,1000}"
|
||||||
|
OPENSCAD_COLORSCHEME="${RNGR_OPENSCAD_COLORSCHEME:-Tomorrow Night}"
|
||||||
|
|
||||||
handle_extension() {
|
handle_extension() {
|
||||||
case "${FILE_EXTENSION_LOWER}" in
|
case "${FILE_EXTENSION_LOWER}" in
|
||||||
|
|
@ -66,8 +67,10 @@ handle_extension() {
|
||||||
## PDF
|
## PDF
|
||||||
pdf)
|
pdf)
|
||||||
## Preview as text conversion
|
## Preview as text conversion
|
||||||
pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - | fmt -w "${PV_WIDTH}" && exit 5
|
pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - | \
|
||||||
mutool draw -F txt -i -- "${FILE_PATH}" 1-10 | fmt -w "${PV_WIDTH}" && exit 5
|
fmt -w "${PV_WIDTH}" && exit 5
|
||||||
|
mutool draw -F txt -i -- "${FILE_PATH}" 1-10 | \
|
||||||
|
fmt -w "${PV_WIDTH}" && exit 5
|
||||||
exiftool "${FILE_PATH}" && exit 5
|
exiftool "${FILE_PATH}" && exit 5
|
||||||
exit 1;;
|
exit 1;;
|
||||||
|
|
||||||
|
|
@ -80,6 +83,15 @@ handle_extension() {
|
||||||
odt|ods|odp|sxw)
|
odt|ods|odp|sxw)
|
||||||
## Preview as text conversion
|
## Preview as text conversion
|
||||||
odt2txt "${FILE_PATH}" && exit 5
|
odt2txt "${FILE_PATH}" && exit 5
|
||||||
|
## Preview as markdown conversion
|
||||||
|
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
|
||||||
|
exit 1;;
|
||||||
|
|
||||||
|
## XLSX
|
||||||
|
xlsx)
|
||||||
|
## Preview as csv conversion
|
||||||
|
## Uses: https://github.com/dilshod/xlsx2csv
|
||||||
|
xlsx2csv -- "${FILE_PATH}" && exit 5
|
||||||
exit 1;;
|
exit 1;;
|
||||||
|
|
||||||
## HTML
|
## HTML
|
||||||
|
|
@ -88,12 +100,21 @@ handle_extension() {
|
||||||
w3m -dump "${FILE_PATH}" && exit 5
|
w3m -dump "${FILE_PATH}" && exit 5
|
||||||
lynx -dump -- "${FILE_PATH}" && exit 5
|
lynx -dump -- "${FILE_PATH}" && exit 5
|
||||||
elinks -dump "${FILE_PATH}" && exit 5
|
elinks -dump "${FILE_PATH}" && exit 5
|
||||||
;; # Continue with next handler on failure
|
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
|
||||||
|
;;
|
||||||
|
|
||||||
## JSON
|
## JSON
|
||||||
json)
|
json|ipynb)
|
||||||
jq --color-output . "${FILE_PATH}" && exit 5
|
jq --color-output . "${FILE_PATH}" && exit 5
|
||||||
python -m json.tool -- "${FILE_PATH}" && exit 5
|
python -m json.tool -- "${FILE_PATH}" && exit 5
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
## Direct Stream Digital/Transfer (DSDIFF) and wavpack aren't detected
|
||||||
|
## by file(1).
|
||||||
|
dff|dsf|wv|wvc)
|
||||||
|
mediainfo "${FILE_PATH}" && exit 5
|
||||||
|
exiftool "${FILE_PATH}" && exit 5
|
||||||
|
;; # Continue with next handler on failure
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,13 +149,15 @@ handle_image() {
|
||||||
convert -- "${FILE_PATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6
|
convert -- "${FILE_PATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## `w3mimgdisplay` will be called for all images (unless overriden
|
## `w3mimgdisplay` will be called for all images (unless overridden
|
||||||
## as above), but might fail for unsupported types.
|
## as above), but might fail for unsupported types.
|
||||||
exit 7;;
|
exit 7;;
|
||||||
|
|
||||||
## Video
|
## Video
|
||||||
video/*)
|
video/*)
|
||||||
# Thumbnail
|
# Get embedded thumbnail
|
||||||
|
ffmpeg -i "${FILE_PATH}" -map 0:v -map -0:V -c copy "${IMAGE_CACHE_PATH}" && exit 6
|
||||||
|
# Get frame 10% into video
|
||||||
ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6
|
ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6
|
||||||
exit 1;;
|
exit 1;;
|
||||||
|
|
||||||
|
|
@ -197,7 +220,8 @@ handle_image() {
|
||||||
# { [ "$rar" ] && fn=$(unrar lb -p- -- "${FILE_PATH}"); } || \
|
# { [ "$rar" ] && fn=$(unrar lb -p- -- "${FILE_PATH}"); } || \
|
||||||
# { [ "$zip" ] && fn=$(zipinfo -1 -- "${FILE_PATH}"); } || return
|
# { [ "$zip" ] && fn=$(zipinfo -1 -- "${FILE_PATH}"); } || return
|
||||||
#
|
#
|
||||||
# fn=$(echo "$fn" | python -c "import sys; import mimetypes as m; \
|
# fn=$(echo "$fn" | python -c "from __future__ import print_function; \
|
||||||
|
# import sys; import mimetypes as m; \
|
||||||
# [ print(l, end='') for l in sys.stdin if \
|
# [ print(l, end='') for l in sys.stdin if \
|
||||||
# (m.guess_type(l[:-1])[0] or '').startswith('image/') ]" |\
|
# (m.guess_type(l[:-1])[0] or '').startswith('image/') ]" |\
|
||||||
# sort -V | head -n 1)
|
# sort -V | head -n 1)
|
||||||
|
|
@ -217,11 +241,63 @@ handle_image() {
|
||||||
# [ "$rar" ] || [ "$zip" ] && rm -- "${IMAGE_CACHE_PATH}"
|
# [ "$rar" ] || [ "$zip" ] && rm -- "${IMAGE_CACHE_PATH}"
|
||||||
# ;;
|
# ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# openscad_image() {
|
||||||
|
# TMPPNG="$(mktemp -t XXXXXX.png)"
|
||||||
|
# openscad --colorscheme="${OPENSCAD_COLORSCHEME}" \
|
||||||
|
# --imgsize="${OPENSCAD_IMGSIZE/x/,}" \
|
||||||
|
# -o "${TMPPNG}" "${1}"
|
||||||
|
# mv "${TMPPNG}" "${IMAGE_CACHE_PATH}"
|
||||||
|
# }
|
||||||
|
|
||||||
|
# case "${FILE_EXTENSION_LOWER}" in
|
||||||
|
# ## 3D models
|
||||||
|
# ## OpenSCAD only supports png image output, and ${IMAGE_CACHE_PATH}
|
||||||
|
# ## is hardcoded as jpeg. So we make a tempfile.png and just
|
||||||
|
# ## move/rename it to jpg. This works because image libraries are
|
||||||
|
# ## smart enough to handle it.
|
||||||
|
# csg|scad)
|
||||||
|
# openscad_image "${FILE_PATH}" && exit 6
|
||||||
|
# ;;
|
||||||
|
# 3mf|amf|dxf|off|stl)
|
||||||
|
# openscad_image <(echo "import(\"${FILE_PATH}\");") && exit 6
|
||||||
|
# ;;
|
||||||
|
# esac
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_mime() {
|
handle_mime() {
|
||||||
local mimetype="${1}"
|
local mimetype="${1}"
|
||||||
case "${mimetype}" in
|
case "${mimetype}" in
|
||||||
|
## RTF and DOC
|
||||||
|
text/rtf|*msword)
|
||||||
|
## Preview as text conversion
|
||||||
|
## note: catdoc does not always work for .doc files
|
||||||
|
## catdoc: http://www.wagner.pp.ru/~vitus/software/catdoc/
|
||||||
|
catdoc -- "${FILE_PATH}" && exit 5
|
||||||
|
exit 1;;
|
||||||
|
|
||||||
|
## DOCX, ePub, FB2 (using markdown)
|
||||||
|
## You might want to remove "|epub" and/or "|fb2" below if you have
|
||||||
|
## uncommented other methods to preview those formats
|
||||||
|
*wordprocessingml.document|*/epub+zip|*/x-fictionbook+xml)
|
||||||
|
## Preview as markdown conversion
|
||||||
|
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
|
||||||
|
exit 1;;
|
||||||
|
|
||||||
|
## E-mails
|
||||||
|
message/rfc822)
|
||||||
|
## Parsing performed by mu: https://github.com/djcb/mu
|
||||||
|
mu view -- "${FILE_PATH}" && exit 5
|
||||||
|
exit 1;;
|
||||||
|
|
||||||
|
## XLS
|
||||||
|
*ms-excel)
|
||||||
|
## Preview as csv conversion
|
||||||
|
## xls2csv comes with catdoc:
|
||||||
|
## http://www.wagner.pp.ru/~vitus/software/catdoc/
|
||||||
|
xls2csv -- "${FILE_PATH}" && exit 5
|
||||||
|
exit 1;;
|
||||||
|
|
||||||
## Text
|
## Text
|
||||||
text/* | */xml)
|
text/* | */xml)
|
||||||
## Syntax highlight
|
## Syntax highlight
|
||||||
|
|
@ -238,6 +314,8 @@ handle_mime() {
|
||||||
env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \
|
env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \
|
||||||
--out-format="${highlight_format}" \
|
--out-format="${highlight_format}" \
|
||||||
--force -- "${FILE_PATH}" && exit 5
|
--force -- "${FILE_PATH}" && exit 5
|
||||||
|
env COLORTERM=8bit bat --color=always --style="plain" \
|
||||||
|
-- "${FILE_PATH}" && exit 5
|
||||||
pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\
|
pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\
|
||||||
-- "${FILE_PATH}" && exit 5
|
-- "${FILE_PATH}" && exit 5
|
||||||
exit 2;;
|
exit 2;;
|
||||||
|
|
@ -261,6 +339,11 @@ handle_mime() {
|
||||||
mediainfo "${FILE_PATH}" && exit 5
|
mediainfo "${FILE_PATH}" && exit 5
|
||||||
exiftool "${FILE_PATH}" && exit 5
|
exiftool "${FILE_PATH}" && exit 5
|
||||||
exit 1;;
|
exit 1;;
|
||||||
|
|
||||||
|
## ELF files (executables and shared objects)
|
||||||
|
application/x-executable | application/x-pie-executable | application/x-sharedlib)
|
||||||
|
readelf -WCa "${FILE_PATH}" && exit 5
|
||||||
|
exit 1;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
26
.profile
26
.profile
|
|
@ -3,7 +3,9 @@ ZDOTDIR=$HOME
|
||||||
|
|
||||||
# display
|
# display
|
||||||
export DEFAULT_USER="hate"
|
export DEFAULT_USER="hate"
|
||||||
|
export VDPAU_DRIVER="va_gl"
|
||||||
export LIBVA_DRIVER_NAME="iHD"
|
export LIBVA_DRIVER_NAME="iHD"
|
||||||
|
export VAAPI_MPEG4_ENABLED=true
|
||||||
|
|
||||||
# Common apps
|
# Common apps
|
||||||
export ZSH=/home/hate/.oh-my-zsh
|
export ZSH=/home/hate/.oh-my-zsh
|
||||||
|
|
@ -14,12 +16,26 @@ export SSH_KEY_PATH="~/.ssh/id_rsa"
|
||||||
export TERMINAL="kitty"
|
export TERMINAL="kitty"
|
||||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||||
export XDG_CONFIG_HOME="$HOME/.config"
|
export XDG_CONFIG_HOME="$HOME/.config"
|
||||||
|
|
||||||
#fzf
|
#fzf
|
||||||
#export FZF_CTRL_R_OPTS='--sort --exact'
|
export FZF_BASE="$HOME/.fzf"
|
||||||
#export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"
|
export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g ""'
|
||||||
#export FZF_DEFAULT_COMMAND='fd --type f --hidden'
|
export FZF_CTRL_R_OPTS="--sort --exact"
|
||||||
#export FZF_DEFAULT_OPTS="--layout=reverse --inline-info"
|
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"
|
||||||
#export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || bat {} || tree -C {}) 2> /dev/null | head -200'"
|
export FZF_DEFAULT_OPTS="
|
||||||
|
--layout=reverse
|
||||||
|
--info=inline
|
||||||
|
--height=80%
|
||||||
|
--multi
|
||||||
|
--preview-window=:hidden
|
||||||
|
--preview '([[ -f {} ]] && (bat --style=numbers --color=always {} || cat {})) || ([[ -d {} ]] && (tree -C {} | less)) || echo {} 2> /dev/null | head -200'
|
||||||
|
--color='hl:148,hl+:154,pointer:032,marker:010,bg+:237,gutter:008'
|
||||||
|
--prompt='∼ ' --pointer='▶' --marker='✓'
|
||||||
|
--bind 'h:toggle-preview'
|
||||||
|
--bind 'ctrl-a:select-all'
|
||||||
|
--bind 'ctrl-y:execute-silent(echo {+} | pbcopy)'
|
||||||
|
--bind 'ctrl-v:execute(code {+})'
|
||||||
|
"
|
||||||
|
|
||||||
# Compilation flags
|
# Compilation flags
|
||||||
export ARCHFLAGS="-arch x86_64"
|
export ARCHFLAGS="-arch x86_64"
|
||||||
|
|
|
||||||
8
.zshenv
8
.zshenv
|
|
@ -12,7 +12,9 @@ export EDITOR=nvim
|
||||||
export BROWSER=/usr/bin/google-chrome-stable
|
export BROWSER=/usr/bin/google-chrome-stable
|
||||||
export GNUPGHOME="~/.gnupg"
|
export GNUPGHOME="~/.gnupg"
|
||||||
export SSH_KEY_PATH="~/.ssh/id_rsa"
|
export SSH_KEY_PATH="~/.ssh/id_rsa"
|
||||||
export TERMINAL="alacritty"
|
export TERMINAL="kitty"
|
||||||
|
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||||
|
export XDG_CONFIG_HOME="$HOME/.config"
|
||||||
|
|
||||||
#fzf
|
#fzf
|
||||||
export FZF_BASE="$HOME/.fzf"
|
export FZF_BASE="$HOME/.fzf"
|
||||||
|
|
@ -24,9 +26,9 @@ export FZF_DEFAULT_OPTS="
|
||||||
--info=inline
|
--info=inline
|
||||||
--height=80%
|
--height=80%
|
||||||
--multi
|
--multi
|
||||||
|
--border
|
||||||
--preview-window=:hidden
|
--preview-window=:hidden
|
||||||
--preview '([[ -f {} ]] && (bat --style=numbers --color=always {} || cat {})) || ([[ -d {} ]] && (tree -C {} | less)) || echo {} 2> /dev/null | head -200'
|
--preview '([[ -f {} ]] && (bat --style=numbers --color=always {} || cat {})) || ([[ -d {} ]] && (tree -C {} | less)) || echo {} 2> /dev/null | head -200'
|
||||||
--color='hl:148,hl+:154,pointer:032,marker:010,bg+:237,gutter:008'
|
|
||||||
--prompt='∼ ' --pointer='▶' --marker='✓'
|
--prompt='∼ ' --pointer='▶' --marker='✓'
|
||||||
--bind 'h:toggle-preview'
|
--bind 'h:toggle-preview'
|
||||||
--bind 'ctrl-a:select-all'
|
--bind 'ctrl-a:select-all'
|
||||||
|
|
@ -48,3 +50,5 @@ export QT_AUTO_SCREEN_SCALE_FACTOR=1
|
||||||
# QGtkStyle
|
# QGtkStyle
|
||||||
export QT_QPA_PLATFORMTHEME=gtk2
|
export QT_QPA_PLATFORMTHEME=gtk2
|
||||||
|
|
||||||
|
# Firefox
|
||||||
|
MOZ_X11_EGL=1
|
||||||
|
|
|
||||||
3
.zshrc
3
.zshrc
|
|
@ -78,6 +78,9 @@ plugins=(
|
||||||
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
|
# fzf colors
|
||||||
|
source ~/.fzf/fzf-base16.conf
|
||||||
|
|
||||||
# My scripts
|
# My scripts
|
||||||
PATH=/home/hate/go/bin:/usr/local/bin:/home/hate/.local/bin:/home/hate/.config/Scripts:$PATH
|
PATH=/home/hate/go/bin:/usr/local/bin:/home/hate/.local/bin:/home/hate/.config/Scripts:$PATH
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue