diff --git a/bin/ranger b/bin/ranger new file mode 100755 index 0000000..bbdc028 --- /dev/null +++ b/bin/ranger @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +python3 ~/prog/ranger/ranger.py diff --git a/ranger/commands.py b/ranger/commands.py index f31fbe0..c776bcd 100644 --- a/ranger/commands.py +++ b/ranger/commands.py @@ -2,13 +2,19 @@ from ranger.api.commands import Command import os from ranger.core.loader import CommandLoader -class paste_as_root(Command): - def execute(self): - if self.fm.do_cut: - self.fm.execute_console('shell sudo mv %c .') - else: - self.fm.execute_console('shell sudo cp -r %c .') +class paste_as_root(Command): + def execute(self): + if self.fm.do_cut: + self.fm.execute_console('shell sudo mv %c .') + else: + self.fm.execute_console('shell sudo cp -r %c .') + + +class toggleVCS(Command): + def execute(self): + self.fm.execute_console("set vcs_aware!") + self.fm.execute_console("reload_cwd") class mkcd(Command): @@ -17,7 +23,6 @@ class mkcd(Command): Creates a directory with the name and enters it. """ - def execute(self): from os.path import join, expanduser, lexists from os import makedirs @@ -34,7 +39,8 @@ class mkcd(Command): for m in re.finditer('[^/]+', dirname): s = m.group(0) - if s == '..' or (s.startswith('.') and not self.fm.settings['show_hidden']): + if s == '..' or (s.startswith('.') + and not self.fm.settings['show_hidden']): self.fm.cd(s) else: ## We force ranger to load content before calling `scout`. @@ -43,6 +49,7 @@ class mkcd(Command): else: self.fm.notify("file/directory exists!", bad=True) + class fzf_select(Command): """ :fzf_select @@ -58,13 +65,17 @@ class fzf_select(Command): import os.path if self.quantifier: # match only directories - command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \ + 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 \ + 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) + + 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')) @@ -74,8 +85,6 @@ class fzf_select(Command): self.fm.select_file(fzf_file) - - class compress(Command): def execute(self): """ Compress marked files to current directory """ @@ -104,7 +113,11 @@ class compress(Command): """ Complete with current folder name """ extension = ['.zip', '.tar.gz', '.rar', '.7z'] - return ['compress ' + os.path.basename(self.fm.thisdir.path) + ext for ext in extension] + return [ + 'compress ' + os.path.basename(self.fm.thisdir.path) + ext + for ext in extension + ] + class extracthere(Command): def execute(self): @@ -130,7 +143,8 @@ class extracthere(Command): if len(copied_files) == 1: descr = "extracting: " + os.path.basename(one_file.path) else: - descr = "extracting files from: " + os.path.basename(one_file.dirname) + 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) diff --git a/ranger/rc.conf b/ranger/rc.conf index cc9ac01..fbab8fa 100644 --- a/ranger/rc.conf +++ b/ranger/rc.conf @@ -347,6 +347,7 @@ map ] move_parent 1 map [ move_parent -1 #map } traverse +map toggleVCS # Open lazygit map shell lazygit @@ -359,6 +360,7 @@ map gD cd ~/Downloads map gfa cd ~/.config/alacritty map gff cd ~/.config map gfr cd ~/.config/ranger +map gfb cd ~/.config/bin map gfn cd ~/.config/nvim map gfm cd ~/.config/mutt map gfz cd ~/.config/zsh @@ -394,7 +396,7 @@ map move to=0 map move to=-1 map move down=1 pages=True map move up=1 pages=True -map move right=1 +#map move right=1 #map console delete map console touch%space diff --git a/zsh/zimrc b/zsh/zimrc index 48659ff..b4fed74 100644 --- a/zsh/zimrc +++ b/zsh/zimrc @@ -14,4 +14,5 @@ zmodule supercrabtree/k zmodule mafredri/zsh-async zmodule hlissner/zsh-autopair zmodule pabloariasal/zfm +zmodule agkozak/zsh-z #zmodule cusxio/delta-prompt