From bc83789790067db6fb6a368208f858ce0e6817b5 Mon Sep 17 00:00:00 2001 From: natemaia Date: Tue, 12 Jun 2018 00:09:45 -0700 Subject: [PATCH] Update --- home/.config/ranger/rc.conf | 465 +++++++++++++++++++++++++++++++++ home/.config/ranger/rifle.conf | 143 ++++++++++ home/.config/ranger/scope.sh | 161 ++++++++++++ home/.zprofile | 12 + 4 files changed, 781 insertions(+) create mode 100644 home/.config/ranger/rc.conf create mode 100644 home/.config/ranger/rifle.conf create mode 100755 home/.config/ranger/scope.sh diff --git a/home/.config/ranger/rc.conf b/home/.config/ranger/rc.conf new file mode 100644 index 00000000..018757ba --- /dev/null +++ b/home/.config/ranger/rc.conf @@ -0,0 +1,465 @@ +# =================================================================== +# == Options +# =================================================================== +set viewmode miller +set column_ratios 1,2,4 + +set scroll_offset 8 +set show_cursor false +set mouse_enabled true +set confirm_on_delete always +set colorscheme default + +set shorten_title 4 +set update_title true +set update_tmux_title true +set tilde_in_titlebar true +set hostname_in_titlebar true +set max_history_size 20 +set max_console_history_size 50 +set save_console_history true + +set open_all_images false +set preview_images false +set use_preview_script true +set preview_images_method w3m +set preview_script ~/.config/ranger/scope.sh + +set automatically_count_files true +set preview_max_size 0 +set preview_files true +set preview_directories true +set collapse_preview true + +set unicode_ellipsis true +set padding_right false +set draw_borders true +set dirname_in_tabs true +set status_bar_on_top false +set draw_progress_bar_in_status_bar true + +set display_size_in_main_column true +set display_size_in_status_bar false +set display_tags_in_all_columns true +set flushinput true +set autosave_bookmarks true +set autoupdate_cumulative_size false + +# Enable this if key combinations with the Alt Key don't work for you. (Especially on xterm) +set xterm_alt_key false + +set sort natural +set sort_reverse false +set sort_unicode false +set sort_case_insensitive true +set sort_directories_first true + +set vcs_aware true +set vcs_backend_git enabled +set vcs_backend_hg disabled +set vcs_backend_bzr disabled +set vcs_backend_svn disabled + +set cd_bookmarks true +set cd_tab_case sensitive +set cd_tab_fuzzy true +set show_selection_in_titlebar true + +set idle_delay 2000 +set metadata_deep_search false +set clear_filters_on_dir_change true +set line_numbers false +set one_indexed false +set save_tabs_on_exit true +set wrap_scroll true +set global_inode_type_filter +set show_hidden true +set show_hidden_bookmarks true +set hidden_filter ^\.|\.(?:pyc|pyo|bak|old|swp)$|^lost\+found$|^__(py)?cache__$ + +# =================================================================== +# == 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 q quit +alias q! quit! +alias qa quitall +alias qa! quitall! +alias qall quitall +alias qall! quitall! +alias setl setlocal + +alias filter scout -prt +alias find scout -aeit +alias mark scout -mr +alias unmark scout -Mr +alias search scout -rs +alias search_inc scout -rts +alias travel scout -aefklst + +# =================================================================== +# == Define keys for the browser +# =================================================================== + +# Basic +map Q quitall +map q quit +copymap q ZZ ZQ + +map R reload_cwd +map F set freeze_files! +map reset +map redraw_window +map abort +map change_mode normal +map ~ set viewmode! + +map i display_file +map ? help +map W display_log +map w taskview_open +map S shell $SHELL + +map : console +map ; console +map ! console shell%space +map @ console -p6 shell %%s +map # console shell -p%space +map s console shell%space +map f console find%space +map r chain draw_possible_programs; console open_with%%space +map cd console cd%space + +# Tagging / Marking +map t tag_toggle +map ut tag_remove +map " tag_toggle tag=%any +map mark_files toggle=True +map v toggle_visual_mode +map uv toggle_visual_mode reverse=True +map V mark_files all=True toggle=True +map uV mark_files all=True val=False + +# For the nostalgics: Midnight Commander bindings +map help +map rename_append +map display_file +map edit +map copy +map cut +map console mkdir%space +map console delete +map exit + +# In case you work on a keyboard with dvorak layout +map move up=1 +map move down=1 +map move left=1 +map move right=1 +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 console delete +map console touch%space + +# VIM like +copymap k +copymap j +copymap h +copymap l +copymap gg +copymap G +copymap +copymap +map J move down=0.5 pages=True +map K move up=0.5 pages=True + +# Jumping around +map L history_go 1 +map H history_go -1 +map ] move_parent 1 +map [ move_parent -1 +map } traverse +map ) jump_non + +map E edit + +# Better file renaming +map a rename_append +map cw eval fm.execute_console("bulkrename") if fm.thisdir.marked_items else fm.execute_console("rename_append") +map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%")) +map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7) + +# Open file in a new tmux pane +map eh eval import shlex; fm.run("tmux splitw -h rifle " + shlex.quote(fm.thisfile.basename)) +map ev eval import shlex; fm.run("tmux splitw -v rifle " + shlex.quote(fm.thisfile.basename)) +map ew eval import shlex; fm.run("tmux new-window rifle " + shlex.quote(fm.thisfile.basename)) + +map pp paste +map phl paste_hardlink +map pP paste append=True +map pr shell sudo cp %c %d +map po paste overwrite=True +map pht paste_hardlinked_subtree +map pL paste_symlink relative=True +map pl paste_symlink relative=False +map pO paste overwrite=True append=True + +map dd cut +map ud uncut +map da cut mode=add +map dr cut mode=remove +map dt cut mode=toggle +map dc get_cumulative_size +map dD console delete +map DD shell rm -rf %s + +# External Programs +map E edit +map du shell -p du --max-depth=1 -h --apparent-size +map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh +map yp yank path +map yd yank dir +map yn yank name + +map yy copy +map uy uncut +map ya copy mode=add +map yr copy mode=remove +map yt copy mode=toggle +map yd shell -f echo -n %d | xsel -i; xsel -o | xsel -i -b +map yn shell -f echo -n %f | xsel -i; xsel -o | xsel -i -b +map yp shell -f echo -n %d/%f | xsel -i; xsel -o | xsel -i -b + +# Searching +map n search_next +map / console search%space +map f console scout -ftsea%space + +# Sorting +map or set sort_reverse! +map os chain set sort=size; set sort_reverse=False +map ob chain set sort=basename; set sort_reverse=False +map on chain set sort=natural; set sort_reverse=False +map ot chain set sort=type; set sort_reverse=False +map oe chain set sort=extension; set sort_reverse=False + +# Settings +map zi set preview_images! +map zp set preview_files! +map zP set preview_directories! +map zv set use_preview_script! +map zd set sort_directories_first! +map zc set collapse_preview! +map zI set flushinput! +map zm set mouse_enabled! +map zh set show_hidden! +map zf console filter%space + +# Bookmarks +map ` enter_bookmark %any +map ' enter_bookmark %any +map \ set_bookmark %any +map u\ unset_bookmark %any +map \ draw_bookmarks +copymap \ u\ ` ' + +# Tabs +map tq tab_close +map tr tab_restore +map tab_move 1 +map tab_move -1 +map tab_move 1 +map tab_move -1 +map tab_move 1 +map tab_move -1 +map tab_new +map tab_close +map tn eval fm.tab_new('%d') +map uq tab_restore +map tab_open 1 +map tab_open 2 +map tab_open 3 +map tab_open 4 +map tab_open 5 +map tab_open 6 +map tab_open 7 +map tab_open 8 +map tab_open 9 + +# 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 +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 +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 -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 -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 -{0} shell -f chmod u-{0} %s".format(arg)) + +# =================================================================== +# == Define keys for the console +# =================================================================== + +# Basic +cmap redraw_window +cmap eval fm.ui.console.tab() +cmap eval fm.ui.console.close() +cmap eval fm.ui.console.execute() +cmap eval fm.ui.console.tab(-1) +copycmap +copycmap + +# Move around +cmap eval fm.ui.console.move(left=1) +cmap eval fm.ui.console.move(right=1) +cmap eval fm.ui.console.history_move(-1) +cmap eval fm.ui.console.history_move(1) +cmap eval fm.ui.console.move_word(left=1) +cmap eval fm.ui.console.move_word(right=1) +cmap eval fm.ui.console.move(right=0, absolute=True) +cmap eval fm.ui.console.move(right=-1, absolute=True) + +# Line Editing +cmap eval fm.ui.console.paste() +cmap eval fm.ui.console.delete(0) +cmap eval fm.ui.console.delete_word() +cmap eval fm.ui.console.delete_rest(1) +cmap eval fm.ui.console.delete_rest(-1) +cmap eval fm.ui.console.delete(-1) +cmap eval fm.ui.console.delete_word(backward=False) + +cmap false +copycmap + +# =================================================================== +# == Pager Keybindings +# =================================================================== + +# Movement +pmap pager_move up=1 +pmap pager_move to=0 +pmap pager_move to=-1 +pmap pager_move down=1 +pmap pager_move left=4 +pmap pager_move right=4 +pmap pager_move up=0.5 pages=True +pmap pager_move down=0.5 pages=True +pmap pager_move up=1.0 pages=True +pmap pager_move down=1.0 pages=True + +copypmap G +copypmap d +copypmap u +copypmap g +copypmap h +copypmap l +copypmap k +copypmap j +copypmap p b +copypmap n f + +# Basic +pmap E edit_file +pmap pager_close +pmap redraw_window +copypmap q Q i + +# =================================================================== +# == Taskview Keybindings +# =================================================================== + +# Movement +tmap taskview_move up=1 +tmap taskview_move down=1 +tmap taskview_move to=0 +tmap taskview_move to=-1 +tmap taskview_move down=1.0 pages=True +tmap taskview_move up=1.0 pages=True +tmap taskview_move down=0.5 pages=True +tmap taskview_move up=0.5 pages=True + +copytmap k +copytmap j +copytmap g +copytmap G +copytmap u +copytmap n f +copytmap p b + +# Changing priority and deleting tasks +tmap J eval -q fm.ui.taskview.task_move(-1) +tmap K eval -q fm.ui.taskview.task_move(0) +tmap dd eval -q fm.ui.taskview.task_remove() +tmap eval -q fm.ui.taskview.task_move(-1) +tmap eval -q fm.ui.taskview.task_move(0) +tmap eval -q fm.ui.taskview.task_remove() + +# Basic +tmap redraw_window +tmap taskview_close +copytmap q Q w + +# =================================================================== +# == Additional Keybinds +# =================================================================== + +## New +map Nf console touch%space +map Nd console mkdir%space + +## Set background +map sZ shell nitrogen --set-zoom-fill --head=0 --save %f +map sz shell nitrogen --set-zoom-fill --head=1 --save %f +map sS shell nitrogen --set-scaled --head=0 --save %f +map ss shell nitrogen --set-scaled --head=1 --save %f +map sF shell nitrogen --set-zoom-fill --head=-1 --save %f +map sf shell nitrogen --set-scaled --head=-1 --save %f + +## Go / cd +map gh cd ~ +map g/ cd / +map gE cd /etc +map gu cd /usr +map gb cd ~/bin +map gm cd ~/Music +map g. cd ~/.config +map gp cd ~/Pictures +map gd cd ~/Downloads +map gr cd ~/.config/ranger +map g? cd /usr/share/doc/ranger + +## Move +map mD shell mv %s ~/Documents/ +map md shell mv %s ~/Downloads/ +map mp shell mv %s ~/Pictures/ +map m. shell mv %s ~/.config/ +map mv shell mv %s ~/Videos/ +map mm shell mv %s ~/Music/ +map mb shell mv %s ~/bin/ +map mh shell mv %s ~/ + +## Copy +map YD shell cp -r %s ~/Documents/ +map Yd shell cp -r %s ~/Downloads/ +map Yp shell cp -r %s ~/Pictures/ +map Y. shell cp -r %s ~/.config/ +map Yv shell cp -r %s ~/Videos/ +map Ym shell cp -r %s ~/Music/ +map Yb shell cp -r %s ~/bin/ +map Yh shell cp -r %s ~/ diff --git a/home/.config/ranger/rifle.conf b/home/.config/ranger/rifle.conf new file mode 100644 index 00000000..5ef91563 --- /dev/null +++ b/home/.config/ranger/rifle.conf @@ -0,0 +1,143 @@ +# vim: ft=cfg +# +# This is the configuration file of "rifle", ranger's file executor/opener. +# Each line consists of conditions and a command. For each line the conditions +# are checked and if they are met, the respective command is run. +# +# Syntax: +# , , ... = command +# +# The command can contain these environment variables: +# $1-$9 | The n-th selected file +# $@ | All selected files +# +# If you use the special command "ask", rifle will ask you what program to run. +# +# Prefixing a condition with "!" will negate its result. +# These conditions are currently supported: +# match | The regexp matches $1 +# ext | The regexp matches the extension of $1 +# mime | The regexp matches the mime type of $1 +# name | The regexp matches the basename of $1 +# path | The regexp matches the absolute path of $1 +# has | The program is installed (i.e. located in $PATH) +# env | The environment variable "variable" is non-empty +# file | $1 is a file +# directory | $1 is a directory +# number | change the number of this command to n +# terminal | stdin, stderr and stdout are connected to a terminal +# X | $DISPLAY is not empty (i.e. Xorg runs) +# +# There are also pseudo-conditions which have a "side effect": +# flag | Change how the program is run. See below. +# label