mirror of
https://github.com/olexsmir/dotfiles.git
synced 2026-01-15 16:51:34 +02:00
Add tint2 config, update vscode theme, delete ranger plugins
This commit is contained in:
parent
fdf04c61bc
commit
d50fc737a8
6 changed files with 834 additions and 536 deletions
|
|
@ -1,100 +0,0 @@
|
|||
from ranger.api.commands import *
|
||||
from ranger.core.loader import CommandLoader
|
||||
import os
|
||||
|
||||
|
||||
class compress(Command):
|
||||
def execute(self):
|
||||
cwd = self.fm.thisdir
|
||||
marked_files = cwd.get_selection()
|
||||
|
||||
if not marked_files: return
|
||||
|
||||
def refresh(_):
|
||||
cwd = self.fm.get_directory(original_path)
|
||||
cwd.load_content()
|
||||
|
||||
original_path = cwd.path
|
||||
|
||||
parts = self.line.strip().split()
|
||||
if len(parts) > 1: au_flags = [' '.join(parts[1:])]
|
||||
else: au_flags = [os.path.basename(self.fm.thisdir.path) + '.zip']
|
||||
|
||||
files_num = len(marked_files)
|
||||
files_num_str = str(files_num) + ' objects' if files_num > 1 else '1 object'
|
||||
descr = "Compressing " + files_num_str + " -> " + os.path.basename(au_flags[0])
|
||||
|
||||
obj = CommandLoader(args=['apack'] + au_flags + [os.path.relpath(f.path, cwd.path) for f in marked_files], descr=descr, read=True)
|
||||
|
||||
obj.signal_bind('after', refresh)
|
||||
self.fm.loader.add(obj)
|
||||
|
||||
def tab(self, tabnum):
|
||||
extension = ['.zip', '.tar.gz', '.rar', '.7z']
|
||||
return ['compress ' + os.path.basename(self.fm.thisdir.path) + ext for ext in extension]
|
||||
|
||||
|
||||
class extract(Command):
|
||||
def execute(self):
|
||||
cwd = self.fm.thisdir
|
||||
copied_files = cwd.get_selection()
|
||||
|
||||
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
|
||||
|
||||
line_args = self.line.split()[1:]
|
||||
if line_args:
|
||||
extraction_dir = os.path.join(cwd.path, "".join(line_args))
|
||||
os.makedirs(extraction_dir, exist_ok=True)
|
||||
flags = ['-X', extraction_dir]
|
||||
flags += ['-e']
|
||||
else:
|
||||
flags = ['-X', cwd.path]
|
||||
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'] + flags + [f.path for f in copied_files], descr=descr, read=True)
|
||||
|
||||
obj.signal_bind('after', refresh)
|
||||
self.fm.loader.add(obj)
|
||||
|
||||
class extract_to_dirs(Command):
|
||||
def execute(self):
|
||||
cwd = self.fm.thisdir
|
||||
original_path = cwd.path
|
||||
copied_files = cwd.get_selection()
|
||||
|
||||
if not copied_files: return
|
||||
|
||||
def refresh(_):
|
||||
cwd = self.fm.get_directory(original_path)
|
||||
cwd.load_content()
|
||||
|
||||
def make_flags(fn):
|
||||
flags = ['-D']
|
||||
return flags
|
||||
|
||||
one_file = copied_files[0]
|
||||
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)
|
||||
|
||||
for f in copied_files:
|
||||
obj = CommandLoader(args=['aunpack'] + make_flags(f.path) + [f.path], descr=descr, read=True)
|
||||
obj.signal_bind('after', refresh)
|
||||
self.fm.loader.add(obj)
|
||||
|
||||
|
||||
|
|
@ -1,323 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
import ranger.api
|
||||
from ranger.core.linemode import LinemodeBase
|
||||
from .devicons import *
|
||||
import re
|
||||
import os
|
||||
|
||||
|
||||
@ranger.api.register_linemode
|
||||
class DevIconsLinemode(LinemodeBase):
|
||||
name = "devicons"
|
||||
uses_metadata = False
|
||||
def filetitle(self, file, metadata):
|
||||
return devicon(file) + ' ' + file.relative_path
|
||||
|
||||
@ranger.api.register_linemode
|
||||
class DevIconsLinemodeFile(LinemodeBase):
|
||||
name = "filename"
|
||||
def filetitle(self, file, metadata):
|
||||
return devicon(file) + ' ' + file.relative_path
|
||||
|
||||
file_node_extensions = {
|
||||
'7z' : '',
|
||||
'a' : '',
|
||||
'ai' : '',
|
||||
'apk' : '',
|
||||
'asm' : '',
|
||||
'asp' : '',
|
||||
'aup' : '',
|
||||
'avi' : '',
|
||||
'awk' : '',
|
||||
'bash' : '',
|
||||
'bat' : '',
|
||||
'bmp' : '',
|
||||
'bz2' : '',
|
||||
'c' : '',
|
||||
'c++' : '',
|
||||
'cab' : '',
|
||||
'cbr' : '',
|
||||
'cbz' : '',
|
||||
'cc' : '',
|
||||
'class' : '',
|
||||
'clj' : '',
|
||||
'cljc' : '',
|
||||
'cljs' : '',
|
||||
'cmake' : '',
|
||||
'coffee' : '',
|
||||
'conf' : '',
|
||||
'cp' : '',
|
||||
'cpio' : '',
|
||||
'cpp' : '',
|
||||
'cs' : '',
|
||||
'csh' : '',
|
||||
'css' : '',
|
||||
'cue' : '',
|
||||
'cvs' : '',
|
||||
'cxx' : '',
|
||||
'd' : '',
|
||||
'dart' : '',
|
||||
'db' : '',
|
||||
'deb' : '',
|
||||
'diff' : '',
|
||||
'dll' : '',
|
||||
'doc' : '',
|
||||
'docx' : '',
|
||||
'dump' : '',
|
||||
'edn' : '',
|
||||
'eex' : '',
|
||||
'efi' : '',
|
||||
'ejs' : '',
|
||||
'elf' : '',
|
||||
'elm' : '',
|
||||
'epub' : '',
|
||||
'erl' : '',
|
||||
'ex' : '',
|
||||
'exe' : '',
|
||||
'exs' : '',
|
||||
'f#' : '',
|
||||
'fifo' : '|',
|
||||
'fish' : '',
|
||||
'flac' : '',
|
||||
'flv' : '',
|
||||
'fs' : '',
|
||||
'fsi' : '',
|
||||
'fsscript' : '',
|
||||
'fsx' : '',
|
||||
'gem' : '',
|
||||
'gemspec' : '',
|
||||
'gif' : '',
|
||||
'go' : '',
|
||||
'gz' : '',
|
||||
'gzip' : '',
|
||||
'h' : '',
|
||||
'haml' : '',
|
||||
'hbs' : '',
|
||||
'hh' : '',
|
||||
'hpp' : '',
|
||||
'hrl' : '',
|
||||
'hs' : '',
|
||||
'htaccess' : '',
|
||||
'htm' : '',
|
||||
'html' : '',
|
||||
'htpasswd' : '',
|
||||
'hxx' : '',
|
||||
'ico' : '',
|
||||
'img' : '',
|
||||
'ini' : '',
|
||||
'iso' : '',
|
||||
'jar' : '',
|
||||
'java' : '',
|
||||
'jl' : '',
|
||||
'jpeg' : '',
|
||||
'jpg' : '',
|
||||
'js' : '',
|
||||
'json' : '',
|
||||
'jsx' : '',
|
||||
'key' : '',
|
||||
'ksh' : '',
|
||||
'leex' : '',
|
||||
'less' : '',
|
||||
'lha' : '',
|
||||
'lhs' : '',
|
||||
'log' : '',
|
||||
'lua' : '',
|
||||
'lzh' : '',
|
||||
'lzma' : '',
|
||||
'm4a' : '',
|
||||
'm4v' : '',
|
||||
'markdown' : '',
|
||||
'md' : '',
|
||||
'mdx' : '',
|
||||
'mjs' : '',
|
||||
'mkv' : '',
|
||||
'ml' : 'λ',
|
||||
'mli' : 'λ',
|
||||
'mov' : '',
|
||||
'mp3' : '',
|
||||
'mp4' : '',
|
||||
'mpeg' : '',
|
||||
'mpg' : '',
|
||||
'msi' : '',
|
||||
'mustache' : '',
|
||||
'nix' : '',
|
||||
'o' : '',
|
||||
'ogg' : '',
|
||||
'pdf' : '',
|
||||
'php' : '',
|
||||
'pl' : '',
|
||||
'pm' : '',
|
||||
'png' : '',
|
||||
'pp' : '',
|
||||
'ppt' : '',
|
||||
'pptx' : '',
|
||||
'ps1' : '',
|
||||
'psb' : '',
|
||||
'psd' : '',
|
||||
'pub' : '',
|
||||
'py' : '',
|
||||
'pyc' : '',
|
||||
'pyd' : '',
|
||||
'pyo' : '',
|
||||
'r' : 'ﳒ',
|
||||
'rake' : '',
|
||||
'rar' : '',
|
||||
'rb' : '',
|
||||
'rc' : '',
|
||||
'rlib' : '',
|
||||
'rmd' : '',
|
||||
'rom' : '',
|
||||
'rpm' : '',
|
||||
'rproj' : '鉶',
|
||||
'rs' : '',
|
||||
'rss' : '',
|
||||
'rtf' : '',
|
||||
's' : '',
|
||||
'sass' : '',
|
||||
'scala' : '',
|
||||
'scss' : '',
|
||||
'sh' : '',
|
||||
'slim' : '',
|
||||
'sln' : '',
|
||||
'so' : '',
|
||||
'sql' : '',
|
||||
'styl' : '',
|
||||
'suo' : '',
|
||||
'swift' : '',
|
||||
't' : '',
|
||||
'tar' : '',
|
||||
'tex' : 'ﭨ',
|
||||
'tgz' : '',
|
||||
'toml' : '',
|
||||
'ts' : '',
|
||||
'tsx' : '',
|
||||
'twig' : '',
|
||||
'vim' : '',
|
||||
'vimrc' : '',
|
||||
'vue' : '﵂',
|
||||
'wav' : '',
|
||||
'webm' : '',
|
||||
'webmanifest' : '',
|
||||
'webp' : '',
|
||||
'xbps' : '',
|
||||
'xcplayground' : '',
|
||||
'xhtml' : '',
|
||||
'xls' : '',
|
||||
'xlsx' : '',
|
||||
'xml' : '',
|
||||
'xul' : '',
|
||||
'xz' : '',
|
||||
'yaml' : '',
|
||||
'yml' : '',
|
||||
'zip' : '',
|
||||
'zsh' : '',
|
||||
}
|
||||
|
||||
dir_node_exact_matches = {
|
||||
'.git' : '',
|
||||
'Desktop' : '',
|
||||
'Documents' : '',
|
||||
'Downloads' : '',
|
||||
'Dotfiles' : '',
|
||||
'Dropbox' : '',
|
||||
'Music' : '',
|
||||
'Pictures' : '',
|
||||
'Public' : '',
|
||||
'Templates' : '',
|
||||
'Videos' : '',
|
||||
}
|
||||
|
||||
file_node_exact_matches = {
|
||||
'.bash_aliases' : '',
|
||||
'.bash_history' : '',
|
||||
'.bash_logout' : '',
|
||||
'.bash_profile' : '',
|
||||
'.bashprofile' : '',
|
||||
'.bashrc' : '',
|
||||
'.dmrc' : '',
|
||||
'.DS_Store' : '',
|
||||
'.fasd' : '',
|
||||
'.fehbg' : '',
|
||||
'.gitattributes' : '',
|
||||
'.gitconfig' : '',
|
||||
'.gitignore' : '',
|
||||
'.gitlab-ci.yml' : '',
|
||||
'.gvimrc' : '',
|
||||
'.inputrc' : '',
|
||||
'.jack-settings' : '',
|
||||
'.mime.types' : '',
|
||||
'.ncmpcpp' : '',
|
||||
'.nvidia-settings-rc' : '',
|
||||
'.pam_environment' : '',
|
||||
'.profile' : '',
|
||||
'.recently-used' : '',
|
||||
'.selected_editor' : '',
|
||||
'.vim' : '',
|
||||
'.viminfo' : '',
|
||||
'.vimrc' : '',
|
||||
'.Xauthority' : '',
|
||||
'.Xdefaults' : '',
|
||||
'.xinitrc' : '',
|
||||
'.xinputrc' : '',
|
||||
'.Xresources' : '',
|
||||
'.zshrc' : '',
|
||||
'_gvimrc' : '',
|
||||
'_vimrc' : '',
|
||||
'a.out' : '',
|
||||
'authorized_keys' : '',
|
||||
'bspwmrc' : '',
|
||||
'cmakelists.txt' : '',
|
||||
'config' : '',
|
||||
'config.ac' : '',
|
||||
'config.m4' : '',
|
||||
'config.mk' : '',
|
||||
'config.ru' : '',
|
||||
'configure' : '',
|
||||
'docker-compose.yml' : '',
|
||||
'dockerfile' : '',
|
||||
'Dockerfile' : '',
|
||||
'dropbox' : '',
|
||||
'exact-match-case-sensitive-1.txt' : 'X1',
|
||||
'exact-match-case-sensitive-2' : 'X2',
|
||||
'favicon.ico' : '',
|
||||
'gemfile' : '',
|
||||
'gruntfile.coffee' : '',
|
||||
'gruntfile.js' : '',
|
||||
'gruntfile.ls' : '',
|
||||
'gulpfile.coffee' : '',
|
||||
'gulpfile.js' : '',
|
||||
'gulpfile.ls' : '',
|
||||
'ini' : '',
|
||||
'known_hosts' : '',
|
||||
'ledger' : '',
|
||||
'license' : '',
|
||||
'LICENSE' : '',
|
||||
'LICENSE.md' : '',
|
||||
'LICENSE.txt' : '',
|
||||
'Makefile' : '',
|
||||
'makefile' : '',
|
||||
'Makefile.ac' : '',
|
||||
'Makefile.in' : '',
|
||||
'mimeapps.list' : '',
|
||||
'mix.lock' : '',
|
||||
'node_modules' : '',
|
||||
'package-lock.json' : '',
|
||||
'package.json' : '',
|
||||
'playlists' : '',
|
||||
'procfile' : '',
|
||||
'Rakefile' : '',
|
||||
'rakefile' : '',
|
||||
'react.jsx' : '',
|
||||
'README' : '',
|
||||
'README.markdown' : '',
|
||||
'README.md' : '',
|
||||
'README.rst' : '',
|
||||
'README.txt' : '',
|
||||
'sxhkdrc' : '',
|
||||
'user-dirs.dirs' : '',
|
||||
'webpack.config.js' : '',
|
||||
}
|
||||
|
||||
def devicon(file):
|
||||
if file.is_directory: return dir_node_exact_matches.get(file.relative_path, '')
|
||||
return file_node_exact_matches.get(os.path.basename(file.relative_path), file_node_extensions.get(file.extension, ''))
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
import subprocess
|
||||
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()
|
||||
|
||||
with open('/tmp/gitplug-status', 'w') as out:
|
||||
out.write(output)
|
||||
|
||||
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)
|
||||
|
||||
if self.arg(2):
|
||||
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)
|
||||
|
||||
if self.arg(2):
|
||||
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)
|
||||
|
||||
if self.arg(2):
|
||||
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)
|
||||
|
||||
if self.arg(2):
|
||||
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)
|
||||
|
||||
if self.rest(2):
|
||||
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)
|
||||
|
||||
if self.arg(2) == "add":
|
||||
if not self.arg(3):
|
||||
return self.fm.notify("Missing name and url!", bad=True)
|
||||
|
||||
if self.arg(3):
|
||||
if not self.arg(4):
|
||||
return self.fm.notify("Missing url!", bad=True)
|
||||
|
||||
if self.arg(4):
|
||||
subprocess.run(["git", "remote", "add", self.arg(3), self.arg(4)])
|
||||
return self.fm.notify("Remote successfully added!")
|
||||
|
||||
if self.arg(2) == "rm":
|
||||
if not self.arg(3):
|
||||
return self.fm.notify("Missing name!", bad=True)
|
||||
|
||||
if self.arg(3):
|
||||
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)])
|
||||
return self.fm.notify("Repository successfully pushed")
|
||||
|
||||
if not self.arg(2):
|
||||
subprocess.run(["git", "push", "--quiet"])
|
||||
return self.fm.notify("Repository successfully pushed")
|
||||
Loading…
Add table
Add a link
Reference in a new issue