This commit is contained in:
Smirnov Olexandr 2020-12-05 23:27:37 +02:00
parent 0d2b7d6ba3
commit 7cf1432163
50 changed files with 1576 additions and 977 deletions

View file

@ -96,3 +96,5 @@ class extract_to_dirs(Command):
obj = CommandLoader(args=['aunpack'] + make_flags(f.path) + [f.path], descr=descr, read=True)
obj.signal_bind('after', refresh)
self.fm.loader.add(obj)

View file

@ -3,19 +3,25 @@ from ranger.api.commands import Command
class git(Command):
commands = 'init status clone add rm restore commit remote push'.split()
def execute(self):
# empty
if not self.arg(1):
return self.fm.notify("For commands check \"git help\"")
# help
if self.arg(1) == "help":
return self.fm.notify("Not done yet!", bad=True)
# init
if self.arg(1) == self.commands[0]:
subprocess.run(["git", "init", "--quiet"])
return self.fm.notify("Repository initialized successefully")
# status
if self.arg(1) == self.commands[1]:
output = subprocess.check_output(["git", "status"]).decode()
@ -24,6 +30,7 @@ class git(Command):
return self.fm.edit_file('/tmp/gitplug-status')
# clone
if self.arg(1) == self.commands[2]:
if not self.arg(2):
return self.fm.notify("Missing url!", bad=True)
@ -32,6 +39,7 @@ class git(Command):
subprocess.run(["git", "clone", self.arg(2), "--quiet"])
return self.fm.notify("Repository successfully cloned!")
# add
if self.arg(1) == self.commands[3]:
if not self.arg(2):
return self.fm.notify("Missing arguments! Usage :git add <file>", bad=True)
@ -40,6 +48,7 @@ class git(Command):
subprocess.run(["git", "add", self.arg(2)])
return self.fm.notify("Successfully added files to branch!")
#rm
if self.arg(1) == self.commands[4]:
if not self.arg(2):
return self.fm.notify("Missing arguments! Usage :git rm <file>", bad=True)
@ -48,6 +57,7 @@ class git(Command):
subprocess.run(["git", "rm", self.arg(2)])
return self.fm.notify("Successfully removed files from branch!")
# restore
if self.arg(1) == self.commands[5]:
if not self.arg(2):
return self.fm.notify("Missing arguments! Usage :git restore <file>", bad=True)
@ -56,6 +66,7 @@ class git(Command):
subprocess.run(["git", "restore", "--staged", self.arg(2), "--quiet"])
return self.fm.notify("Successfully restored files!")
# commit
if self.arg(1) == self.commands[6]:
if not self.rest(2):
return self.fm.notify("Missing commit text", bad=True)
@ -64,6 +75,7 @@ class git(Command):
subprocess.run(["git", "commit", "-m", self.rest(2), "--quiet"])
return self.fm.notify("Successfully commited!")
# remote
if self.arg(1) == self.commands[7]:
if not self.arg(2):
return self.fm.notify("Missing arguments! Use: git remote add/rm <name> <url>", bad=True)
@ -88,6 +100,7 @@ class git(Command):
subprocess.run(["git", "remote", "rm", self.arg(3)])
return self.fm.notify("Remote successfully removed")
# push
if self.arg(1) == self.commands[8]:
if self.arg(2) == "-u" and self.arg(3) and self.arg(4):
subprocess.run(["git", "push", "--quiet", "-u", self.arg(3), self.arg(4)])

View file

@ -1,6 +1,6 @@
############
### Options
###########
############
### Appearance
set colorscheme solarized
@ -24,36 +24,25 @@ set vcs_msg_length 30
### Preview
set preview_images true
#set preview_images_method w3m
set preview_images_method kitty
set preview_images_method w3m
set w3m_delay 0.02
set w3m_offset 0
set iterm2_font_width 8
set iterm2_font_height 11
set unicode_ellipsis false
set bidi_support false
set show_hidden_bookmarks true
set preview_files true
set preview_directories true
set collapse_preview true
set wrap_plaintext_previews false
set draw_progress_bar_in_status_bar true
set draw_borders none
set dirname_in_tabs false
set mouse_enabled true
set display_size_in_main_column true
set display_size_in_status_bar true
set display_free_space_in_status_bar false
set display_tags_in_all_columns true
set update_title false
set update_tmux_title false
set shorten_title 3
@ -64,47 +53,31 @@ set tilde_in_titlebar trues
set max_history_size 20
set max_console_history_size 50
set save_console_history false
set scroll_offset 4
set flushinput true
set padding_right true
set autosave_bookmarks true
set save_backtick_bookmark true
set autoupdate_cumulative_size false
set show_cursor false
# One of: size, natural, basename, atime, ctime, mtime, type, random
set sort natural
set sort_reverse false
set sort_case_insensitive true
set sort_directories_first true
set sort_unicode false
set xterm_alt_key false
set cd_bookmarks true
set cd_tab_case sensitive
set cd_tab_fuzzy false
set preview_max_size 0
set hint_collapse_threshold 10
set show_selection_in_titlebar true
set idle_delay 2000
set metadata_deep_search false
set clear_filters_on_dir_change false
# Possible values: false, absolute, relative.
set line_numbers false
set relative_current_zero false
set one_indexed false
set save_tabs_on_exit false
set wrap_scroll false
set global_inode_type_filter
@ -115,6 +88,14 @@ set nested_ranger_warning true
#################################
# Command Aliases in the Console
#################################
# "a" key
map a rename_append
map a
map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
map ex extract
map ed extract_to_dirs
map ec compress
@ -227,8 +208,6 @@ map gd cd ~/code
map E edit
map cw console rename%space
map a 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)
map pp paste

View file

@ -1,6 +1,7 @@
#############
### Websites
#############
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
ext x?html?, has firefox, X, flag f = firefox -- "$@"
ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@"
ext x?html?, has chromium, X, flag f = chromium -- "$@"
@ -8,7 +9,6 @@ ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@"
ext x?html?, has surf, X, flag f = surf -- file://"$1"
ext x?html?, has vimprobable, X, flag f = vimprobable -- "$@"
ext x?html?, has vimprobable2, X, flag f = vimprobable2 -- "$@"
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
ext x?html?, has dwb, X, flag f = dwb -- "$@"
ext x?html?, has jumanji, X, flag f = jumanji -- "$@"
ext x?html?, has luakit, X, flag f = luakit -- "$@"
@ -126,7 +126,7 @@ ext cbz, has zathura, X, flag f = zathura -- "$@"
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
mime ^image/svg, has display, X, flag f = display -- "$@"
mime ^image, has pix X, flag f = pix "$@"
mime ^image, has pix X, flag f = pix -- "$@"
mime ^image, has ristretto, X, flag f = ristretto "$@"
mime ^image, has gpicview, X, flag f = gpicview -- "$@"
mime ^image, has gwenview, X, flag f = gwenview -- "$@"