Initial commit (extract fro private repo)
commit
61a0ab4308
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,125 @@
|
|||
#
|
||||
# ~/.bashrc
|
||||
#
|
||||
|
||||
[[ $- != *i* ]] && return
|
||||
|
||||
prompt_git() {
|
||||
local s='';
|
||||
local branchName='';
|
||||
|
||||
# Check if the current directory is in a Git repository.
|
||||
if [ $(git rev-parse --is-inside-work-tree &>/dev/null; echo "${?}") == '0' ]; then
|
||||
|
||||
# check if the current directory is in .git before running git checks
|
||||
if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == 'false' ]; then
|
||||
|
||||
# Ensure the index is up to date.
|
||||
git update-index --really-refresh -q &>/dev/null;
|
||||
|
||||
# Check for uncommitted changes in the index.
|
||||
if ! $(git diff --quiet --ignore-submodules --cached); then
|
||||
s+='+';
|
||||
fi;
|
||||
|
||||
# Check for unstaged changes.
|
||||
if ! $(git diff-files --quiet --ignore-submodules --); then
|
||||
s+='!';
|
||||
fi;
|
||||
|
||||
# Check for untracked files.
|
||||
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
|
||||
s+='?';
|
||||
fi;
|
||||
|
||||
# Check for stashed files.
|
||||
if $(git rev-parse --verify refs/stash &>/dev/null); then
|
||||
s+='$';
|
||||
fi;
|
||||
|
||||
fi;
|
||||
|
||||
# Get the short symbolic ref.
|
||||
# If HEAD isn’t a symbolic ref, get the short SHA for the latest commit
|
||||
# Otherwise, just give up.
|
||||
branchName="$(git symbolic-ref --quiet --short HEAD 2> /dev/null || \
|
||||
git rev-parse --short HEAD 2> /dev/null || \
|
||||
echo '(unknown)')";
|
||||
|
||||
[ -n "${s}" ] && s=" [${s}]";
|
||||
|
||||
echo -e " ${1}${branchName}${2}${s}";
|
||||
else
|
||||
return;
|
||||
fi;
|
||||
}
|
||||
|
||||
hostname_color() {
|
||||
case $(hostname) in
|
||||
blue*)
|
||||
echo "34"
|
||||
;;
|
||||
green*)
|
||||
echo "32"
|
||||
;;
|
||||
pink*)
|
||||
echo "35"
|
||||
;;
|
||||
red*)
|
||||
echo "31"
|
||||
;;
|
||||
*)
|
||||
echo "37"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
status_color() {
|
||||
if [[ ${EUID} == 0 ]] ; then
|
||||
echo "31"
|
||||
else
|
||||
if [[ $(whoami) == "sheychen" ]] ; then
|
||||
if [[ $(sudo -n uptime 2>&1|grep "load"|wc -l) -gt 0 ]] ; then
|
||||
echo "33"
|
||||
else
|
||||
echo "32"
|
||||
fi
|
||||
else
|
||||
echo "35"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
parse_user() {
|
||||
if [[ ${EUID} != 0 ]] ; then
|
||||
if [[ $(whoami) != "sheychen" ]] ; then
|
||||
echo "$(whoami)@"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function spwd {
|
||||
echo $PWD | sed "s:${HOME}:~:" | sed "s:/\(.\)[^/]*:/\1:g" | sed "s:/[^/]*$:/$(basename "$PWD"):"
|
||||
}
|
||||
|
||||
PS1='\[\033[01;$(status_color)m\][\[\033[01;37m\]$(parse_user)\[\033[01;$(hostname_color)m\]\H\[\033[01;37m\] $(spwd)$(prompt_git)\[\033[01;$(status_color)m\]]\[\033[00m\] '
|
||||
|
||||
type shopt &> /dev/null && shopt -s histappend;
|
||||
shopt -s cmdhist
|
||||
shopt -s checkwinsize
|
||||
shopt -s autocd
|
||||
bind Space:magic-space
|
||||
bind '"\eh": "\C-a\eb\ed\C-y\e#man \C-y\C-m\C-p\C-p\C-a\C-d\C-e"'
|
||||
unset HISTFILE
|
||||
|
||||
cl() {
|
||||
local dir="$1"
|
||||
local dir="${dir:=$HOME}"
|
||||
if [[ -d "$dir" ]]; then
|
||||
cd "$dir" >/dev/null; ls
|
||||
else
|
||||
echo "bash: cl: $dir: Directory not found"
|
||||
fi
|
||||
}
|
||||
|
||||
[[ -f ~/.shrc ]] && . ~/.shrc
|
|
@ -0,0 +1,2 @@
|
|||
// Placez vos combinaisons de touches dans ce fichier pour remplacer les valeurs par défaut
|
||||
[]
|
|
@ -0,0 +1,193 @@
|
|||
{
|
||||
"editor.scrollBeyondLastLine": false,
|
||||
"editor.minimap.enabled": true,
|
||||
"editor.formatOnType": true,
|
||||
"editor.formatOnPaste": true,
|
||||
"editor.emptySelectionClipboard": false,
|
||||
"workbench.iconTheme": "vs-nomo-dark",
|
||||
"telemetry.enableTelemetry": false,
|
||||
"telemetry.enableCrashReporter": false,
|
||||
"editor.dragAndDrop": true,
|
||||
"explorer.enableDragAndDrop": true,
|
||||
"window.zoomLevel": 0,
|
||||
"guides.active.color.dark": "rgba(60, 60, 60, 0.75)",
|
||||
"composer.executablePath": "/usr/bin/composer",
|
||||
"editor.wordWrap": "off",
|
||||
"git.autorefresh": false,
|
||||
"git.autofetch": false,
|
||||
"editor.renderIndentGuides": false,
|
||||
"code-runner.runInTerminal": true,
|
||||
"workbench.startupEditor": "newUntitledFile",
|
||||
"python.formatting.provider": "yapf",
|
||||
"explorer.confirmDragAndDrop": false,
|
||||
"workbench.statusBar.visible": true,
|
||||
"code-runner.executorMap": {
|
||||
"javascript": "node",
|
||||
"php": "php",
|
||||
"python": "python",
|
||||
"csharp": "dotnet run",
|
||||
"typescript": "ts-node",
|
||||
},
|
||||
"git.confirmSync": false,
|
||||
"omnisharp.loggingLevel": "warning",
|
||||
"terminal.integrated.cursorStyle": "line",
|
||||
"editor.fontFamily": "'DejaVuSansMono Nerd Font Mono', monospace",
|
||||
"csharp.referencesCodeLens.enabled": false,
|
||||
"editor.renderWhitespace": "all",
|
||||
"todohighlight.include": [
|
||||
"**/*.py",
|
||||
"**/*.cs",
|
||||
"**/*.js",
|
||||
"**/*.jsx",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
"**/*.html",
|
||||
"**/*.php",
|
||||
"**/*.css",
|
||||
"**/*.scss"
|
||||
],
|
||||
"todohighlight.exclude": [
|
||||
"**/node_modules/**",
|
||||
"**/bower_components/**",
|
||||
"**/dist/**",
|
||||
"**/build/**",
|
||||
"**/.vscode/**",
|
||||
"**/.github/**",
|
||||
"**/_output/**",
|
||||
"**/*.min.*",
|
||||
"**/*.map",
|
||||
"**/.next/**",
|
||||
"**/vendor/**"
|
||||
],
|
||||
"todohighlight.keywords": [
|
||||
{
|
||||
"text": "FIXME:",
|
||||
"color": "white",
|
||||
"backgroundColor": "orangeRed"
|
||||
},
|
||||
{
|
||||
"text": "TODO:",
|
||||
"color": "white",
|
||||
"backgroundColor": "darkorange"
|
||||
},
|
||||
{
|
||||
"text": "MAYBE:",
|
||||
"color": "white",
|
||||
"backgroundColor": "lightgreen"
|
||||
},
|
||||
{
|
||||
"text": "DANGER:",
|
||||
"color": "orangeRed",
|
||||
"backgroundColor": "none"
|
||||
},
|
||||
{
|
||||
"text": "NOTE:",
|
||||
"color": "darkorange",
|
||||
"backgroundColor": "none"
|
||||
},
|
||||
{
|
||||
"text": "REMARK:",
|
||||
"color": "lightgreen",
|
||||
"backgroundColor": "none"
|
||||
},
|
||||
],
|
||||
"todohighlight.toggleURI": true,
|
||||
"fileutils.delete.useTrash": false,
|
||||
"workbench.activityBar.visible": false,
|
||||
"code-runner.enableAppInsights": false,
|
||||
"breadcrumbs.enabled": true,
|
||||
"diffEditor.ignoreTrimWhitespace": true,
|
||||
"editor.renderControlCharacters": false,
|
||||
"spellright.addToSystemDictionary": true,
|
||||
"spellright.configurationScope": "user",
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"vue"
|
||||
],
|
||||
"window.menuBarVisibility": "default",
|
||||
"search.location": "sidebar",
|
||||
"window.titleBarStyle": "native",
|
||||
"liveServer.settings.donotVerifyTags": true,
|
||||
"liveServer.settings.donotShowInfoMsg": true,
|
||||
"editor.suggestSelection": "first",
|
||||
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
|
||||
"python.jediEnabled": false,
|
||||
"workbench.sideBar.location": "left",
|
||||
"activitusbar.views": [
|
||||
{
|
||||
"name": "explorer",
|
||||
"octicon": "file-text"
|
||||
},
|
||||
{
|
||||
"name": "search",
|
||||
"octicon": "search"
|
||||
},
|
||||
{
|
||||
"name": "scm",
|
||||
"octicon": "repo-forked"
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"octicon": "bug"
|
||||
},
|
||||
{
|
||||
"name": "extensions",
|
||||
"octicon": "package"
|
||||
}
|
||||
],
|
||||
"activitusbar.activeColour": "white",
|
||||
"activitusbar.inactiveColour": "lightgrey",
|
||||
"[vue]": {
|
||||
"editor.tabSize": 2
|
||||
},
|
||||
"cSpell.language": "en,fr",
|
||||
"cSpell.userWords": [
|
||||
"Archlinux",
|
||||
"Catgirl",
|
||||
"Maelys",
|
||||
"Pleroma",
|
||||
"Subpersonalities",
|
||||
"aujourd'hui",
|
||||
"comtodon",
|
||||
"fediverse",
|
||||
"misgendered"
|
||||
],
|
||||
"cSpell.enabledLanguageIds": [
|
||||
"asciidoc",
|
||||
"c",
|
||||
"cpp",
|
||||
"csharp",
|
||||
"css",
|
||||
"git-commit",
|
||||
"go",
|
||||
"handlebars",
|
||||
"html",
|
||||
"jade",
|
||||
"java",
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"json",
|
||||
"jsonc",
|
||||
"latex",
|
||||
"less",
|
||||
"markdown",
|
||||
"php",
|
||||
"plaintext",
|
||||
"pug",
|
||||
"python",
|
||||
"restructuredtext",
|
||||
"rust",
|
||||
"scala",
|
||||
"scss",
|
||||
"text",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"yaml",
|
||||
"yml"
|
||||
],
|
||||
"workbench.enableExperiments": false,
|
||||
"workbench.settings.enableNaturalLanguageSearch": false,
|
||||
"update.mode": "none",
|
||||
"update.showReleaseNotes": false,
|
||||
}
|
|
@ -0,0 +1,286 @@
|
|||
{
|
||||
"for": {
|
||||
"prefix": "for",
|
||||
"body": [
|
||||
"for (${size_t} ${i} = ${1:0}; ${i} < ${2:length}; ${i}++)",
|
||||
"{",
|
||||
" $3",
|
||||
"}"
|
||||
],
|
||||
"description": "Code snippet for 'for' loop"
|
||||
},
|
||||
"forr": {
|
||||
"prefix": "forr",
|
||||
"body": [
|
||||
"for (int ${i} = ${1:length} - 1; ${i} >= ${2:0}; ${i}--)",
|
||||
"{",
|
||||
" $3",
|
||||
"}"
|
||||
],
|
||||
"description": "Code snippet for reverse 'for' loop"
|
||||
},
|
||||
"do": {
|
||||
"prefix": "do",
|
||||
"body": [
|
||||
"do",
|
||||
"{",
|
||||
" $1",
|
||||
"} while($2);"
|
||||
],
|
||||
"description": "Code snippet for do...while loop"
|
||||
},
|
||||
"while": {
|
||||
"prefix": "while",
|
||||
"body": [
|
||||
"while ($1)",
|
||||
"{",
|
||||
" $2",
|
||||
"}"
|
||||
],
|
||||
"description": ""
|
||||
},
|
||||
"foreach": {
|
||||
"prefix": "foreach",
|
||||
"body": [
|
||||
"for(auto ${var} : ${collection_to_loop})",
|
||||
"{",
|
||||
" $1",
|
||||
"}"
|
||||
],
|
||||
"description": "Code snippet for range-based for loop (c++11) statement"
|
||||
},
|
||||
"if": {
|
||||
"prefix": "if",
|
||||
"body": [
|
||||
"if ($1)",
|
||||
"{",
|
||||
" $2",
|
||||
"}"
|
||||
],
|
||||
"description": "Code snippet for if statement"
|
||||
},
|
||||
"else": {
|
||||
"prefix": "else",
|
||||
"body": [
|
||||
"else",
|
||||
"{",
|
||||
" $1",
|
||||
"}"
|
||||
],
|
||||
"description": "Code snippet for else statement"
|
||||
},
|
||||
"else if": {
|
||||
"prefix": "else if",
|
||||
"body": [
|
||||
"else if ($1)",
|
||||
"{",
|
||||
" $2",
|
||||
"}"
|
||||
],
|
||||
"description": "Code snippet for else-if statement"
|
||||
},
|
||||
"enum": {
|
||||
"prefix": "enum",
|
||||
"body": [
|
||||
"enum ${MyEnum}",
|
||||
"{",
|
||||
" $1",
|
||||
"};"
|
||||
],
|
||||
"description": "Code snippet for enum"
|
||||
},
|
||||
"enum class": {
|
||||
"prefix": "enum class",
|
||||
"body": [
|
||||
"enum class ${MyClass} { };"
|
||||
],
|
||||
"description": "Code snippet for enum class (c++11)"
|
||||
},
|
||||
"class": {
|
||||
"prefix": "class",
|
||||
"body": [
|
||||
"class ${MyClass}",
|
||||
"{",
|
||||
"public:",
|
||||
" ${MyClass}();",
|
||||
" ${MyClass}(${MyClass} &&) = default;",
|
||||
" ${MyClass}(const ${MyClass} &) = default;",
|
||||
" ${MyClass} &operator=(${MyClass} &&) = default;",
|
||||
" ${MyClass} &operator=(const ${MyClass} &) = default;",
|
||||
" ~${MyClass}();",
|
||||
"",
|
||||
"private:",
|
||||
" $1",
|
||||
"};",
|
||||
"",
|
||||
"${MyClass}::${MyClass}()",
|
||||
"{",
|
||||
"}",
|
||||
"",
|
||||
"${MyClass}::~${MyClass}()",
|
||||
"{",
|
||||
"}"
|
||||
],
|
||||
"description": "Code snippet for class"
|
||||
},
|
||||
"classi": {
|
||||
"prefix": "classi",
|
||||
"body": [
|
||||
"class ${MyClass}",
|
||||
"{",
|
||||
"public:",
|
||||
" ${MyClass}() = default;",
|
||||
" ${MyClass}(${MyClass} &&) = default;",
|
||||
" ${MyClass}(const ${MyClass} &) = default;",
|
||||
" ${MyClass} &operator=(${MyClass} &&) = default;",
|
||||
" ${MyClass} &operator=(const ${MyClass} &) = default;",
|
||||
" ~${MyClass}() = default;",
|
||||
"",
|
||||
"private:",
|
||||
" $1",
|
||||
"};"
|
||||
],
|
||||
"description": "Code snippet for class with inline constructor/destructor"
|
||||
},
|
||||
"interface": {
|
||||
"prefix": "interface",
|
||||
"body": [
|
||||
"__interface I${Interface}",
|
||||
"{",
|
||||
" $1",
|
||||
"};"
|
||||
],
|
||||
"description": "Code snippet for interface (Visual C++)"
|
||||
},
|
||||
"namespace": {
|
||||
"prefix": "namespace",
|
||||
"body": [
|
||||
"namespace ${MyNamespace}",
|
||||
"{",
|
||||
" $1",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
"#ifdef": {
|
||||
"prefix": "#ifdef",
|
||||
"body": [
|
||||
"#ifdef ${DEBUG}",
|
||||
"$1",
|
||||
"#endif // ${DEBUG}"
|
||||
],
|
||||
"description": "Code snippet for #ifdef"
|
||||
},
|
||||
"#ifndef": {
|
||||
"prefix": "#ifndef",
|
||||
"body": [
|
||||
"#ifndef ${1:1}",
|
||||
"$2",
|
||||
"#endif // !$1"
|
||||
],
|
||||
"description": "Code snippet for #ifndef"
|
||||
},
|
||||
"#if": {
|
||||
"prefix": "#if",
|
||||
"body": [
|
||||
"#ifdef ${1:0}",
|
||||
"$2",
|
||||
"#endif // $1"
|
||||
],
|
||||
"description": "Code snippet for #if"
|
||||
},
|
||||
"struct": {
|
||||
"prefix": "struct",
|
||||
"body": [
|
||||
"struct ${MyStruct}",
|
||||
"{",
|
||||
" $1",
|
||||
"};"
|
||||
],
|
||||
"description": "Code snippet for struct"
|
||||
},
|
||||
"switch": {
|
||||
"prefix": "switch",
|
||||
"body": [
|
||||
"switch (${switch_on})",
|
||||
"{",
|
||||
"default:",
|
||||
" break;$1",
|
||||
"}"
|
||||
],
|
||||
"description": "Code snippet for switch statement"
|
||||
},
|
||||
"try": {
|
||||
"prefix": "try",
|
||||
"body": [
|
||||
"try",
|
||||
"{",
|
||||
" ",
|
||||
"}",
|
||||
"catch (const std::exception&)",
|
||||
"{",
|
||||
" $1",
|
||||
"}"
|
||||
],
|
||||
"description": "Code snippet for try catch"
|
||||
},
|
||||
"union": {
|
||||
"prefix": "union",
|
||||
"body": [
|
||||
"union ${MyUnion}",
|
||||
"{",
|
||||
" $1",
|
||||
"};"
|
||||
],
|
||||
"description": "Code snippet for union"
|
||||
},
|
||||
"cout": {
|
||||
"prefix": "cout",
|
||||
"body": [
|
||||
"std::cout << \"${1:/* message */}\" << std::endl;"
|
||||
],
|
||||
"description": "Code snippet for printing to std::cout, provided the header is set"
|
||||
},
|
||||
"#inc": {
|
||||
"prefix": "#inc",
|
||||
"body": [
|
||||
"#include \"$1\""
|
||||
],
|
||||
"description": "Code snippet for #include \" \""
|
||||
},
|
||||
"#inc<": {
|
||||
"prefix": "#inc<",
|
||||
"body": [
|
||||
"#include <$1>"
|
||||
],
|
||||
"description": "Code snippet for #include \" \""
|
||||
},
|
||||
"#def": {
|
||||
"prefix": "#def",
|
||||
"body": [
|
||||
"#define \"$1\" \"$2\" "
|
||||
],
|
||||
"description": "Code snippet for #define \" \""
|
||||
},
|
||||
"main": {
|
||||
"prefix": "main",
|
||||
"body": [
|
||||
"int main(int argc, const char** argv) {",
|
||||
" return 0;",
|
||||
"}"
|
||||
],
|
||||
"description": "Code snippet for 'for' loop"
|
||||
},
|
||||
"hpp": {
|
||||
"prefix": "hpp",
|
||||
"body": [
|
||||
"#ifndef ${1:${TM_FILENAME/(.*)/${1:/upcase}/}}",
|
||||
"#define $1",
|
||||
"",
|
||||
"$2",
|
||||
"",
|
||||
"#endif",
|
||||
""
|
||||
],
|
||||
"description": "Headr file ifndef"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"Namespace": {
|
||||
"prefix": "namespace",
|
||||
"body": [
|
||||
"namespace ${1:Name} {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "Create namespace"
|
||||
},
|
||||
"Class": {
|
||||
"prefix": "class",
|
||||
"body": [
|
||||
"class ${1:${TM_FILENAME_BASE:Name}} {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "Create class"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,345 @@
|
|||
# Configuration for Alacritty, the GPU enhanced terminal emulator
|
||||
|
||||
|
||||
# Any items in the `env` entry below will be added as
|
||||
# environment variables. Some entries may override variables
|
||||
# set by alacritty it self.
|
||||
env:
|
||||
# TERM env customization.
|
||||
#
|
||||
# If this property is not set, alacritty will set it to xterm-256color.
|
||||
#
|
||||
# Note that some xterm terminfo databases don't declare support for italics.
|
||||
# You can verify this by checking for the presence of `smso` and `sitm` in
|
||||
# `infocmp xterm-256color`.
|
||||
TERM: xterm-256color
|
||||
window:
|
||||
# Window dimensions in character columns and lines
|
||||
# (changes require restart)
|
||||
dimensions:
|
||||
columns: 80
|
||||
lines: 24
|
||||
|
||||
# Adds this many blank pixels of padding around the window
|
||||
# Units are physical pixels; this is not DPI aware.
|
||||
# (change requires restart)
|
||||
padding:
|
||||
x: 2
|
||||
y: 2
|
||||
|
||||
# Window decorations
|
||||
# Setting this to false will result in window without borders and title bar.
|
||||
|
||||
# Display tabs using this many cells (changes require restart)
|
||||
tabspaces: 4
|
||||
|
||||
# Cursor blinking
|
||||
cursor_blink_interval: 300
|
||||
cursor_blink: true
|
||||
|
||||
# When true, bold text is drawn using the bright variant of colors.
|
||||
draw_bold_text_with_bright_colors: true
|
||||
|
||||
# Font configuration (changes require restart)
|
||||
font:
|
||||
# The normal (roman) font face to use.
|
||||
normal:
|
||||
family: "DejaVuSansMono Nerd Font Mono" # should be "Menlo" or something on macOS.
|
||||
# Style can be specified to pick a specific face.
|
||||
style: Roman
|
||||
|
||||
# The bold font face
|
||||
bold:
|
||||
family: "DejaVuSansMono Nerd Font Mono" # should be "Menlo" or something on macOS.
|
||||
# Style can be specified to pick a specific face.
|
||||
style: Bold
|
||||
|
||||
# The italic font face
|
||||
italic:
|
||||
family: "DejaVuSansMono Nerd Font Mono" # should be "Menlo" or something on macOS.
|
||||
# Style can be specified to pick a specific face.
|
||||
style: Italic
|
||||
|
||||
# Point size of the font
|
||||
size: 8.0
|
||||
|
||||
# Offset is the extra space around each character. offset.y can be thought of
|
||||
# as modifying the linespacing, and offset.x as modifying the letter spacing.
|
||||
offset:
|
||||
x: 0
|
||||
y: 0
|
||||
|
||||
# Glyph offset determines the locations of the glyphs within their cells with
|
||||
# the default being at the bottom. Increase the x offset to move the glyph to
|
||||
# the right, increase the y offset to move the glyph upward.
|
||||
glyph_offset:
|
||||
x: 0
|
||||
y: 0
|
||||
|
||||
# OS X only: use thin stroke font rendering. Thin strokes are suitable
|
||||
# for retina displays, but for non-retina you probably want this set to
|
||||
# false.
|
||||
use_thin_strokes: true
|
||||
|
||||
# Should display the render timer
|
||||
render_timer: false
|
||||
|
||||
# Use custom cursor colors. If true, display the cursor in the cursor.foreground
|
||||
# and cursor.background colors, otherwise invert the colors of the cursor.
|
||||
|
||||
# Colors (Tomorrow Night Bright)
|
||||
colors:
|
||||
# Default colors
|
||||
primary:
|
||||
background: '0x333333'
|
||||
foreground: '0xdddddd'
|
||||
|
||||
# Colors the cursor will use if `custom_cursor_colors` is true
|
||||
cursor:
|
||||
text: '0x000000'
|
||||
cursor: '0xdddddd'
|
||||
|
||||
# Normal colors
|
||||
normal:
|
||||
black: '0x000000'
|
||||
red: '0xd54e53'
|
||||
green: '0xb9ca4a'
|
||||
yellow: '0xe6c547'
|
||||
blue: '0x7aa6da'
|
||||
magenta: '0xc397d8'
|
||||
cyan: '0x70c0ba'
|
||||
white: '0xffffff'
|
||||
|
||||
# Bright colors
|
||||
bright:
|
||||
black: '0x666666'
|
||||
red: '0xff3334'
|
||||
green: '0x9ec400'
|
||||
yellow: '0xe7c547'
|
||||
blue: '0x7aa6da'
|
||||
magenta: '0xb77ee0'
|
||||
cyan: '0x54ced6'
|
||||
white: '0xffffff'
|
||||
|
||||
# Dim colors (Optional)
|
||||
dim:
|
||||
 black: '0x333333'
|
||||
 red: '0xf2777a'
|
||||
 green: '0x99cc99'
|
||||
 yellow: '0xffcc66'
|
||||
 blue: '0x6699cc'
|
||||
 magenta: '0xcc99cc'
|
||||
 cyan: '0x66cccc'
|
||||
 white: '0xdddddd'
|
||||
|
||||
# Visual Bell
|
||||
#
|
||||
# Any time the BEL code is received, Alacritty "rings" the visual bell. Once
|
||||
# rung, the terminal background will be set to white and transition back to the
|
||||
# default background color. You can control the rate of this transition by
|
||||
# setting the `duration` property (represented in milliseconds). You can also
|
||||
# configure the transition function by setting the `animation` property.
|
||||
#
|
||||
# Possible values for `animation`
|
||||
# `Ease`
|
||||
# `EaseOut`
|
||||
# `EaseOutSine`
|
||||
# `EaseOutQuad`
|
||||
# `EaseOutCubic`
|
||||
# `EaseOutQuart`
|
||||
# `EaseOutQuint`
|
||||
# `EaseOutExpo`
|
||||
# `EaseOutCirc`
|
||||
# `Linear`
|
||||
#
|
||||
# To completely disable the visual bell, set its duration to 0.
|
||||
#
|
||||
visual_bell:
|
||||
animation: EaseOutExpo
|
||||
duration: 0
|
||||
|
||||
# Background opacity
|
||||
background_opacity: 0.9
|
||||
# Key bindings
|
||||
#
|
||||
# Each binding is defined as an object with some properties. Most of the
|
||||
# properties are optional. All of the alphabetical keys should have a letter for
|
||||
# the `key` value such as `V`. Function keys are probably what you would expect
|
||||
# as well (F1, F2, ..). The number keys above the main keyboard are encoded as
|
||||
# `Key1`, `Key2`, etc. Keys on the number pad are encoded `Number1`, `Number2`,
|
||||
# etc. These all match the glutin::VirtualKeyCode variants.
|
||||
#
|
||||
# Possible values for `mods`
|
||||
# `Command`, `Super` refer to the super/command/windows key
|
||||
# `Control` for the control key
|
||||
# `Shift` for the Shift key
|
||||
# `Alt` and `Option` refer to alt/option
|
||||
#
|
||||
# mods may be combined with a `|`. For example, requiring control and shift
|
||||
# looks like:
|
||||
#
|
||||
# mods: Control|Shift
|
||||
#
|
||||
# The parser is currently quite sensitive to whitespace and capitalization -
|
||||
# capitalization must match exactly, and piped items must not have whitespace
|
||||
# around them.
|
||||
#
|
||||
# Either an `action`, `chars`, or `command` field must be present.
|
||||
# `action` must be one of `Paste`, `PasteSelection`, `Copy`, or `Quit`.
|
||||
# `chars` writes the specified string every time that binding is activated.
|
||||
# These should generally be escape sequences, but they can be configured to
|
||||
# send arbitrary strings of bytes.
|
||||
# `command` must be a map containing a `program` string, and `args` array of
|
||||
# strings. For example:
|
||||
# - { ... , command: { program: "alacritty", args: ["-e", "vttest"] } }
|
||||
#
|
||||
# Want to add a binding (e.g. "PageUp") but are unsure what the X sequence
|
||||
# (e.g. "\x1b[5~") is? Open another terminal (like xterm) without tmux,
|
||||
# then run `showkey -a` to get the sequence associated to a key combination.
|
||||
key_bindings:
|
||||
- { key: V, mods: Control|Shift, action: Paste }
|
||||
- { key: C, mods: Control|Shift, action: Copy }
|
||||
- { key: Q, mods: Command, action: Quit }
|
||||
- { key: W, mods: Command, action: Quit }
|
||||
- { key: Insert, mods: Shift, action: PasteSelection }
|
||||
- { key: Numpad0, mods: Control, action: ResetFontSize }
|
||||
- { key: Equals, mods: Control, action: IncreaseFontSize }
|
||||
- { key: Subtract, mods: Control, action: DecreaseFontSize }
|
||||
- { key: Home, chars: "\x1bOH", mode: AppCursor }
|
||||
- { key: Home, chars: "\x1b[H", mode: ~AppCursor }
|
||||
- { key: End, chars: "\x1bOF", mode: AppCursor }
|
||||
- { key: End, chars: "\x1b[F", mode: ~AppCursor }
|
||||
- { key: PageUp, mods: Shift, chars: "\x1b[5;2~" }
|
||||
- { key: PageUp, mods: Control, chars: "\x1b[5;5~" }
|
||||
- { key: PageUp, chars: "\x1b[5~" }
|
||||
- { key: PageDown, mods: Shift, chars: "\x1b[6;2~" }
|
||||
- { key: PageDown, mods: Control, chars: "\x1b[6;5~" }
|
||||
- { key: PageDown, chars: "\x1b[6~" }
|
||||
- { key: Tab, mods: Shift, chars: "\x1b[Z" }
|
||||
- { key: Back, chars: "\x7f" }
|
||||
- { key: Back, mods: Alt, chars: "\x1b\x7f" }
|
||||
- { key: Insert, chars: "\x1b[2~" }
|
||||
- { key: Delete, chars: "\x1b[3~" }
|
||||
- { key: Left, mods: Shift, chars: "\x1b[1;2D" }
|
||||
- { key: Left, mods: Control, chars: "\x1b[1;5D" }
|
||||
- { key: Left, mods: Alt, chars: "\x1b[1;3D" }
|
||||
- { key: Left, chars: "\x1b[D", mode: ~AppCursor }
|
||||
- { key: Left, chars: "\x1bOD", mode: AppCursor }
|
||||
- { key: Right, mods: Shift, chars: "\x1b[1;2C" }
|
||||
- { key: Right, mods: Control, chars: "\x1b[1;5C" }
|
||||
- { key: Right, mods: Alt, chars: "\x1b[1;3C" }
|
||||
- { key: Right, chars: "\x1b[C", mode: ~AppCursor }
|
||||
- { key: Right, chars: "\x1bOC", mode: AppCursor }
|
||||
- { key: Up, mods: Shift, chars: "\x1b[1;2A" }
|
||||
- { key: Up, mods: Control, chars: "\x1b[1;5A" }
|
||||
- { key: Up, mods: Alt, chars: "\x1b[1;3A" }
|
||||
- { key: Up, chars: "\x1b[A", mode: ~AppCursor }
|
||||
- { key: Up, chars: "\x1bOA", mode: AppCursor }
|
||||
- { key: Down, mods: Shift, chars: "\x1b[1;2B" }
|
||||
- { key: Down, mods: Control, chars: "\x1b[1;5B" }
|
||||
- { key: Down, mods: Alt, chars: "\x1b[1;3B" }
|
||||
- { key: Down, chars: "\x1b[B", mode: ~AppCursor }
|
||||
- { key: Down, chars: "\x1bOB", mode: AppCursor }
|
||||
- { key: Tab, mods: Shift, chars: "\x1b[Z" }
|
||||
- { key: F1, chars: "\x1bOP" }
|
||||
- { key: F2, chars: "\x1bOQ" }
|
||||
- { key: F3, chars: "\x1bOR" }
|
||||
- { key: F4, chars: "\x1bOS" }
|
||||
- { key: F5, chars: "\x1b[15~" }
|
||||
- { key: F6, chars: "\x1b[17~" }
|
||||
- { key: F7, chars: "\x1b[18~" }
|
||||
- { key: F8, chars: "\x1b[19~" }
|
||||
- { key: F9, chars: "\x1b[20~" }
|
||||
- { key: F10, chars: "\x1b[21~" }
|
||||
- { key: F11, chars: "\x1b[23~" }
|
||||
- { key: F12, chars: "\x1b[24~" }
|
||||
# - { key: Back, chars: "\x7f" }
|
||||
- { key: Back, mods: Alt, chars: "\x1b\x7f" }
|
||||
- { key: Insert, chars: "\x1b[2~" }
|
||||
- { key: F1, mods: Shift, chars: "\x1b[1;2P" }
|
||||
- { key: F2, mods: Shift, chars: "\x1b[1;2Q" }
|
||||
- { key: F3, mods: Shift, chars: "\x1b[1;2R" }
|
||||
- { key: F4, mods: Shift, chars: "\x1b[1;2S" }
|
||||
- { key: F5, mods: Shift, chars: "\x1b[15;2~" }
|
||||
- { key: F6, mods: Shift, chars: "\x1b[17;2~" }
|
||||
- { key: F7, mods: Shift, chars: "\x1b[18;2~" }
|
||||
- { key: F8, mods: Shift, chars: "\x1b[19;2~" }
|
||||
- { key: F9, mods: Shift, chars: "\x1b[20;2~" }
|
||||
- { key: F10, mods: Shift, chars: "\x1b[21;2~" }
|
||||
- { key: F11, mods: Shift, chars: "\x1b[23;2~" }
|
||||
- { key: F12, mods: Shift, chars: "\x1b[24;2~" }
|
||||
- { key: F1, mods: Control, chars: "\x1b[1;5P" }
|
||||
- { key: F2, mods: Control, chars: "\x1b[1;5Q" }
|
||||
- { key: F3, mods: Control, chars: "\x1b[1;5R" }
|
||||
- { key: F4, mods: Control, chars: "\x1b[1;5S" }
|
||||
- { key: F5, mods: Control, chars: "\x1b[15;5~" }
|
||||
- { key: F6, mods: Control, chars: "\x1b[17;5~" }
|
||||
- { key: F7, mods: Control, chars: "\x1b[18;5~" }
|
||||
- { key: F8, mods: Control, chars: "\x1b[19;5~" }
|
||||
- { key: F9, mods: Control, chars: "\x1b[20;5~" }
|
||||
- { key: F10, mods: Control, chars: "\x1b[21;5~" }
|
||||
- { key: F11, mods: Control, chars: "\x1b[23;5~" }
|
||||
- { key: F12, mods: Control, chars: "\x1b[24;5~" }
|
||||
- { key: F1, mods: Alt, chars: "\x1b[1;6P" }
|
||||
- { key: F2, mods: Alt, chars: "\x1b[1;6Q" }
|
||||
- { key: F3, mods: Alt, chars: "\x1b[1;6R" }
|
||||
- { key: F4, mods: Alt, chars: "\x1b[1;6S" }
|
||||
- { key: F5, mods: Alt, chars: "\x1b[15;6~" }
|
||||
- { key: F6, mods: Alt, chars: "\x1b[17;6~" }
|
||||
- { key: F7, mods: Alt, chars: "\x1b[18;6~" }
|
||||
- { key: F8, mods: Alt, chars: "\x1b[19;6~" }
|
||||
- { key: F9, mods: Alt, chars: "\x1b[20;6~" }
|
||||
- { key: F10, mods: Alt, chars: "\x1b[21;6~" }
|
||||
- { key: F11, mods: Alt, chars: "\x1b[23;6~" }
|
||||
- { key: F12, mods: Alt, chars: "\x1b[24;6~" }
|
||||
- { key: F1, mods: Super, chars: "\x1b[1;3P" }
|
||||
- { key: F2, mods: Super, chars: "\x1b[1;3Q" }
|
||||
- { key: F3, mods: Super, chars: "\x1b[1;3R" }
|
||||
- { key: F4, mods: Super, chars: "\x1b[1;3S" }
|
||||
- { key: F5, mods: Super, chars: "\x1b[15;3~" }
|
||||
- { key: F6, mods: Super, chars: "\x1b[17;3~" }
|
||||
- { key: F7, mods: Super, chars: "\x1b[18;3~" }
|
||||
- { key: F8, mods: Super, chars: "\x1b[19;3~" }
|
||||
- { key: F9, mods: Super, chars: "\x1b[20;3~" }
|
||||
- { key: F10, mods: Super, chars: "\x1b[21;3~" }
|
||||
- { key: F11, mods: Super, chars: "\x1b[23;3~" }
|
||||
- { key: F12, mods: Super, chars: "\x1b[24;3~" }
|
||||
|
||||
# Mouse bindings
|
||||
#
|
||||
# Currently doesn't support modifiers. Both the `mouse` and `action` fields must
|
||||
# be specified.
|
||||
#
|
||||
# Values for `mouse`:
|
||||
# - Middle
|
||||
# - Left
|
||||
# - Right
|
||||
# - Numeric identifier such as `5`
|
||||
#
|
||||
# Values for `action`:
|
||||
# - Paste
|
||||
# - PasteSelection
|
||||
# - Copy (TODO)
|
||||
mouse_bindings:
|
||||
- { mouse: Middle, action: PasteSelection }
|
||||
|
||||
mouse:
|
||||
double_click: { threshold: 300 }
|
||||
triple_click: { threshold: 300 }
|
||||
|
||||
selection:
|
||||
semantic_escape_chars: ",│`|:\"' ()[]{}<>"
|
||||
|
||||
# hide_cursor_when_typing: false
|
||||
|
||||
cursor:
|
||||
style: Beam
|
||||
# Shell
|
||||
#
|
||||
# You can set shell.program to the path of your favorite shell, e.g. /bin/fish.
|
||||
# Entries in shell.args are passed unmodified as arguments to the shell.
|
||||
#shell:
|
||||
# program: /bin/bash
|
||||
# args:
|
||||
# - --login
|
||||
# - -e "echo -e -n '\e[6 q'"
|
|
@ -0,0 +1,137 @@
|
|||
## Configuration file for CAVA. Default values are commented out. Use either ';' or '#' for commenting.
|
||||
|
||||
|
||||
[general]
|
||||
|
||||
# Smoothing mode. Can be 'normal', 'scientific' or 'waves'.
|
||||
; mode = normal
|
||||
|
||||
# Accepts only non-negative values.
|
||||
framerate = 60
|
||||
|
||||
# 'autosens' will attempt to decrease sensitivity if the bars peak. 1 = on, 0 = off
|
||||
# 'overshoot' allows bars to overshoot (in % of terminal height) without initiating autosens.
|
||||
; autosens = 1
|
||||
; overshoot = 20
|
||||
|
||||
# Manual sensitivity in %. Autosens must be turned off for this to take effect.
|
||||
# 200 means double height. Accepts only non-negative values.
|
||||
; sensitivity = 100
|
||||
|
||||
# The number of bars (0-200). 0 sets it to auto (fill up console).
|
||||
# Bars' width and space between bars in number of characters.
|
||||
bars = 0
|
||||
bar_width = 1
|
||||
bar_spacing = 0
|
||||
|
||||
|
||||
# Lower and higher cutoff frequencies for lowest and highest bars
|
||||
# the bandwidth of the visualizer.
|
||||
# Note: there is a minimum total bandwidth of 43Mhz x number of bars.
|
||||
# Cava will automatically increase the higher cutoff if a too low band is specified.
|
||||
; lower_cutoff_freq = 50
|
||||
; higher_cutoff_freq = 10000
|
||||
|
||||
|
||||
|
||||
[input]
|
||||
|
||||
# Audio capturing method. Possible methods are: 'pulse', 'alsa' or 'fifo'.
|
||||
# Defaults to 'pulse', 'alsa' or 'fifo', in that order, dependent on what support cava was built with.
|
||||
#
|
||||
# All input methods uses the same config variable 'source'
|
||||
# to define where it should get the audio.
|
||||
#
|
||||
# For pulseaudio 'source' will be the source. Default: 'auto', which uses the monitor source of the default sink
|
||||
# (all pulseaudio sinks(outputs) have 'monitor' sources(inputs) associated with them).
|
||||
#
|
||||
# For alsa 'source' will be the capture device.
|
||||
# For fifo 'source' will be the path to fifo-file.
|
||||
; method = pulse
|
||||
; source = auto
|
||||
|
||||
; method = alsa
|
||||
; source = hw:Loopback,1
|
||||
|
||||
; method = fifo
|
||||
; source = /tmp/mpd.fifo
|
||||
|
||||
|
||||
|
||||
[output]
|
||||
|
||||
# Ouput method. Can be 'ncurses', 'noncurses' or 'raw'.
|
||||
# 'noncurses' is for systems that does not suport ncurses.
|
||||
# 'raw' is a 16 bit data stream of the bar heights that can be used to send to other applications.
|
||||
# 'raw' defaults to 200 bars, which can be adjusted in the 'bars' option above.
|
||||
; method = raw
|
||||
|
||||
# Visual styles. Can be 'stereo' or 'mono'.
|
||||
# 'stereo' mirrors both channels with low frequencies in center.
|
||||
# 'mono' averages both channels and outputs left to right lowest to highest frequencies.
|
||||
style = mono
|
||||
|
||||
# Raw output target. A fifo will be created if target does not exist.
|
||||
; raw_target = /dev/stdout
|
||||
|
||||
# Raw data format. Can be 'binary' or 'ascii'.
|
||||
; data_format = binary
|
||||
|
||||
# Binary bit format, can be '8bit' (0-255) or '16bit' (0-65530).
|
||||
; bit_format = 16bit
|
||||
|
||||
# Ascii max value. In 'ascii' mode range will run from 0 to value specified here
|
||||
; ascii_max_range = 1000
|
||||
|
||||
# Ascii delimiters. In ascii format each bar and frame is separated by a delimiters.
|
||||
# Use decimal value in ascii table (i.e. 59 = ';' and 10 = '\n' (line feed)).
|
||||
; bar_delimiter = 59
|
||||
; frame_delimiter = 10
|
||||
|
||||
|
||||
|
||||
[color]
|
||||
|
||||
# Colors can be one of seven predefined: black, blue, cyan, green, magenta, red, white, yellow.
|
||||
# Or defined by hex code '#xxxxxx' (hex code must be within ''). User defined colors requires a
|
||||
# terminal that can change color definitions such as Gnome-terminal or rxvt.
|
||||
; background = black
|
||||
foreground = white
|
||||
|
||||
# Gradient mode, only hex defined colors are supported, background must also be defined in hex
|
||||
# or remain commented out. 1 = on, 0 = off. Warning: for certain terminal emulators cava will
|
||||
# not able to restore color definitions on exit, simply restart your terminal to restore colors.
|
||||
gradient = 1
|
||||
gradient_color_1 = '#ea4230'
|
||||
gradient_color_2 = '#820bc6'
|
||||
|
||||
|
||||
|
||||
[smoothing]
|
||||
|
||||
# Multiplier for the integral smoothing calculations. Takes values from 0-0.99.
|
||||
# Higher values means smoother, but less precise. Set to 0 to disable.
|
||||
; integral = 0.7
|
||||
|
||||
# Disables or enables the so-called "Monstercat smoothing". Set to 0 to disable.
|
||||
; monstercat = 0
|
||||
|
||||
# Set gravity multiplier for "drop off". Higher values means bars will drop faster.
|
||||
# Accepts only non-negative values. 0.5 means half gravity, 2 means double. Set to 0 to disable "drop off".
|
||||
; gravity = 1
|
||||
|
||||
|
||||
# In bar height, bars that would have been lower that this will not be drawn.
|
||||
; ignore = 0
|
||||
|
||||
|
||||
[eq]
|
||||
|
||||
# This one is tricky. You can have as much keys as you want.
|
||||
# Remember to uncomment more then one key! More keys = more precision.
|
||||
# Look at readme.md on github for further explanations and examples.
|
||||
; 1 = 1 # bass
|
||||
; 2 = 1
|
||||
; 3 = 1 # midtone
|
||||
; 4 = 1
|
||||
; 5 = 1 # treble
|
|
@ -0,0 +1,26 @@
|
|||
# Beware! This file is rewritten by htop when settings are changed in the interface.
|
||||
# The parser is also very primitive, and not human-friendly.
|
||||
fields=0 48 2 46 47 38 49 111 1
|
||||
sort_key=46
|
||||
sort_direction=1
|
||||
hide_threads=1
|
||||
hide_kernel_threads=1
|
||||
hide_userland_threads=1
|
||||
shadow_other_users=0
|
||||
show_thread_names=0
|
||||
show_program_path=1
|
||||
highlight_base_name=1
|
||||
highlight_megabytes=1
|
||||
highlight_threads=1
|
||||
tree_view=0
|
||||
header_margin=1
|
||||
detailed_cpu_time=0
|
||||
cpu_count_from_zero=0
|
||||
update_process_names=0
|
||||
account_guest_in_cpu_meter=0
|
||||
color_scheme=0
|
||||
delay=15
|
||||
left_meters=Hostname LoadAverage Tasks Uptime Clock
|
||||
left_meter_modes=2 2 2 2 2
|
||||
right_meters=AllCPUs2 Memory Swap Battery
|
||||
right_meter_modes=1 1 1 1
|
|
@ -0,0 +1,9 @@
|
|||
MOUSE_BTN3 add volume 5
|
||||
MOUSE_BTN4 add volume -5
|
||||
+ add speed 0.05
|
||||
- add speed -0.05
|
||||
h add volume -5
|
||||
l add volume 5
|
||||
j seek 15
|
||||
k seek -15
|
||||
m cycle pause
|
|
@ -0,0 +1 @@
|
|||
layout=slimbox
|
|
@ -0,0 +1,7 @@
|
|||
volume=100
|
||||
volume-max=200
|
||||
|
||||
force-window
|
||||
quiet
|
||||
|
||||
ytdl-format=bestvideo[height<=?1080]+bestaudio/best
|
|
@ -0,0 +1,731 @@
|
|||
-- Display some stats.
|
||||
--
|
||||
-- Please consult the readme for information about usage and configuration:
|
||||
-- https://github.com/Argon-/mpv-stats
|
||||
--
|
||||
-- Please note: not every property is always available and therefore not always
|
||||
-- visible.
|
||||
|
||||
local mp = require 'mp'
|
||||
local options = require 'mp.options'
|
||||
|
||||
-- Options
|
||||
local o = {
|
||||
-- Default key bindings
|
||||
key_oneshot = "i",
|
||||
key_toggle = "I",
|
||||
key_page_1 = "1",
|
||||
key_page_2 = "2",
|
||||
key_page_3 = "3",
|
||||
|
||||
duration = 4,
|
||||
redraw_delay = 1, -- acts as duration in the toggling case
|
||||
ass_formatting = true,
|
||||
print_perfdata_passes = false, -- when true, print the full information about all passes
|
||||
filter_params_max_length = 100, -- a filter list longer than this many characters will be shown one filter per line instead
|
||||
debug = false,
|
||||
|
||||
-- Graph options and style
|
||||
plot_perfdata = true,
|
||||
plot_vsync_ratio = true,
|
||||
plot_vsync_jitter = true,
|
||||
skip_frames = 5,
|
||||
global_max = true,
|
||||
flush_graph_data = true, -- clear data buffers when toggling
|
||||
plot_bg_border_color = "0000FF",
|
||||
plot_bg_color = "262626",
|
||||
plot_color = "FFFFFF",
|
||||
|
||||
-- Text style
|
||||
font = "Source Sans Pro",
|
||||
font_mono = "Source Sans Pro", -- monospaced digits are sufficient
|
||||
font_size = 8,
|
||||
font_color = "FFFFFF",
|
||||
border_size = 0.8,
|
||||
border_color = "262626",
|
||||
shadow_x_offset = 0.0,
|
||||
shadow_y_offset = 0.0,
|
||||
shadow_color = "000000",
|
||||
alpha = "11",
|
||||
|
||||
-- Custom header for ASS tags to style the text output.
|
||||
-- Specifying this will ignore the text style values above and just
|
||||
-- use this string instead.
|
||||
custom_header = "",
|
||||
|
||||
-- Text formatting
|
||||
-- With ASS
|
||||
ass_nl = "\\N",
|
||||
ass_indent = "\\h\\h\\h\\h\\h",
|
||||
ass_prefix_sep = "\\h\\h",
|
||||
ass_b1 = "{\\b1}",
|
||||
ass_b0 = "{\\b0}",
|
||||
ass_it1 = "{\\i1}",
|
||||
ass_it0 = "{\\i0}",
|
||||
-- Without ASS
|
||||
no_ass_nl = "\n",
|
||||
no_ass_indent = "\t",
|
||||
no_ass_prefix_sep = " ",
|
||||
no_ass_b1 = "\027[1m",
|
||||
no_ass_b0 = "\027[0m",
|
||||
no_ass_it1 = "\027[3m",
|
||||
no_ass_it0 = "\027[0m",
|
||||
}
|
||||
options.read_options(o)
|
||||
|
||||
local format = string.format
|
||||
local max = math.max
|
||||
local min = math.min
|
||||
|
||||
-- Function used to record performance data
|
||||
local recorder = nil
|
||||
-- Timer used for toggling
|
||||
local toggle_timer = nil
|
||||
-- Timer used to remove forced keybindings
|
||||
local binding_timer = nil
|
||||
-- Current page and <page key>:<page function> mappings
|
||||
local curr_page = o.key_page_1
|
||||
local pages = {}
|
||||
|
||||
-- Save these sequences locally as we'll need them a lot
|
||||
local ass_start = mp.get_property_osd("osd-ass-cc/0")
|
||||
local ass_stop = mp.get_property_osd("osd-ass-cc/1")
|
||||
|
||||
-- Ring buffers for the values used to construct a graph.
|
||||
-- .pos denotes the current position, .len the buffer length
|
||||
-- .max is the max value in the corresponding buffer
|
||||
local vsratio_buf, vsjitter_buf
|
||||
local function init_buffers()
|
||||
vsratio_buf = {0, pos = 1, len = 50, max = 0}
|
||||
vsjitter_buf = {0, pos = 1, len = 50, max = 0}
|
||||
end
|
||||
|
||||
-- Save all properties known to this version of mpv
|
||||
local property_list = {}
|
||||
for p in string.gmatch(mp.get_property("property-list"), "([^,]+)") do property_list[p] = true end
|
||||
-- Mapping of properties to their deprecated names
|
||||
local property_aliases = {
|
||||
["decoder-frame-drop-count"] = "drop-frame-count",
|
||||
["frame-drop-count"] = "vo-drop-frame-count",
|
||||
["container-fps"] = "fps",
|
||||
}
|
||||
|
||||
|
||||
-- Return deprecated name for the given property
|
||||
local function compat(p)
|
||||
while not property_list[p] and property_aliases[p] do
|
||||
p = property_aliases[p]
|
||||
end
|
||||
return p
|
||||
end
|
||||
|
||||
|
||||
local function set_ASS(b)
|
||||
if not o.use_ass then
|
||||
return ""
|
||||
end
|
||||
return b and ass_start or ass_stop
|
||||
end
|
||||
|
||||
|
||||
local function no_ASS(t)
|
||||
return set_ASS(false) .. t .. set_ASS(true)
|
||||
end
|
||||
|
||||
|
||||
local function b(t)
|
||||
return o.b1 .. t .. o.b0
|
||||
end
|
||||
|
||||
|
||||
local function it(t)
|
||||
return o.it1 .. t .. o.it0
|
||||
end
|
||||
|
||||
|
||||
local function text_style()
|
||||
if not o.use_ass then
|
||||
return ""
|
||||
end
|
||||
if o.custom_header and o.custom_header ~= "" then
|
||||
return set_ASS(true) .. o.custom_header
|
||||
else
|
||||
return format("%s{\\r}{\\an7}{\\fs%d}{\\fn%s}{\\bord%f}{\\3c&H%s&}{\\1c&H%s&}{\\alpha&H%s&}{\\xshad%f}{\\yshad%f}{\\4c&H%s&}",
|
||||
set_ASS(true), o.font_size, o.font, o.border_size,
|
||||
o.border_color, o.font_color, o.alpha, o.shadow_x_offset,
|
||||
o.shadow_y_offset, o.shadow_color)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function has_vo_window()
|
||||
return mp.get_property("vo-configured") == "yes"
|
||||
end
|
||||
|
||||
|
||||
local function has_video()
|
||||
local r = mp.get_property("video")
|
||||
return r and r ~= "no" and r ~= ""
|
||||
end
|
||||
|
||||
|
||||
local function has_audio()
|
||||
local r = mp.get_property("audio")
|
||||
return r and r ~= "no" and r ~= ""
|
||||
end
|
||||
|
||||
|
||||
local function has_ansi()
|
||||
local is_windows = type(package) == 'table' and type(package.config) == 'string' and package.config:sub(1,1) == '\\'
|
||||
if is_windows then
|
||||
return os.getenv("ANSICON")
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
-- Generate a graph from the given values.
|
||||
-- Returns an ASS formatted vector drawing as string.
|
||||
--
|
||||
-- values: Array/table of numbers representing the data. Used like a ring buffer
|
||||
-- it will get iterated backwards `len` times starting at position `i`.
|
||||
-- i : Index of the latest data value in `values`.
|
||||
-- len : The length/amount of numbers in `values`.
|
||||
-- v_max : The maximum number in `values`. It is used to scale all data
|
||||
-- values to a range of 0 to `v_max`.
|
||||
-- v_avg : The average number in `values`. It is used to try and center graphs
|
||||
-- if possible. May be left as nil
|
||||
-- scale : A value that will be multiplied with all data values.
|
||||
-- x_tics: Horizontal width multiplier for the steps
|
||||
local function generate_graph(values, i, len, v_max, v_avg, scale, x_tics)
|
||||
-- Check if at least one value exists
|
||||
if not values[i] then
|
||||
return ""
|
||||
end
|
||||
|
||||
local x_max = (len - 1) * x_tics
|
||||
local y_offset = o.border_size
|
||||
local y_max = o.font_size * 0.66
|
||||
local x = 0
|
||||
|
||||
-- try and center the graph if possible, but avoid going above `scale`
|
||||
if v_avg then
|
||||
scale = min(scale, v_max / (2 * v_avg))
|
||||
end
|
||||
|
||||
local s = {format("m 0 0 n %f %f l ", x, y_max - (y_max * values[i] / v_max * scale))}
|
||||
i = ((i - 2) % len) + 1
|
||||
|
||||
for p = 1, len - 1 do
|
||||
if values[i] then
|
||||
x = x - x_tics
|
||||
s[#s+1] = format("%f %f ", x, y_max - (y_max * values[i] / v_max * scale))
|
||||
end
|
||||
i = ((i - 2) % len) + 1
|
||||
end
|
||||
|
||||
s[#s+1] = format("%f %f %f %f", x, y_max, 0, y_max)
|
||||
|
||||
local bg_box = format("{\\bord0.5}{\\3c&H%s&}{\\1c&H%s&}m 0 %f l %f %f %f 0 0 0",
|
||||
o.plot_bg_border_color, o.plot_bg_color, y_max, x_max, y_max, x_max)
|
||||
return format("%s{\\r}{\\pbo%f}{\\shad0}{\\alpha&H00}{\\p1}%s{\\p0}{\\bord0}{\\1c&H%s}{\\p1}%s{\\p0}%s",
|
||||
o.prefix_sep, y_offset, bg_box, o.plot_color, table.concat(s), text_style())
|
||||
end
|
||||
|
||||
|
||||
-- Format and append a property.
|
||||
-- A property whose value is either `nil` or empty (hereafter called "invalid")
|
||||
-- is skipped and not appended.
|
||||
-- Returns `false` in case nothing was appended, otherwise `true`.
|
||||
--
|
||||
-- s : Table containing strings.
|
||||
-- prop : The property to query and format (based on its OSD representation).
|
||||
-- attr : Optional table to overwrite certain (formatting) attributes for
|
||||
-- this property.
|
||||
-- exclude: Optional table containing keys which are considered invalid values
|
||||
-- for this property. Specifying this will replace empty string as
|
||||
-- default invalid value (nil is always invalid).
|
||||
local function append_property(s, prop, attr, excluded)
|
||||
excluded = excluded or {[""] = true}
|
||||
local ret = mp.get_property_osd(prop)
|
||||
if not ret or excluded[ret] then
|
||||
if o.debug then
|
||||
print("No value for property: " .. prop)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
attr.prefix_sep = attr.prefix_sep or o.prefix_sep
|
||||
attr.indent = attr.indent or o.indent
|
||||
attr.nl = attr.nl or o.nl
|
||||
attr.suffix = attr.suffix or ""
|
||||
attr.prefix = attr.prefix or ""
|
||||
attr.no_prefix_markup = attr.no_prefix_markup or false
|
||||
attr.prefix = attr.no_prefix_markup and attr.prefix or b(attr.prefix)
|
||||
ret = attr.no_value and "" or ret
|
||||
|
||||
s[#s+1] = format("%s%s%s%s%s%s", attr.nl, attr.indent,
|
||||
attr.prefix, attr.prefix_sep, no_ASS(ret), attr.suffix)
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
local function append_perfdata(s, dedicated_page)
|
||||
local vo_p = mp.get_property_native("vo-passes")
|
||||
if not vo_p then
|
||||
return
|
||||
end
|
||||
|
||||
local ds = mp.get_property_bool("display-sync-active", false)
|
||||
local target_fps = ds and mp.get_property_number("display-fps", 0)
|
||||
or mp.get_property_number(compat("container-fps"), 0)
|
||||
if target_fps > 0 then target_fps = 1 / target_fps * 1e9 end
|
||||
|
||||
-- Sums of all last/avg/peak values
|
||||
local last_s, avg_s, peak_s = {}, {}, {}
|
||||
for frame, data in pairs(vo_p) do
|
||||
last_s[frame], avg_s[frame], peak_s[frame] = 0, 0, 0
|
||||
for _, pass in ipairs(data) do
|
||||
last_s[frame] = last_s[frame] + pass["last"]
|
||||
avg_s[frame] = avg_s[frame] + pass["avg"]
|
||||
peak_s[frame] = peak_s[frame] + pass["peak"]
|
||||
end
|
||||
end
|
||||
|
||||
-- Pretty print measured time
|
||||
local function pp(i)
|
||||
-- rescale to microseconds for a saner display
|
||||
return format("%05d", i / 1000)
|
||||
end
|
||||
|
||||
-- Format n/m with a font weight based on the ratio
|
||||
local function p(n, m)
|
||||
local i = 0
|
||||
if m > 0 then
|
||||
i = tonumber(n) / m
|
||||
end
|
||||
-- Calculate font weight. 100 is minimum, 400 is normal, 700 bold, 900 is max
|
||||
local w = (700 * math.sqrt(i)) + 200
|
||||
return format("{\\b%d}%02d%%{\\b0}", w, i * 100)
|
||||
end
|
||||
|
||||
s[#s+1] = format("%s%s%s%s{\\fs%s}%s{\\fs%s}", dedicated_page and "" or o.nl, dedicated_page and "" or o.indent,
|
||||
b("Frame Timings:"), o.prefix_sep, o.font_size * 0.66,
|
||||
"(last/average/peak μs)", o.font_size)
|
||||
|
||||
for frame, data in pairs(vo_p) do
|
||||
local f = "%s%s%s{\\fn%s}%s / %s / %s %s%s{\\fn%s}%s%s%s"
|
||||
|
||||
if dedicated_page then
|
||||
s[#s+1] = format("%s%s%s:", o.nl, o.indent,
|
||||
b(frame:gsub("^%l", string.upper)))
|
||||
|
||||
for _, pass in ipairs(data) do
|
||||
s[#s+1] = format(f, o.nl, o.indent, o.indent,
|
||||
o.font_mono, pp(pass["last"]),
|
||||
pp(pass["avg"]), pp(pass["peak"]),
|
||||
o.prefix_sep .. o.prefix_sep, p(pass["last"], last_s[frame]),
|
||||
o.font, o.prefix_sep, o.prefix_sep, pass["desc"])
|
||||
|
||||
if o.plot_perfdata and o.use_ass then
|
||||
s[#s+1] = generate_graph(pass["samples"], pass["count"],
|
||||
pass["count"], pass["peak"],
|
||||
pass["avg"], 0.9, 0.25)
|
||||
end
|
||||
end
|
||||
|
||||
-- Print sum of timing values as "Total"
|
||||
s[#s+1] = format(f, o.nl, o.indent, o.indent,
|
||||
o.font_mono, pp(last_s[frame]),
|
||||
pp(avg_s[frame]), pp(peak_s[frame]), "", "", o.font,
|
||||
o.prefix_sep, o.prefix_sep, b("Total"))
|
||||
else
|
||||
-- for the simplified view, we just print the sum of each pass
|
||||
s[#s+1] = format(f, o.nl, o.indent, o.indent, o.font_mono,
|
||||
pp(last_s[frame]), pp(avg_s[frame]), pp(peak_s[frame]),
|
||||
"", "", o.font, o.prefix_sep, o.prefix_sep,
|
||||
frame:gsub("^%l", string.upper))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function append_display_sync(s)
|
||||
if not mp.get_property_bool("display-sync-active", false) then
|
||||
return
|
||||
end
|
||||
|
||||
local vspeed = append_property(s, "video-speed-correction", {prefix="DS:"})
|
||||
if vspeed then
|
||||
append_property(s, "audio-speed-correction",
|
||||
{prefix="/", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true})
|
||||
else
|
||||
append_property(s, "audio-speed-correction",
|
||||
{prefix="DS:" .. o.prefix_sep .. " - / ", prefix_sep=""})
|
||||
end
|
||||
|
||||
append_property(s, "mistimed-frame-count", {prefix="Mistimed:", nl=""})
|
||||
append_property(s, "vo-delayed-frame-count", {prefix="Delayed:", nl=""})
|
||||
|
||||
-- As we need to plot some graphs we print jitter and ratio on their own lines
|
||||
if toggle_timer:is_enabled() and (o.plot_vsync_ratio or o.plot_vsync_jitter) and o.use_ass then
|
||||
local ratio_graph = ""
|
||||
local jitter_graph = ""
|
||||
if o.plot_vsync_ratio then
|
||||
ratio_graph = generate_graph(vsratio_buf, vsratio_buf.pos, vsratio_buf.len, vsratio_buf.max, nil, 0.8, 1)
|
||||
end
|
||||
if o.plot_vsync_jitter then
|
||||
jitter_graph = generate_graph(vsjitter_buf, vsjitter_buf.pos, vsjitter_buf.len, vsjitter_buf.max, nil, 0.8, 1)
|
||||
end
|
||||
append_property(s, "vsync-ratio", {prefix="VSync Ratio:", suffix=o.prefix_sep .. ratio_graph})
|
||||
append_property(s, "vsync-jitter", {prefix="VSync Jitter:", suffix=o.prefix_sep .. jitter_graph})
|
||||
else
|
||||
-- Since no graph is needed we can print ratio/jitter on the same line and save some space
|
||||
local vratio = append_property(s, "vsync-ratio", {prefix="VSync Ratio:"})
|
||||
append_property(s, "vsync-jitter", {prefix="VSync Jitter:", nl="" or o.nl})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function append_filters(s, prop, prefix)
|
||||
local length = 0
|
||||
local filters = {}
|
||||
|
||||
for _,f in ipairs(mp.get_property_native(prop, {})) do
|
||||
local n = f.name
|
||||
if f.enabled ~= nil and not f.enabled then
|
||||
n = n .. " (disabled)"
|
||||
end
|
||||
|
||||
local p = {}
|
||||
for key,value in pairs(f.params) do
|
||||
p[#p+1] = key .. "=" .. value
|
||||
end
|
||||
if #p > 0 then
|
||||
p = " [" .. table.concat(p, " ") .. "]"
|
||||
else
|
||||
p = ""
|
||||
end
|
||||
|
||||
length = length + n:len() + p:len()
|
||||
filters[#filters+1] = no_ASS(n) .. it(no_ASS(p))
|
||||
end
|
||||
|
||||
if #filters > 0 then
|
||||
local ret
|
||||
if length < o.filter_params_max_length then
|
||||
ret = table.concat(filters, ", ")
|
||||
else
|
||||
local sep = o.nl .. o.indent .. o.indent
|
||||
ret = sep .. table.concat(filters, sep)
|
||||
end
|
||||
s[#s+1] = o.nl .. o.indent .. b(prefix) .. o.prefix_sep .. ret
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function add_header(s)
|
||||
s[#s+1] = text_style()
|
||||
end
|
||||
|
||||
|
||||
local function add_file(s)
|
||||
append_property(s, "filename", {prefix="File:", nl="", indent=""})
|
||||
if not (mp.get_property_osd("filename") == mp.get_property_osd("media-title")) then
|
||||
append_property(s, "media-title", {prefix="Title:"})
|
||||
end
|
||||
|
||||
local ch_index = mp.get_property_number("chapter")
|
||||
if ch_index and ch_index >= 0 then
|
||||
append_property(s, "chapter-list/" .. tostring(ch_index) .. "/title", {prefix="Chapter:"})
|
||||
append_property(s, "chapter-list/count",
|
||||
{prefix="(" .. tostring(ch_index + 1) .. "/", suffix=")", nl="",
|
||||
indent=" ", prefix_sep=" ", no_prefix_markup=true})
|
||||
end
|
||||
if append_property(s, "cache-used", {prefix="Cache:"}) then
|
||||
append_property(s, "demuxer-cache-duration",
|
||||
{prefix="+", suffix=" sec", nl="", indent=o.prefix_sep,
|
||||
prefix_sep="", no_prefix_markup=true})
|
||||
append_property(s, "cache-speed",
|
||||
{prefix="", suffix="", nl="", indent=o.prefix_sep,
|
||||
prefix_sep="", no_prefix_markup=true})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function add_video(s)
|
||||
if not has_video() then
|
||||
return
|
||||
end
|
||||
|
||||
if append_property(s, "video-codec", {prefix=o.nl .. o.nl .. "Video:", nl="", indent=""}) then
|
||||
append_property(s, "hwdec-current",
|
||||
{prefix="(hwdec:", nl="", indent=" ",
|
||||
no_prefix_markup=true, suffix=")"},
|
||||
{no=true, [""]=true})
|
||||
end
|
||||
append_property(s, "avsync", {prefix="A-V:"})
|
||||
if append_property(s, compat("decoder-frame-drop-count"), {prefix="Dropped Frames:", suffix=" (decoder)"}) then
|
||||
append_property(s, compat("frame-drop-count"), {suffix=" (output)", nl="", indent=""})
|
||||
end
|
||||
if append_property(s, "display-fps", {prefix="Display FPS:", suffix=" (specified)"}) then
|
||||
append_property(s, "estimated-display-fps",
|
||||
{suffix=" (estimated)", nl="", indent=""})
|
||||
else
|
||||
append_property(s, "estimated-display-fps",
|
||||
{prefix="Display FPS:", suffix=" (estimated)"})
|
||||
end
|
||||
if append_property(s, compat("container-fps"), {prefix="FPS:", suffix=" (specified)"}) then
|
||||
append_property(s, "estimated-vf-fps",
|
||||
{suffix=" (estimated)", nl="", indent=""})
|
||||
else
|
||||
append_property(s, "estimated-vf-fps",
|
||||
{prefix="FPS:", suffix=" (estimated)"})
|
||||
end
|
||||
|
||||
append_display_sync(s)
|
||||
append_perfdata(s, o.print_perfdata_passes)
|
||||
|
||||
if append_property(s, "video-params/w", {prefix="Native Resolution:"}) then
|
||||
append_property(s, "video-params/h",
|
||||
{prefix="x", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true})
|
||||
end
|
||||
append_property(s, "window-scale", {prefix="Window Scale:"})
|
||||
append_property(s, "video-params/aspect", {prefix="Aspect Ratio:"})
|
||||
append_property(s, "video-params/pixelformat", {prefix="Pixel Format:"})
|
||||
|
||||
-- Group these together to save vertical space
|
||||
local prim = append_property(s, "video-params/primaries", {prefix="Primaries:"})
|
||||
local cmat = append_property(s, "video-params/colormatrix",
|
||||
{prefix="Colormatrix:", nl=prim and "" or o.nl})
|
||||
append_property(s, "video-params/colorlevels", {prefix="Levels:", nl=cmat and "" or o.nl})
|
||||
|
||||
-- Append HDR metadata conditionally (only when present and interesting)
|
||||
local hdrpeak = mp.get_property_number("video-params/sig-peak", 0)
|
||||
local hdrinfo = ""
|
||||
if hdrpeak > 1 then
|
||||
hdrinfo = " (HDR peak: " .. hdrpeak .. ")"
|
||||
end
|
||||
|
||||
append_property(s, "video-params/gamma", {prefix="Gamma:", suffix=hdrinfo})
|
||||
append_property(s, "packet-video-bitrate", {prefix="Bitrate:", suffix=" kbps"})
|
||||
append_filters(s, "vf", "Filters:")
|
||||
end
|
||||
|
||||
|
||||
local function add_audio(s)
|
||||
if not has_audio() then
|
||||
return
|
||||
end
|
||||
|
||||
append_property(s, "audio-codec", {prefix=o.nl .. o.nl .. "Audio:", nl="", indent=""})
|
||||
append_property(s, "audio-params/samplerate", {prefix="Sample Rate:", suffix=" Hz"})
|
||||
append_property(s, "audio-params/channel-count", {prefix="Channels:"})
|
||||
append_property(s, "packet-audio-bitrate", {prefix="Bitrate:", suffix=" kbps"})
|
||||
append_filters(s, "af", "Filters:")
|
||||
end
|
||||
|
||||
|
||||
-- Determine whether ASS formatting shall/can be used
|
||||
local function eval_ass_formatting()
|
||||
o.use_ass = o.ass_formatting and has_vo_window()
|
||||
if o.use_ass then
|
||||
o.nl = o.ass_nl
|
||||
o.indent = o.ass_indent
|
||||
o.prefix_sep = o.ass_prefix_sep
|
||||
o.b1 = o.ass_b1
|
||||
o.b0 = o.ass_b0
|
||||
o.it1 = o.ass_it1
|
||||
o.it0 = o.ass_it0
|
||||
else
|
||||
o.nl = o.no_ass_nl
|
||||
o.indent = o.no_ass_indent
|
||||
o.prefix_sep = o.no_ass_prefix_sep
|
||||
if not has_ansi() then
|
||||
o.b1 = ""
|
||||
o.b0 = ""
|
||||
o.it1 = ""
|
||||
o.it0 = ""
|
||||
else
|
||||
o.b1 = o.no_ass_b1
|
||||
o.b0 = o.no_ass_b0
|
||||
o.it1 = o.no_ass_it1
|
||||
o.it0 = o.no_ass_it0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Returns an ASS string with "normal" stats
|
||||
local function default_stats()
|
||||
local stats = {}
|
||||
eval_ass_formatting()
|
||||
add_header(stats)
|
||||
add_file(stats)
|
||||
add_video(stats)
|
||||
add_audio(stats)
|
||||
return table.concat(stats)
|
||||
end
|
||||
|
||||
|
||||
-- Returns an ASS string with extended VO stats
|
||||
local function vo_stats()
|
||||
local stats = {}
|
||||
eval_ass_formatting()
|
||||
add_header(stats)
|
||||
append_perfdata(stats, true)
|
||||
return table.concat(stats)
|
||||
end
|
||||
|
||||
|
||||
-- Returns an ASS string with stats about filters/profiles/shaders
|
||||
local function filter_stats()
|
||||
return "coming soon"
|
||||
end
|
||||
|
||||
|
||||
-- Call the function for `page` and print it to OSD
|
||||
local function print_page(page, duration)
|
||||
mp.osd_message(pages[page].f(), duration or o.duration)
|
||||
end
|
||||
|
||||
|
||||
-- Add keybindings for every page
|
||||
local function add_page_bindings()
|
||||
local function a(k)
|
||||
return function()
|
||||
-- In single invocation case we need to reset the timer because
|
||||
-- stats are printed again for o.duration
|
||||
if not toggle_timer:is_enabled() then
|
||||
binding_timer:kill()
|
||||
binding_timer:resume()
|
||||
end
|
||||
curr_page = k
|
||||
print_page(k, toggle_timer:is_enabled() and o.redraw_delay + 1 or nil)
|
||||
end
|
||||
end
|
||||
|
||||
for k, _ in pairs(pages) do
|
||||
mp.add_forced_key_binding(k, k, a(k), {repeatable=true})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function remove_page_bindings()
|
||||
for k, _ in pairs(pages) do
|
||||
mp.remove_key_binding(k)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Returns a function to record vsratio/jitter with the specified `skip` value
|
||||
local function record_data(skip)
|
||||
init_buffers()
|
||||
skip = max(skip, 0)
|
||||
local i = skip
|
||||
return function()
|
||||
if i < skip then
|
||||
i = i + 1
|
||||
return
|
||||
else
|
||||
i = 0
|
||||
end
|
||||
|
||||
if o.plot_vsync_jitter then
|
||||
local r = mp.get_property_number("vsync-jitter", nil)
|
||||
if r then
|
||||
vsjitter_buf.pos = (vsjitter_buf.pos % vsjitter_buf.len) + 1
|
||||
vsjitter_buf[vsjitter_buf.pos] = r
|
||||
vsjitter_buf.max = max(vsjitter_buf.max, r)
|
||||
end
|
||||
end
|
||||
|
||||
if o.plot_vsync_ratio then
|
||||
local r = mp.get_property_number("vsync-ratio", nil)
|
||||
if r then
|
||||
vsratio_buf.pos = (vsratio_buf.pos % vsratio_buf.len) + 1
|
||||
vsratio_buf[vsratio_buf.pos] = r
|
||||
vsratio_buf.max = max(vsratio_buf.max, r)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function toggle_stats()
|
||||
-- Disable
|
||||
if toggle_timer:is_enabled() then
|
||||
if recorder then
|
||||
mp.unregister_event(recorder)
|
||||
recorder = nil
|
||||
end
|
||||
toggle_timer:kill()
|
||||
mp.osd_message("", 0) -- clear the screen
|
||||
remove_page_bindings()
|
||||
-- Enable
|
||||
else
|
||||
if o.plot_vsync_jitter or o.plot_vsync_ratio then
|
||||
recorder = record_data(o.skip_frames)
|
||||
mp.register_event("tick", recorder)
|
||||
end
|
||||
add_page_bindings()
|
||||
toggle_timer:resume()
|
||||
print_page(curr_page, o.redraw_delay + 1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function oneshot_stats(page)
|
||||
-- Ignore single invocations while stats are toggled
|
||||
if toggle_timer:is_enabled() then
|
||||
return
|
||||
end
|
||||
binding_timer:kill()
|
||||
binding_timer:resume()
|
||||
add_page_bindings()
|
||||
print_page(page or curr_page)
|
||||
end
|
||||
|
||||
|
||||
-- Current page and <page key>:<page function> mapping
|
||||
curr_page = o.key_page_1
|
||||
pages = {
|
||||
[o.key_page_1] = { f = default_stats, desc = "Default" },
|
||||
[o.key_page_2] = { f = vo_stats, desc = "Extended Frame Timings" },
|
||||
[o.key_page_3] = { f = filter_stats, desc = "Dummy" },
|
||||
}
|
||||
|
||||
|
||||
-- Create timer used for toggling, pause it immediately
|
||||
toggle_timer = mp.add_periodic_timer(o.redraw_delay, function() print_page(curr_page, o.redraw_delay + 1) end)
|
||||
toggle_timer:kill()
|
||||
|
||||
-- Create timer used to remove forced key bindings, only in the "single invocation" case
|
||||
binding_timer = mp.add_periodic_timer(o.duration,
|
||||
function()
|
||||
if not toggle_timer:is_enabled() then
|
||||
remove_page_bindings()
|
||||
end
|
||||
end)
|
||||
binding_timer.oneshot = true
|
||||
binding_timer:kill()
|
||||
|
||||
-- Single invocation key binding
|
||||
mp.add_key_binding(o.key_oneshot, "display-stats", oneshot_stats, {repeatable=true})
|
||||
|
||||
-- Single invocation bindings without key, can be used in input.conf to create
|
||||
-- bindings for a specific page: "e script-binding stats/display-page-2"
|
||||
for k, _ in pairs(pages) do
|
||||
mp.add_key_binding(nil, "display-page-" .. k, function() oneshot_stats(k) end, {repeatable=true})
|
||||
end
|
||||
|
||||
-- Toggling key binding
|
||||
mp.add_key_binding(o.key_toggle, "display-stats-toggle", toggle_stats, {repeatable=false})
|
||||
|
||||
-- Reprint stats immediately when VO was reconfigured, only when toggled
|
||||
mp.register_event("video-reconfig",
|
||||
function()
|
||||
if toggle_timer:is_enabled() then
|
||||
print_page(curr_page, o.redraw_delay + 1)
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,3 @@
|
|||
[editor]
|
||||
terminal = alacritty
|
||||
gui_if_available = False
|
|
@ -0,0 +1,169 @@
|
|||
# This is a sample commands.py. You can add your own commands here.
|
||||
#
|
||||
# Please refer to commands_full.py for all the default commands and a complete
|
||||
# documentation. Do NOT add them all here, or you may end up with defunct
|
||||
# commands when upgrading ranger.
|
||||
|
||||
# You always need to import ranger.api.commands here to get the Command class:
|
||||
from ranger.api.commands import *
|
||||
|
||||
# A simple command for demonstration purposes follows.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# You can import any python module as needed.
|
||||
import os
|
||||
|
||||
# Any class that is a subclass of "Command" will be integrated into ranger as a
|
||||
# command. Try typing ":my_edit<ENTER>" in ranger!
|
||||
|
||||
|
||||
class my_edit(Command):
|
||||
# The so-called doc-string of the class will be visible in the built-in
|
||||
# help that is accessible by typing "?c" inside ranger.
|
||||
""":my_edit <filename>
|
||||
|
||||
A sample command for demonstration purposes that opens a file in an editor.
|
||||
"""
|
||||
|
||||
# The execute method is called when you run this command in ranger.
|
||||
def execute(self):
|
||||
# self.arg(1) is the first (space-separated) argument to the function.
|
||||
# This way you can write ":my_edit somefilename<ENTER>".
|
||||
if self.arg(1):
|
||||
# self.rest(1) contains self.arg(1) and everything that follows
|
||||
target_filename = self.rest(1)
|
||||
else:
|
||||
# self.fm is a ranger.core.filemanager.FileManager object and gives
|
||||
# you access to internals of ranger.
|
||||
# self.fm.thisfile is a ranger.container.file.File object and is a
|
||||
# reference to the currently selected file.
|
||||
target_filename = self.fm.thisfile.path
|
||||
|
||||
# This is a generic function to print text in ranger.
|
||||
self.fm.notify("Let's edit the file " + target_filename + "!")
|
||||
|
||||
# Using bad=True in fm.notify allows you to print error messages:
|
||||
if not os.path.exists(target_filename):
|
||||
self.fm.notify("The given file does not exist!", bad=True)
|
||||
return
|
||||
|
||||
# This executes a function from ranger.core.acitons, a module with a
|
||||
# variety of subroutines that can help you construct commands.
|
||||
# Check out the source, or run "pydoc ranger.core.actions" for a list.
|
||||
self.fm.edit_file(target_filename)
|
||||
|
||||
# The tab method is called when you press tab, and should return a list of
|
||||
# suggestions that the user will tab through.
|
||||
# tabnum is 1 for <TAB> and -1 for <S-TAB> by default
|
||||
def tab(self, tabnum):
|
||||
# This is a generic tab-completion function that iterates through the
|
||||
# content of the current directory.
|
||||
return self._tab_directory_content()
|
||||
|
||||
class mkcd(Command):
|
||||
"""
|
||||
:mkcd <dirname>
|
||||
|
||||
Creates a directory with the name <dirname> and enters it.
|
||||
"""
|
||||
|
||||
def execute(self):
|
||||
from os.path import join, expanduser, lexists
|
||||
from os import makedirs
|
||||
import re
|
||||
|
||||
dirname = join(self.fm.thisdir.path, expanduser(self.rest(1)))
|
||||
if not lexists(dirname):
|
||||
makedirs(dirname)
|
||||
|
||||
match = re.search('^/|^~[^/]*/', dirname)
|
||||
if match:
|
||||
self.fm.cd(match.group(0))
|
||||
dirname = dirname[match.end(0):]
|
||||
|
||||
for m in re.finditer('[^/]+', dirname):
|
||||
s = m.group(0)
|
||||
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`.
|
||||
self.fm.thisdir.load_content(schedule=False)
|
||||
self.fm.execute_console('scout -ae ^{}$'.format(s))
|
||||
else:
|
||||
self.fm.notify("file/directory exists!", bad=True)
|
||||
|
||||
def get_id3tag_cmd(path, key, val):
|
||||
from ranger.ext.shell_escape import shell_quote
|
||||
return 'id3tag --%s=%s %s' % (key, shell_quote(val), shell_quote(path))
|
||||
|
||||
class id3tag_song(Command):
|
||||
"""
|
||||
:id3tag_song <title>
|
||||
|
||||
Set current file id3 song tag to <title>
|
||||
"""
|
||||
|
||||
def execute(self):
|
||||
self.fm.execute_command(get_id3tag_cmd(self.fm.thisfile.path, 'song', self.rest(1)))
|
||||
|
||||
class id3tag_artist(Command):
|
||||
"""
|
||||
:id3tag_artist <artist>
|
||||
|
||||
Set current file id3 artist tag to <artist>
|
||||
"""
|
||||
|
||||
def execute(self):
|
||||
self.fm.execute_command(get_id3tag_cmd(self.fm.thisfile.path, 'artist', self.rest(1)))
|
||||
|
||||
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
|
||||
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, 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)
|
||||
|
||||
class fzf_locate(Command):
|
||||
"""
|
||||
:fzf_locate
|
||||
|
||||
Find a file using fzf
|
||||
|
||||
See: https://github.com/junegunn/fzf
|
||||
"""
|
||||
def execute(self):
|
||||
import subprocess
|
||||
if self.quantifier:
|
||||
command="locate home media | fzf -e -i"
|
||||
else:
|
||||
command="locate home media | fzf -e -i"
|
||||
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)
|
|
@ -0,0 +1,622 @@
|
|||
# ===================================================================
|
||||
# This file contains the default startup commands for ranger.
|
||||
# To change them, it is recommended to create the file
|
||||
# ~/.config/ranger/rc.conf and add your custom commands there.
|
||||
#
|
||||
# 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
|
||||
#set viewmode multipane
|
||||
|
||||
# How many columns are there, and what are their relative widths?
|
||||
set column_ratios 1,3,3
|
||||
|
||||
# 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 false
|
||||
|
||||
# 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 always
|
||||
|
||||
# Which script is used to generate file previews?
|
||||
# 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
|
||||
|
||||
# Automatically count files in the directory, even before entering them?
|
||||
set automatically_count_files false
|
||||
|
||||
# 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
|
||||
|
||||
# Be aware of version control systems and display information.
|
||||
set vcs_aware true
|
||||
|
||||
# State of the three backends git, hg, bzr. The possible states are
|
||||
# disabled, local (only show local info), enabled (show local and remote
|
||||
# information).
|
||||
set vcs_backend_git enabled
|
||||
set vcs_backend_hg disabled
|
||||
set vcs_backend_bzr disabled
|
||||
|
||||
# Use one of the supported image preview protocols
|
||||
set preview_images true
|
||||
|
||||
# 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.
|
||||
#
|
||||
# * 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.
|
||||
set preview_images_method w3m
|
||||
|
||||
# Use a unicode "..." character to mark cut-off filenames?
|
||||
set unicode_ellipsis 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
|
||||
|
||||
# Preview files on the rightmost column?
|
||||
# And collapse (shrink) the last column if there is nothing to preview?
|
||||
set preview_files true
|
||||
set preview_directories true
|
||||
set collapse_preview true
|
||||
|
||||
# Save the console history on exit?
|
||||
set save_console_history false
|
||||
|
||||
# Draw the status bar on top of the browser window (default: bottom)
|
||||
set status_bar_on_top true
|
||||
|
||||
# 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
|
||||
|
||||
# Draw borders around columns?
|
||||
set draw_borders true
|
||||
|
||||
# Display the directory name in tabs?
|
||||
set dirname_in_tabs false
|
||||
|
||||
# Enable the mouse support?
|
||||
set mouse_enabled true
|
||||
|
||||
# Display the file size in the main column or status bar?
|
||||
set display_size_in_main_column false
|
||||
set display_size_in_status_bar true
|
||||
|
||||
# Display files tags in all columns or only in main column?
|
||||
set display_tags_in_all_columns true
|
||||
|
||||
# Set a title for the window?
|
||||
set update_title true
|
||||
|
||||
# Set the title to "ranger" in the tmux program?
|
||||
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
|
||||
|
||||
# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
|
||||
set tilde_in_titlebar true
|
||||
|
||||
# How many directory-changes or console-commands should be kept in history?
|
||||
set max_history_size 20
|
||||
set max_console_history_size 50
|
||||
|
||||
# Try to keep so much space between the top/bottom border when scrolling:
|
||||
set scroll_offset 8
|
||||
|
||||
# Flush the input after each key hit? (Noticeable when ranger lags)
|
||||
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
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
# Turning this on makes sense for screen readers:
|
||||
set show_cursor false
|
||||
|
||||
# One of: size, natural, basename, atime, ctime, mtime, type, random
|
||||
set sort natural
|
||||
|
||||
# Additional sorting options
|
||||
set sort_reverse false
|
||||
set sort_case_insensitive false
|
||||
set sort_directories_first true
|
||||
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
|
||||
|
||||
# Whether to include bookmarks in cd command
|
||||
set cd_bookmarks true
|
||||
|
||||
# Avoid previewing files larger than this size, in bytes. Use a value of 0 to
|
||||
# disable this feature.
|
||||
set preview_max_size 0
|
||||
|
||||
# Add the highlighted file to the path in the titlebar
|
||||
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
|
||||
|
||||
# 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
|
||||
|
||||
# Clear all existing filters when leaving a directory
|
||||
set clear_filters_on_dir_change false
|
||||
|
||||
# Disable displaying line numbers in main column
|
||||
set line_numbers false
|
||||
|
||||
# ===================================================================
|
||||
# == Local Options
|
||||
# ===================================================================
|
||||
# You can set local options that only affect a single directory.
|
||||
|
||||
# Examples:
|
||||
# setlocal path=~/downloads sort mtime
|
||||
|
||||
# ===================================================================
|
||||
# == Command Aliases in the Console
|
||||
# ===================================================================
|
||||
|
||||
alias e edit
|
||||
alias q quit
|
||||
alias q! quitall
|
||||
alias qa 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 -aefiklst
|
||||
|
||||
# ===================================================================
|
||||
# == Define keys for the browser
|
||||
# ===================================================================
|
||||
|
||||
# Basic
|
||||
map Q quit!
|
||||
map q quit
|
||||
copymap q ZZ ZQ
|
||||
|
||||
map R reload_cwd
|
||||
map <C-r> reset
|
||||
map <C-l> redraw_window
|
||||
map <C-c> abort
|
||||
map <esc> 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 r chain draw_possible_programs; console open_with%%space
|
||||
map f console find%space
|
||||
map cd console cd%space
|
||||
|
||||
# Change the line mode
|
||||
map Mf linemode filename
|
||||
map Mi linemode fileinfo
|
||||
map Mm linemode mtime
|
||||
map Mp linemode permissions
|
||||
map Ms linemode sizemtime
|
||||
map Mt linemode metatitle
|
||||
|
||||
# Tagging / Marking
|
||||
map t tag_toggle
|
||||
map ut tag_remove
|
||||
map "<any> tag_toggle tag=%any
|
||||
map <Space> mark_files toggle=True
|
||||
map v mark_files all=True toggle=True
|
||||
map uv mark_files all=True val=False
|
||||
map V toggle_visual_mode
|
||||
map uV toggle_visual_mode reverse=True
|
||||
|
||||
# For the nostalgics: Midnight Commander bindings
|
||||
map <F1> help
|
||||
map <F3> display_file
|
||||
map <F4> edit
|
||||
map <F5> copy
|
||||
map <F6> cut
|
||||
map <F7> console mkdir%space
|
||||
map <F8> console delete
|
||||
map <F10> exit
|
||||
|
||||
# In case you work on a keyboard with dvorak layout
|
||||
map <UP> move up=1
|
||||
map <DOWN> move down=1
|
||||
map <LEFT> move left=1
|
||||
map <RIGHT> move right=1
|
||||
map <HOME> move to=0
|
||||
map <END> move to=-1
|
||||
map <PAGEDOWN> move down=1 pages=True
|
||||
map <PAGEUP> move up=1 pages=True
|
||||
map <CR> move right=1
|
||||
#map <DELETE> console delete
|
||||
map <INSERT> console touch%space
|
||||
|
||||
# VIM-like
|
||||
copymap <UP> k
|
||||
copymap <DOWN> j
|
||||
copymap <LEFT> h
|
||||
copymap <RIGHT> l
|
||||
copymap <HOME> gg
|
||||
copymap <END> G
|
||||
copymap <PAGEDOWN> <C-F>
|
||||
copymap <PAGEUP> <C-B>
|
||||
|
||||
map J move down=0.5 pages=True
|
||||
map K move up=0.5 pages=True
|
||||
copymap J <C-D>
|
||||
copymap K <C-U>
|
||||
|
||||
# Jumping around
|
||||
map H history_go -1
|
||||
map L history_go 1
|
||||
map ] move_parent 1
|
||||
map [ move_parent -1
|
||||
map } traverse
|
||||
|
||||
map gh cd ~
|
||||
map ge cd /etc
|
||||
map gu cd /usr
|
||||
map gd cd /dev
|
||||
map gl cd -r .
|
||||
map gL cd -r %f
|
||||
map go cd /opt
|
||||
map gv cd /var
|
||||
map gm cd /media
|
||||
map gM cd /mnt
|
||||
map gs cd /srv
|
||||
map gr cd /
|
||||
map gR eval fm.cd(ranger.RANGERDIR)
|
||||
map g/ cd /
|
||||
map g? cd /usr/share/doc/ranger
|
||||
|
||||
# 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 shell -f echo -n %d/%f | xsel -i; xsel -o | xsel -i -b
|
||||
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
|
||||
|
||||
# Filesystem Operations
|
||||
map = chmod
|
||||
|
||||
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
|
||||
map po paste overwrite=True
|
||||
map pP paste append=True
|
||||
map pO paste overwrite=True append=True
|
||||
map pl paste_symlink relative=False
|
||||
map pL paste_symlink relative=True
|
||||
map phl paste_hardlink
|
||||
map pht paste_hardlinked_subtree
|
||||
|
||||
map dD console delete
|
||||
|
||||
map dd cut
|
||||
map ud uncut
|
||||
map da cut mode=add
|
||||
map dr cut mode=remove
|
||||
map dt cut mode=toggle
|
||||
|
||||
map yy copy
|
||||
map uy uncut
|
||||
map ya copy mode=add
|
||||
map yr copy mode=remove
|
||||
map yt copy mode=toggle
|
||||
|
||||
# Temporary workarounds
|
||||
map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
|
||||
map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
|
||||
map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
|
||||
map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
|
||||
map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
|
||||
map yG eval fm.copy(dirarg=dict(to=-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)
|
||||
|
||||
# Searching
|
||||
map / console search%space
|
||||
map n search_next
|
||||
map N search_next forward=False
|
||||
map ct search_next order=tag
|
||||
map cs search_next order=size
|
||||
map ci search_next order=mimetype
|
||||
map cc search_next order=ctime
|
||||
map cm search_next order=mtime
|
||||
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
|
||||
|
||||
# Sorting
|
||||
map or set sort_reverse!
|
||||
map oz set sort=random
|
||||
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 om chain set sort=mtime; set sort_reverse=False
|
||||
map oc chain set sort=ctime; set sort_reverse=False
|
||||
map oa chain set sort=atime; set sort_reverse=False
|
||||
map ot chain set sort=type; set sort_reverse=False
|
||||
map oe chain set sort=extension; set sort_reverse=False
|
||||
|
||||
map oS chain set sort=size; set sort_reverse=True
|
||||
map oB chain set sort=basename; set sort_reverse=True
|
||||
map oN chain set sort=natural; set sort_reverse=True
|
||||
map oM chain set sort=mtime; set sort_reverse=True
|
||||
map oC chain set sort=ctime; set sort_reverse=True
|
||||
map oA chain set sort=atime; set sort_reverse=True
|
||||
map oT chain set sort=type; set sort_reverse=True
|
||||
map oE chain set sort=extension; set sort_reverse=True
|
||||
|
||||
map dc get_cumulative_size
|
||||
|
||||
# Settings
|
||||
map zc set collapse_preview!
|
||||
map zd set sort_directories_first!
|
||||
map zh set show_hidden!
|
||||
map <C-h> set show_hidden!
|
||||
map zI set flushinput!
|
||||
map zi set preview_images!
|
||||
map zm set mouse_enabled!
|
||||
map zp set preview_files!
|
||||
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
|
||||
|
||||
# Bookmarks
|
||||
map `<any> enter_bookmark %any
|
||||
map '<any> enter_bookmark %any
|
||||
map m<any> set_bookmark %any
|
||||
map um<any> unset_bookmark %any
|
||||
|
||||
map m<bg> draw_bookmarks
|
||||
copymap m<bg> um<bg> `<bg> '<bg>
|
||||
|
||||
# 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
|
||||
# ===================================================================
|
||||
# Note: Unmapped keys are passed directly to the console.
|
||||
|
||||
# Basic
|
||||
cmap <tab> eval fm.ui.console.tab()
|
||||
cmap <s-tab> eval fm.ui.console.tab(-1)
|
||||
cmap <ESC> eval fm.ui.console.close()
|
||||
cmap <CR> eval fm.ui.console.execute()
|
||||
cmap <C-l> redraw_window
|
||||
|
||||
copycmap <ESC> <C-c>
|
||||
copycmap <CR> <C-j>
|
||||
|
||||
# Move around
|
||||
cmap <up> eval fm.ui.console.history_move(-1)
|
||||
cmap <down> eval fm.ui.console.history_move(1)
|
||||
cmap <left> eval fm.ui.console.move(left=1)
|
||||
cmap <right> eval fm.ui.console.move(right=1)
|
||||
cmap <home> eval fm.ui.console.move(right=0, absolute=True)
|
||||
cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
|
||||
cmap <a-left> eval fm.ui.console.move_word(left=1)
|
||||
cmap <a-right> eval fm.ui.console.move_word(right=1)
|
||||
|
||||
# Line Editing
|
||||
cmap <backspace> eval fm.ui.console.delete(-1)
|
||||
cmap <delete> eval fm.ui.console.delete(0)
|
||||
cmap <C-w> eval fm.ui.console.delete_word()
|
||||
cmap <A-d> eval fm.ui.console.delete_word(backward=False)
|
||||
cmap <C-k> 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()
|
||||
|
||||
# And of course the emacs way
|
||||
copycmap <up> <C-p>
|
||||
copycmap <down> <C-n>
|
||||
copycmap <left> <C-b>
|
||||
copycmap <right> <C-f>
|
||||
copycmap <home> <C-a>
|
||||
copycmap <end> <C-e>
|
||||
copycmap <delete> <C-d>
|
||||
copycmap <backspace> <C-h>
|
||||
|
||||
# Note: There are multiple ways to express backspaces. <backspace> (code 263)
|
||||
# and <backspace2> (code 127). To be sure, use both.
|
||||
copycmap <backspace> <backspace2>
|
||||
|
||||
# This special expression allows typing in numerals:
|
||||
cmap <allow_quantifiers> false
|
||||
|
||||
# ===================================================================
|
||||
# == Pager Keybindings
|
||||
# ===================================================================
|
||||
|
||||
# Movement
|
||||
pmap <down> pager_move down=1
|
||||
pmap <up> pager_move up=1
|
||||
pmap <left> pager_move left=4
|
||||
pmap <right> pager_move right=4
|
||||
pmap <home> pager_move to=0
|
||||
pmap <end> pager_move to=-1
|
||||
pmap <pagedown> pager_move down=1.0 pages=True
|
||||
pmap <pageup> pager_move up=1.0 pages=True
|
||||
pmap <C-d> pager_move down=0.5 pages=True
|
||||
pmap <C-u> pager_move up=0.5 pages=True
|
||||
|
||||
copypmap <UP> k <C-p>
|
||||
copypmap <DOWN> j <C-n> <CR>
|
||||
copypmap <LEFT> h
|
||||
copypmap <RIGHT> l
|
||||
copypmap <HOME> g
|
||||
copypmap <END> G
|
||||
copypmap <C-d> d
|
||||
copypmap <C-u> u
|
||||
copypmap <PAGEDOWN> n f <C-F> <Space>
|
||||
copypmap <PAGEUP> p b <C-B>
|
||||
|
||||
# Basic
|
||||
pmap <C-l> redraw_window
|
||||
pmap <ESC> pager_close
|
||||
copypmap <ESC> q Q i <F3>
|
||||
pmap E edit_file
|
||||
|
||||
# ===================================================================
|
||||
# == Taskview Keybindings
|
||||
# ===================================================================
|
||||
|
||||
# Movement
|
||||
tmap <up> taskview_move up=1
|
||||
tmap <down> taskview_move down=1
|
||||
tmap <home> taskview_move to=0
|
||||
tmap <end> taskview_move to=-1
|
||||
tmap <pagedown> taskview_move down=1.0 pages=True
|
||||
tmap <pageup> taskview_move up=1.0 pages=True
|
||||
tmap <C-d> taskview_move down=0.5 pages=True
|
||||
tmap <C-u> taskview_move up=0.5 pages=True
|
||||
|
||||
copytmap <UP> k <C-p>
|
||||
copytmap <DOWN> j <C-n> <CR>
|
||||
copytmap <HOME> g
|
||||
copytmap <END> G
|
||||
copytmap <C-u> u
|
||||
copytmap <PAGEDOWN> n f <C-F> <Space>
|
||||
copytmap <PAGEUP> p b <C-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 <pagedown> eval -q fm.ui.taskview.task_move(-1)
|
||||
tmap <pageup> eval -q fm.ui.taskview.task_move(0)
|
||||
tmap <delete> eval -q fm.ui.taskview.task_remove()
|
||||
|
||||
# Basic
|
||||
tmap <C-l> redraw_window
|
||||
tmap <ESC> taskview_close
|
||||
copytmap <ESC> q Q w <C-c>
|
||||
# a plugin that adds file glyphs / icon support to Ranger:
|
||||
# https://github.com/alexanderjeurissen/ranger_devicons
|
||||
default_linemode devicons
|
||||
|
||||
map <C-f> fzf_select
|
||||
map <C-g> fzf_locate
|
||||
|
||||
# i3tag
|
||||
map Is console id3tag_song%space
|
||||
map Ia console id3tag_artist%space
|
|
@ -0,0 +1,215 @@
|
|||
# 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:
|
||||
# <condition1> , <condition2> , ... = 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 <regexp> | The regexp matches $1
|
||||
# ext <regexp> | The regexp matches the extension of $1
|
||||
# mime <regexp> | The regexp matches the mime type of $1
|
||||
# name <regexp> | The regexp matches the basename of $1
|
||||
# path <regexp> | The regexp matches the absolute path of $1
|
||||
# has <program> | The program is installed (i.e. located in $PATH)
|
||||
# env <variable> | The environment variable "variable" is non-empty
|
||||
# file | $1 is a file
|
||||
# directory | $1 is a directory
|
||||
# number <n> | 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 <flags> | Change how the program is run. See below.
|
||||
# label <label> | Assign a label or name to the command so it can
|
||||
# | be started with :open_with <label> in ranger
|
||||
# | or `rifle -p <label>` in the standalone executable.
|
||||
# else | Always true.
|
||||
#
|
||||
# Flags are single characters which slightly transform the command:
|
||||
# f | Fork the program, make it run in the background.
|
||||
# | New command = setsid $command >& /dev/null &
|
||||
# r | Execute the command with root permissions
|
||||
# | New command = sudo $command
|
||||
# t | Run the program in a new terminal. If $TERMCMD is not defined,
|
||||
# | rifle will attempt to extract it from $TERM.
|
||||
# | New command = $TERMCMD -e $command
|
||||
# Note: The "New command" serves only as an illustration, the exact
|
||||
# implementation may differ.
|
||||
# Note: When using rifle in ranger, there is an additional flag "c" for
|
||||
# only running the current file even if you have marked multiple files.
|
||||
|
||||
#-------------------------------------------
|
||||
# Websites
|
||||
#-------------------------------------------
|
||||
# Rarely installed browsers get higher priority; It is assumed that if you
|
||||
# install a rare browser, you probably use it. Firefox/konqueror/w3m on the
|
||||
# other hand are often only installed as fallback browsers.
|
||||
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 -- "$@"
|
||||
ext x?html?, has uzbl, X, flag f = uzbl -- "$@"
|
||||
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-core, X, flag f = uzbl-core -- "$@"
|
||||
ext x?html?, has midori, X, flag f = midori -- "$@"
|
||||
ext x?html?, has chromium, X, flag f = chromium -- "$@"
|
||||
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 konqueror, X, flag f = konqueror -- "$@"
|
||||
ext x?html?, has elinks, terminal = elinks "$@"
|
||||
ext x?html?, has links2, terminal = links2 "$@"
|
||||
ext x?html?, has links, terminal = links "$@"
|
||||
ext x?html?, has lynx, terminal = lynx -- "$@"
|
||||
ext x?html?, has w3m, terminal = w3m "$@"
|
||||
|
||||
#-------------------------------------------
|
||||
# Misc
|
||||
#-------------------------------------------
|
||||
# Define the "editor" for text files as first action
|
||||
mime ^text, label editor = $EDITOR -- "$@"
|
||||
mime ^text, label pager = "$PAGER" -- "$@"
|
||||
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@"
|
||||
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
|
||||
|
||||
ext 1 = man "$1"
|
||||
ext s[wmf]c, has zsnes, X = zsnes "$1"
|
||||
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
|
||||
ext nes, has fceux, X = fceux "$1"
|
||||
ext exe = wine "$1"
|
||||
name ^[mM]akefile$ = make
|
||||
|
||||
#--------------------------------------------
|
||||
# Code
|
||||
#-------------------------------------------
|
||||
ext py = python -- "$1"
|
||||
ext pl = perl -- "$1"
|
||||
ext rb = ruby -- "$1"
|
||||
ext js = node -- "$1"
|
||||
ext sh = sh -- "$1"
|
||||
ext php = php -- "$1"
|
||||
|
||||
# Java
|
||||
ext jar, has java, flag f = java "$@"
|
||||
|
||||
mine ^audio|video, has mpv, flag f = mpv -- "$@" > /dev/null &
|
||||
#--------------------------------------------
|
||||
# Audio without X
|
||||
#-------------------------------------------
|
||||
mime ^audio|ogg$, terminal, has mpv = mpv -- "$@" > /dev/null &
|
||||
mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
|
||||
mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@"
|
||||
ext midi?, terminal, has wildmidi = wildmidi -- "$@"
|
||||
|
||||
#--------------------------------------------
|
||||
# Video/Audio with a GUI
|
||||
#-------------------------------------------
|
||||
mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
|
||||
mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
|
||||
mime ^video, has mpv, X, flag f = mpv -- "$@" > /dev/null &
|
||||
mime ^video, has mpv, X, flag f = mpv --fs -- "$@" > /dev/null &
|
||||
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
|
||||
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 -fs -- "$@"
|
||||
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 --fullscreen -- "$@"
|
||||
|
||||
#--------------------------------------------
|
||||
# Video without X:
|
||||
#-------------------------------------------
|
||||
mime ^video, terminal, !X, has mpv = mpv -- "$@" > /dev/null &
|
||||
mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@"
|
||||
mime ^video, terminal, !X, has mplayer = mplayer -- "$@"
|
||||
|
||||
#-------------------------------------------
|
||||
# Documents
|
||||
#-------------------------------------------
|
||||
ext pdf, has llpp, X, flag f = llpp "$@"
|
||||
ext pdf, has zathura, X, flag f = zathura -- "$@"
|
||||
ext pdf, has mupdf, X, flag f = mupdf "$@"
|
||||
ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@"
|
||||
ext pdf, has apvlv, X, flag f = apvlv -- "$@"
|
||||
ext pdf, has xpdf, X, flag f = xpdf -- "$@"
|
||||
ext pdf, has evince, X, flag f = evince -- "$@"
|
||||
ext pdf, has atril, X, flag f = atril -- "$@"
|
||||
ext pdf, has okular, X, flag f = okular -- "$@"
|
||||
ext pdf, has epdfview, X, flag f = epdfview -- "$@"
|
||||
ext pdf, has qpdfview, X, flag f = qpdfview "$@"
|
||||
|
||||
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 kspread, X, flag f = kspread -- "$@"
|
||||
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
|
||||
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@"
|
||||
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@"
|
||||
|
||||
ext djvu, has zathura,X, flag f = zathura -- "$@"
|
||||
ext djvu, has evince, X, flag f = evince -- "$@"
|
||||
ext djvu, has atril, X, flag f = atril -- "$@"
|
||||
|
||||
#-------------------------------------------
|
||||
# Image Viewing:
|
||||
#-------------------------------------------
|
||||
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
|
||||
mime ^image/svg, has display, X, flag f = display -- "$@"
|
||||
|
||||
mime ^image, has pqiv, X, flag f = pqiv -- "$@"
|
||||
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
|
||||
mime ^image, has feh, X, flag f = feh -. -- "$@"
|
||||
mime ^image, has mirage, X, flag f = mirage -- "$@"
|
||||
mime ^image, has ristretto, X, flag f = ristretto "$@"
|
||||
mime ^image, has eog, X, flag f = eog -- "$@"
|
||||
mime ^image, has eom, X, flag f = eom -- "$@"
|
||||
mime ^image, has gimp, X, flag f = gimp -- "$@"
|
||||
ext xcf, X, flag f = gimp -- "$@"
|
||||
|
||||
#-------------------------------------------
|
||||
# Archives
|
||||
#-------------------------------------------
|
||||
|
||||
# avoid password prompt by providing empty password
|
||||
ext 7z, has 7z = 7z -p l "$@" | "$PAGER"
|
||||
# This requires atool
|
||||
ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has als = als -- "$@" | "$PAGER"
|
||||
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has als = als -- "$@" | "$PAGER"
|
||||
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has aunpack = aunpack -- "$@"
|
||||
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack = aunpack -- "$@"
|
||||
|
||||
# Fallback:
|
||||
ext tar|gz, has tar = tar vvtf "$@" | "$PAGER"
|
||||
ext tar|gz, has tar = tar vvxf "$@"
|
||||
|
||||
#-------------------------------------------
|
||||
# Misc
|
||||
#-------------------------------------------
|
||||
label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1"
|
||||
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 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
|
||||
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@"
|
||||
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
|
||||
|
||||
# The very last action, so that it's never triggered accidentally, is to execute a program:
|
||||
mime application/x-executable = "$1"
|
|
@ -0,0 +1,123 @@
|
|||
#!/usr/bin/env sh
|
||||
# ranger supports enhanced previews. If the option "use_preview_script"
|
||||
# is set to True and this file exists, this script will be called and its
|
||||
# output is displayed in ranger. ANSI color codes are supported.
|
||||
|
||||
# NOTES: This script is considered a configuration file. If you upgrade
|
||||
# ranger, it will be left untouched. (You must update it yourself.)
|
||||
# Also, ranger disables STDIN here, so interactive scripts won't work properly
|
||||
|
||||
# Meanings of exit codes:
|
||||
# code | meaning | action of ranger
|
||||
# -----+------------+-------------------------------------------
|
||||
# 0 | success | success. display stdout as preview
|
||||
# 1 | no preview | failure. display no preview at all
|
||||
# 2 | plain text | display the plain content of the file
|
||||
# 3 | fix width | success. Don't reload when width changes
|
||||
# 4 | fix height | success. Don't reload when height changes
|
||||
# 5 | fix both | success. Don't ever reload
|
||||
# 6 | image | success. display the image $cached points to as an image preview
|
||||
# 7 | image | success. display the file directly as an image
|
||||
|
||||
# Meaningful aliases for arguments:
|
||||
path="$1" # Full path of the selected file
|
||||
width="$2" # Width of the preview pane (number of fitting characters)
|
||||
height="$3" # Height of the preview pane (number of fitting characters)
|
||||
cached="$4" # Path that should be used to cache image previews
|
||||
preview_images="$5" # "True" if image previews are enabled, "False" otherwise.
|
||||
|
||||
maxln=200 # Stop after $maxln lines. Can be used like ls | head -n $maxln
|
||||
|
||||
# Find out something about the file:
|
||||
mimetype=$(file --mime-type -Lb "$path")
|
||||
extension=$(/bin/echo "${path##*.}" | awk '{print tolower($0)}')
|
||||
|
||||
# Functions:
|
||||
# runs a command and saves its output into $output. Useful if you need
|
||||
# the return value AND want to use the output in a pipe
|
||||
try() { output=$(eval '"$@"'); }
|
||||
|
||||
# writes the output of the previously used "try" command
|
||||
dump() { /bin/echo "$output"; }
|
||||
|
||||
# a common post-processing function used after most commands
|
||||
trim() { head -n "$maxln"; }
|
||||
|
||||
# wraps highlight to treat exit code 141 (killed by SIGPIPE) as success
|
||||
safepipe() { "$@"; test $? = 0 -o $? = 141; }
|
||||
|
||||
# Image previews, if enabled in ranger.
|
||||
if [ "$preview_images" = "True" ]; then
|
||||
case "$mimetype" in
|
||||
# Image previews for SVG files, disabled by default.
|
||||
###image/svg+xml)
|
||||
### convert "$path" "$cached" && exit 6 || exit 1;;
|
||||
# Image previews for image files. w3mimgdisplay will be called for all
|
||||
# image files (unless overriden as above), but might fail for
|
||||
# unsupported types.
|
||||
image/*)
|
||||
exit 7;;
|
||||
# Image preview for video, disabled by default.:
|
||||
###video/*)
|
||||
### ffmpegthumbnailer -i "$path" -o "$cached" -s 0 && exit 6 || exit 1;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case "$extension" in
|
||||
# Archive extensions:
|
||||
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
|
||||
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
|
||||
try als "$path" && { dump | trim; exit 0; }
|
||||
try acat "$path" && { dump | trim; exit 3; }
|
||||
try bsdtar -lf "$path" && { dump | trim; exit 0; }
|
||||
exit 1;;
|
||||
rar)
|
||||
# avoid password prompt by providing empty password
|
||||
try unrar -p- lt "$path" && { dump | trim; exit 0; } || exit 1;;
|
||||
7z)
|
||||
# avoid password prompt by providing empty password
|
||||
try 7z -p l "$path" && { dump | trim; exit 0; } || exit 1;;
|
||||
# PDF documents:
|
||||
pdf)
|
||||
try pdftotext -l 10 -nopgbrk -q "$path" - && \
|
||||
{ dump | trim | fmt -s -w $width; exit 0; } || exit 1;;
|
||||
# BitTorrent Files
|
||||
torrent)
|
||||
try transmission-show "$path" && { dump | trim; exit 5; } || exit 1;;
|
||||
# ODT Files
|
||||
odt|ods|odp|sxw)
|
||||
try odt2txt "$path" && { dump | trim; exit 5; } || exit 1;;
|
||||
# HTML Pages:
|
||||
htm|html|xhtml)
|
||||
try w3m -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; }
|
||||
try lynx -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; }
|
||||
try elinks -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; }
|
||||
;; # fall back to highlight/cat if the text browsers fail
|
||||
jar)
|
||||
try java -jar "$path";;
|
||||
esac
|
||||
|
||||
case "$mimetype" in
|
||||
# Syntax highlight for text files:
|
||||
text/* | */xml | */json)
|
||||
if [ "$(tput colors)" -ge 256 ]; then
|
||||
pygmentize_format=terminal256
|
||||
highlight_format=xterm256
|
||||
else
|
||||
pygmentize_format=terminal
|
||||
highlight_format=ansi
|
||||
fi
|
||||
try safepipe highlight --out-format=${highlight_format} "$path" && { dump | trim; exit 5; }
|
||||
try safepipe pygmentize -f ${pygmentize_format} "$path" && { dump | trim; exit 5; }
|
||||
exit 2;;
|
||||
# Ascii-previews of images:
|
||||
image/*)
|
||||
img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;;
|
||||
# Display information about media files:
|
||||
video/* | audio/*)
|
||||
exiftool "$path" && exit 5
|
||||
# Use sed to remove spaces so the output fits into the narrow window
|
||||
try mediainfo "$path" && { dump | trim | sed 's/ \+:/: /;'; exit 5; } || exit 1;;
|
||||
esac
|
||||
|
||||
exit 1
|
|
@ -0,0 +1 @@
|
|||
rofi.theme: ~/.config/rofi/my_theme.rasi
|
|
@ -0,0 +1,142 @@
|
|||
/*******************************************************************************
|
||||
* ROFI Color theme
|
||||
* User: Rasi
|
||||
* Copyright: Rasmus Steinke
|
||||
*******************************************************************************/
|
||||
|
||||
* {
|
||||
selected-normal-foreground: rgba ( 255, 255, 255, 100 % );
|
||||
foreground: rgba ( 193, 193, 193, 100 % );
|
||||
normal-foreground: @foreground;
|
||||
alternate-normal-background: rgba ( 39, 50, 56, 100 % );
|
||||
red: rgba ( 220, 50, 47, 100 % );
|
||||
selected-urgent-foreground: rgba ( 255, 24, 68, 100 % );
|
||||
blue: rgba ( 38, 139, 210, 100 % );
|
||||
urgent-foreground: rgba ( 255, 24, 68, 100 % );
|
||||
alternate-urgent-background: rgba ( 39, 50, 56, 100 % );
|
||||
active-foreground: rgba ( 128, 203, 196, 100 % );
|
||||
lightbg: rgba ( 238, 232, 213, 100 % );
|
||||
selected-active-foreground: rgba ( 128, 203, 196, 100 % );
|
||||
alternate-active-background: rgba ( 39, 50, 56, 100 % );
|
||||
background: rgba ( 39, 50, 56, 100 % );
|
||||
bordercolor: rgba ( 39, 50, 56, 100 % );
|
||||
alternate-normal-foreground: @foreground;
|
||||
normal-background: rgba ( 39, 50, 56, 100 % );
|
||||
lightfg: rgba ( 88, 104, 117, 100 % );
|
||||
selected-normal-background: rgba ( 57, 66, 73, 100 % );
|
||||
border-color: @foreground;
|
||||
spacing: 2;
|
||||
separatorcolor: rgba ( 30, 37, 41, 100 % );
|
||||
urgent-background: rgba ( 39, 50, 56, 100 % );
|
||||
selected-urgent-background: rgba ( 57, 66, 73, 100 % );
|
||||
alternate-urgent-foreground: @urgent-foreground;
|
||||
background-color: rgba ( 0, 0, 0, 0 % );
|
||||
alternate-active-foreground: @active-foreground;
|
||||
active-background: rgba ( 39, 50, 56, 100 % );
|
||||
selected-active-background: rgba ( 57, 66, 73, 100 % );
|
||||
}
|
||||
#window {
|
||||
background-color: @background;
|
||||
border: 0;
|
||||
padding: 5;
|
||||
}
|
||||
#mainbox {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#message {
|
||||
border: 1px dash 0px 0px ;
|
||||
border-color: @separatorcolor;
|
||||
padding: 1px ;
|
||||
}
|
||||
#textbox {
|
||||
text-color: @foreground;
|
||||
}
|
||||
#listview {
|
||||
fixed-height: 0;
|
||||
border: 2px dash 0px 0px ;
|
||||
border-color: @separatorcolor;
|
||||
spacing: 2px ;
|
||||
scrollbar: true;
|
||||
padding: 2px 0px 0px ;
|
||||
}
|
||||
#element {
|
||||
border: 0;
|
||||
padding: 1px ;
|
||||
}
|
||||
#element.normal.normal {
|
||||
background-color: @normal-background;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
#element.normal.urgent {
|
||||
background-color: @urgent-background;
|
||||
text-color: @urgent-foreground;
|
||||
}
|
||||
#element.normal.active {
|
||||
background-color: @active-background;
|
||||
text-color: @active-foreground;
|
||||
}
|
||||
#element.selected.normal {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
}
|
||||
#element.selected.urgent {
|
||||
background-color: @selected-urgent-background;
|
||||
text-color: @selected-urgent-foreground;
|
||||
}
|
||||
#element.selected.active {
|
||||
background-color: @selected-active-background;
|
||||
text-color: @selected-active-foreground;
|
||||
}
|
||||
#element.alternate.normal {
|
||||
background-color: @alternate-normal-background;
|
||||
text-color: @alternate-normal-foreground;
|
||||
}
|
||||
#element.alternate.urgent {
|
||||
background-color: @alternate-urgent-background;
|
||||
text-color: @alternate-urgent-foreground;
|
||||
}
|
||||
#element.alternate.active {
|
||||
background-color: @alternate-active-background;
|
||||
text-color: @alternate-active-foreground;
|
||||
}
|
||||
#scrollbar {
|
||||
width: 4px ;
|
||||
border: 0;
|
||||
handle-width: 8px ;
|
||||
padding: 0;
|
||||
}
|
||||
#sidebar {
|
||||
border: 2px dash 0px 0px ;
|
||||
border-color: @separatorcolor;
|
||||
}
|
||||
#button.selected {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
}
|
||||
#inputbar {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
padding: 1px ;
|
||||
}
|
||||
#case-indicator {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
#entry {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
#prompt {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
#inputbar {
|
||||
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
|
||||
}
|
||||
#textbox-prompt-colon {
|
||||
expand: false;
|
||||
str: ":";
|
||||
margin: 0px 0.3em 0em 0em ;
|
||||
text-color: @normal-foreground;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# trizen configuration file
|
||||
|
||||
our $CONFIG = {
|
||||
ask_for_retry => 1, # bool -- When `makepkg` fails to build a package, offer the option for trying again.
|
||||
aur_results_last_modified => 1, # bool -- Show the date when the packages were last updated in AUR results.
|
||||
aur_results_popularity => 1, # bool -- Show the popularity score in AUR results.
|
||||
aur_results_show_installed => 0, # bool -- Show when a package is installed in AUR results.
|
||||
aur_results_sort_by => "popularity", # str -- Sort the AUR results by "name", "votes", "popularity" or "date".
|
||||
aur_results_sort_order => "descending", # str -- Sort the AUR results in "ascending" or "descending" order.
|
||||
aur_results_votes => 0, # bool -- Show the number of votes in AUR results.
|
||||
clone_dir => "/tmp/trizen-sheychen", # str -- Absolute path to the directory where to clone and build packages.
|
||||
color_code_dependencies => 0, # bool -- Display the dependencies of a package in specific colors (green = installed; cyan = in repo; purple = in AUR).
|
||||
debug => 0, # bool -- Verbose mode.
|
||||
flip_indices => 0, # bool -- In search+install mode, show the indices of packages in reverse order.
|
||||
flip_results => 0, # bool -- Show the search results in reverse order.
|
||||
forcecolors => 0, # bool -- Force output colors even when not writing to STDOUT.
|
||||
git_clone_depth => 0, # int -- Pass the `--depth int` flag to `git clone`. (0 means no limit)
|
||||
lwp_env_proxy => 1, # bool -- Use proxy settings defined in `env` (if any).
|
||||
lwp_show_progress => 0, # bool -- Show the HTTPS requests made by LWP::UserAgent to the AUR servers.
|
||||
lwp_timeout => 60, # int -- Seconds after which an HTTPS connection is aborted.
|
||||
makepkg_command => "/usr/bin/makepkg --syncdeps --force --clean", # str -- The `makepkg` command that is used internally in building a package.
|
||||
movepkg => 0, # bool -- Move built packages in the directory `movepkg_dir`.
|
||||
movepkg_dir => "/var/cache/pacman/pkg", # str -- Absolute path to the directory where to move built packages (with `movepkg`).
|
||||
nocolors => 0, # bool -- Disable output colors for `trizen`.
|
||||
noedit => 0, # bool -- Do not prompt to edit files when installing an AUR package.
|
||||
noinfo => 0, # bool -- Do not display package information when installing an AUR package.
|
||||
noinstall => 0, # bool -- Do not install built packages -- builds only.
|
||||
nopull => 0, # bool -- Do not `git pull` new changes from the AUR git server.
|
||||
packages_in_stats => 5, # int -- The number of packages to display in `--stats`
|
||||
pacman_command => "/usr/bin/pacman", # str -- The `pacman` command that is used internally for pacman operations.
|
||||
pacman_local_dir => "/var/lib/pacman/local", # str -- Absolute path to the pacman's local directory.
|
||||
pager_mode => 0, # bool -- Show the build files in pager mode using pager.
|
||||
recompute_deps => 1, # bool -- Recompute the dependencies of a package (after its build files are inspected / edited).
|
||||
show_build_files_content => 0, # bool -- Show the content of the build files of a package before building it.
|
||||
show_comments => 0, # int -- Show the `n` most recent AUR comments for a package before building it. (max: 10)
|
||||
show_diff_only => 0, # bool -- When the build files of a package already exist locally, show the diff only.
|
||||
show_inexistent => 1, # bool -- Warn about packages that do not exist in AUR, during -Su.
|
||||
show_ood => 0, # bool -- Warn about out-of-date marked packages, during -Su.
|
||||
show_unmaintained => 1, # bool -- Warn about unmaintained packages, during -Su.
|
||||
skipinteg => 0, # bool -- Pass the `--skipinteg` argument to `makepkg`.
|
||||
split_packages => 1, # bool -- Ask about installing the other parts of a split package.
|
||||
ssl_verify_hostname => 0, # bool -- Ensure LWP::UserAgent connects to servers that have a valid certificate.
|
||||
su_command => "/usr/bin/su -c", # str -- Command used when special permissions are required and `use_sudo` is set to 0.
|
||||
sudo_autorepeat => 0, # bool -- Automatically repeat `sudo -v` in the background after a `sudo` command was first executed.
|
||||
sudo_autorepeat_at_runtime => 0, # bool -- Execute `sudo -v` when `trizen` is first executed and apply the behavior of `sudo_autorepeat`.
|
||||
sudo_autorepeat_interval => 180, # int -- Interval, in seconds, after which `sudo -v` is executed in background (with `sudo_autorepeat`).
|
||||
sudo_command => "/usr/bin/sudo", # str -- Command used when special permissions are required and `use_sudo` is set to 1.
|
||||
sudo_remove_timestamp => 1, # bool -- Remove the cached sudo credentials before `makepkg` is executed (`sudo --remove-timestamp`).
|
||||
syntax_highlighting => 1, # bool -- Syntax hightling of the build files, using the `highlight` tool from [community].
|
||||
syntax_highlighting_cmd => "/usr/bin/highlight -O ansi", # str -- The `highlight` command used in highlighting the syntax of the build files (with `syntax_highlighting`).
|
||||
use_github_api => 1, # bool -- Check GitHub sources for updates using GitHub's API. (during `--devel --needed`)
|
||||
use_gitlab_api => 1, # bool -- Check GitLab sources for updates using GitLab's API. (during `--devel --needed`)
|
||||
use_sudo => 1, # bool -- Use the `sudo` command when special permissions are required.
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
# Support de la souris
|
||||
set -g mouse on
|
||||
|
||||
# Support vim
|
||||
unbind C-b
|
||||
set -g prefix C-a
|
||||
bind C-a send-prefix
|
||||
|
||||
# Status bar all
|
||||
set -g status-fg colour236
|
||||
set -g status-bg colour102
|
||||
|
||||
# Left
|
||||
#set -g status-left-fg black
|
||||
set -g status-left '#I:#W'
|
||||
|
||||
# Right
|
||||
#set -g status-right-fg black
|
||||
set -g status-right '%a %b %d, %Y %H:%M'
|
||||
|
||||
# Display
|
||||
set -g status off
|
||||
bind b set -g status off
|
||||
bind B set -g status on
|
||||
|
||||
# Window options color
|
||||
#set-window-option -g window-status-current-fg black
|
||||
|
||||
# R, recharge la configuration
|
||||
bind r source-file ~/.tmux.conf
|
||||
|
||||
# Window split
|
||||
bind / split-window -h
|
||||
bind * split-window -v
|
||||
unbind '"'
|
||||
unbind %
|
||||
|
||||
# move
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Right select-pane -R
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Down select-pane -D
|
||||
|
||||
# Zoom
|
||||
bind + \
|
||||
new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \;\
|
||||
swap-pane -s tmux-zoom.0 \;\
|
||||
select-window -t tmux-zoom
|
||||
bind - \
|
||||
last-window \;\
|
||||
swap-pane -s tmux-zoom.0 \;\
|
||||
kill-window -t tmux-zoom
|
||||
|
||||
# Mouse switch
|
||||
bind m set -g mouse off
|
||||
bind M set -g mouse on
|
||||
|
||||
# Copy
|
||||
unbind c
|
||||
bind v paste-buffer
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
let iCanHazVundle=1
|
||||
let vundle_readme=expand('~/.vim/bundle/Vundle.vim/README.md')
|
||||
if !filereadable(vundle_readme)
|
||||
echo "Installing Vundle.."
|
||||
echo ""
|
||||
silent !mkdir -p ~/.vim/bundle
|
||||
silent !git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
|
||||
let iCanHazVundle=0
|
||||
endif
|
||||
set nocompatible
|
||||
filetype off
|
||||
set rtp+=~/.vim/bundle/Vundle.vim/
|
||||
call vundle#begin()
|
||||
|
||||
" let Vundle manage Vundle, required
|
||||
Plugin 'VundleVim/Vundle.vim'
|
||||
|
||||
" Plugins
|
||||
" Plugin 'tpope/vim-fugitive'
|
||||
Plugin 'airblade/vim-gitgutter'
|
||||
Plugin 'scrooloose/nerdtree'
|
||||
Plugin 'Xuyuanp/nerdtree-git-plugin'
|
||||
Plugin 'tpope/vim-surround'
|
||||
Plugin 'majutsushi/tagbar'
|
||||
Plugin 'scrooloose/syntastic'
|
||||
" Plugin 'SirVer/ultisnips'
|
||||
" Plugin 'honza/vim-snippets'
|
||||
" Plugin 'aperezdc/vim-template'
|
||||
Plugin 'lilydjwg/colorizer'
|
||||
" Plugin 'valloric/youcompleteme'
|
||||
Plugin 'vim-airline/vim-airline'
|
||||
Plugin 'vim-airline/vim-airline-themes'
|
||||
|
||||
if iCanHazVundle == 0
|
||||
echo "Installing Vundles, please ignore key map error messages"
|
||||
echo ""
|
||||
:PluginInstall
|
||||
endif
|
||||
|
||||
call vundle#end()
|
||||
filetype plugin indent on
|
||||
syntax on
|
||||
|
||||
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
|
||||
map <C-h> :set list!<CR>
|
||||
|
||||
map <C-n> :NERDTreeToggle<CR>
|
||||
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:airline_skip_empty_sections = 1
|
||||
let g:airline_theme = 'minimalist'
|
|
@ -0,0 +1,116 @@
|
|||
#
|
||||
# ~/.zshrc
|
||||
#
|
||||
ANTIGEN_CACHE=$HOME/.antigen-cache.zsh
|
||||
typeset -a ANTIGEN_CHECK_FILES=($HOME/.zshrc)
|
||||
|
||||
source ~/.antigen.zsh
|
||||
|
||||
antigen use oh-my-zsh
|
||||
|
||||
antigen bundle mkcd
|
||||
antigen bundle zsh-users/zsh-syntax-highlighting
|
||||
antigen bundle zsh-users/zsh-autosuggestions
|
||||
antigen bundle zsh-users/zsh-completions
|
||||
|
||||
antigen apply
|
||||
|
||||
autoload -Uz compinit; compinit
|
||||
|
||||
hostname_color() {
|
||||
case $(hostname) in
|
||||
blue*)
|
||||
echo "%{\e[01;34m%}"
|
||||
;;
|
||||
green*)
|
||||
echo "%{\e[01;32m%}"
|
||||
;;
|
||||
pink*)
|
||||
echo "%{\e[01;35m%}"
|
||||
;;
|
||||
red*)
|
||||
echo "%{\e[01;31m%}"
|
||||
;;
|
||||
*)
|
||||
echo "%{\e[01;37m%}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
parse_git_branch() {
|
||||
if git rev-parse --is-inside-work-tree 2> /dev/null | grep -q 'true' ; then
|
||||
echo -ne " "
|
||||
RES=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
|
||||
if [[ $(git status --short | wc -l) -gt 0 ]]; then
|
||||
RES+="+"$(git status --short | wc -l)
|
||||
fi
|
||||
echo $RES
|
||||
fi
|
||||
}
|
||||
|
||||
status_color() {
|
||||
if [[ ${EUID} == 0 ]] ; then
|
||||
echo "%{\e[01;31m%}"
|
||||
else
|
||||
if [[ $(whoami) == "sheychen" ]] ; then
|
||||
if [[ $(sudo -n uptime 2>&1|grep "load"|wc -l) -gt 0 ]] ; then
|
||||
echo "%{\e[01;33m%}"
|
||||
else
|
||||
echo "%{\e[01;32m%}"
|
||||
fi
|
||||
else
|
||||
echo "%{\e[01;35m%}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
parse_user() {
|
||||
if [[ ${EUID} != 0 ]] ; then
|
||||
case "$(whoami)" in
|
||||
"sheychen") echo "@" ;;
|
||||
"shu") ;;
|
||||
*) echo "$(whoami)@" ;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
function spwd {
|
||||
echo $PWD | sed "s:${HOME}:~:" | sed "s:/\(.\)[^/]*:/\1:g" | sed "s:/[^/]*$:/$(basename "$PWD"):"
|
||||
}
|
||||
|
||||
setopt promptsubst
|
||||
PROMPT=$'$(status_color)[$(parse_user)$(hostname_color)%M%{\e[01;37m%} $(spwd)$(parse_git_branch)$(status_color)]%{\e[0m%} '
|
||||
|
||||
unset HISTFILE
|
||||
|
||||
cl() {
|
||||
local dir="$1"
|
||||
local dir="${dir:=$HOME}"
|
||||
if [[ -d "$dir" ]]; then
|
||||
cd "$dir" >/dev/null; ls
|
||||
else
|
||||
echo "cl: $dir: Directory not found"
|
||||
fi
|
||||
}
|
||||
|
||||
ssh-load() {
|
||||
local key="$HOME/.ssh/keys/${1}_ed25519"
|
||||
if [ -f $key ]; then
|
||||
ssh-add -k $key
|
||||
else
|
||||
echo "$key not found"
|
||||
fi
|
||||
}
|
||||
|
||||
mkcd () {
|
||||
case "$1" in
|
||||
*/..|*/../) cd -- "$1";; # that doesn't make any sense unless the directory already exists
|
||||
/*/../*) (cd "${1%/../*}/.." && mkdir -p "./${1##*/../}") && cd -- "$1";;
|
||||
/*) mkdir -p "$1" && cd "$1";;
|
||||
*/../*) (cd "./${1%/../*}/.." && mkdir -p "./${1##*/../}") && cd "./$1";;
|
||||
../*) (cd .. && mkdir -p "${1#.}") && cd "$1";;
|
||||
*) mkdir -p "./$1" && cd "./$1";;
|
||||
esac
|
||||
}
|
||||
|
||||
[[ -f ~/.shrc ]] && source ~/.shrc
|
|
@ -0,0 +1,56 @@
|
|||
; Global settings for redshift
|
||||
[redshift]
|
||||
; Set the day and night screen temperatures
|
||||
temp-day=5000
|
||||
temp-night=3400
|
||||
|
||||
; Enable/Disable a smooth transition between day and night
|
||||
; 0 will cause a direct change from day to night screen temperature.
|
||||
; 1 will gradually increase or decrease the screen temperature.
|
||||
transition=1
|
||||
|
||||
; Set the screen brightness. Default is 1.0.
|
||||
;brightness=0.9
|
||||
; It is also possible to use different settings for day and night
|
||||
; since version 1.8.
|
||||
;brightness-day=0.7
|
||||
;brightness-night=0.4
|
||||
; Set the screen gamma (for all colors, or each color channel
|
||||
; individually)
|
||||
;gamma=0.8
|
||||
;gamma=0.8:0.7:0.8
|
||||
; This can also be set individually for day and night since
|
||||
; version 1.10.
|
||||
;gamma-day=0.8:0.7:0.8
|
||||
;gamma-night=0.6
|
||||
|
||||
; Set the location-provider: 'geoclue', 'geoclue2', 'manual'
|
||||
; type 'redshift -l list' to see possible values.
|
||||
; The location provider settings are in a different section.
|
||||
location-provider=manual
|
||||
|
||||
; Set the adjustment-method: 'randr', 'vidmode'
|
||||
; type 'redshift -m list' to see all possible values.
|
||||
; 'randr' is the preferred method, 'vidmode' is an older API.
|
||||
; but works in some cases when 'randr' does not.
|
||||
; The adjustment method settings are in a different section.
|
||||
adjustment-method=randr
|
||||
|
||||
; Configuration of the location-provider:
|
||||
; type 'redshift -l PROVIDER:help' to see the settings.
|
||||
; ex: 'redshift -l manual:help'
|
||||
; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
|
||||
; are negative numbers.
|
||||
[manual]
|
||||
lat=45.59
|
||||
lon=5.88
|
||||
|
||||
; Configuration of the adjustment-method
|
||||
; type 'redshift -m METHOD:help' to see the settings.
|
||||
; ex: 'redshift -m randr:help'
|
||||
; In this example, randr is configured to adjust screen 1.
|
||||
; Note that the numbering starts from 0, so this is actually the
|
||||
; second screen. If this option is not specified, Redshift will try
|
||||
; to adjust _all_ screens.
|
||||
;[randr]
|
||||
;screen=1
|
|
@ -0,0 +1 @@
|
|||
{"opacity": 0.5, "mods_only": false, "font_desc": "BitstreamVeraSansMono Nerd Font Mono 12", "compr_cnt": 2, "screen": 0, "no_systray": false, "bg_color": "black", "vis_space": true, "position": "bottom", "key_mode": "composed", "vis_shift": false, "mods_mode": "normal", "ignore": [], "font_size": "small", "recent_thr": 0.1, "bak_mode": "normal", "geometry": null, "multiline": false, "timeout": 2.0, "persist": false, "font_color": "white"}
|
Loading…
Reference in New Issue