]> git.phdru.name Git - dotfiles.git/commitdiff
Feat(recode-filenames-recursive): Allow to omit parameters master
authorOleg Broytman <phd@phdru.name>
Mon, 19 Feb 2024 20:11:34 +0000 (23:11 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 19 Feb 2024 20:11:34 +0000 (23:11 +0300)
79 files changed:
.bash_completion.d/cgmem_nice
.bash_completion.d/git-funcs [new file with mode: 0644]
.bash_completion.d/python-pip [new file with mode: 0644]
.bashrc
.fvwm/main.m4
.gitconfig
.mc/mc.ext
.mc/mc.ext.ini [new file with mode: 0644]
.mc/menu
.muttrc
.procmailrc
.profile
.project
.screenrc
.shellrc
.vim/ftplugin/html.vim
.vim/ftplugin/javascript.vim [new file with mode: 0644]
.vim/ftplugin/mail.vim
.vim/ftplugin/programming_lang.vim [new file with mode: 0644]
.vim/ftplugin/python.vim
.vim/ftplugin/sh.vim [new file with mode: 0644]
.vim/ftplugin/sshconfig.vim [new file with mode: 0644]
.vim/plugin/text.vim [new file with mode: 0644]
.vim/python/completion.py
.vim/python/virtualenv.py
.vimrc
admin/prog/bash_prompt
bin/GET.py
bin/HEAD.py
bin/KillAll
bin/PS
bin/abspath.py
bin/browser-stack.py
bin/browser_stack.py
bin/cgmem_nice
bin/cgmem_which
bin/cgmn [new symlink]
bin/cleanup-filenames.sh
bin/cleanup-recode.sh
bin/cmp.py
bin/compyle
bin/compyle4vim.py
bin/compyleall
bin/cp_recode_fname [new file with mode: 0755]
bin/decode-URLs.py
bin/get_html_encoding.py
bin/get_xml_encoding.py
bin/git-open
bin/git-open-remote
bin/iconv.py
bin/iconvx.py
bin/iconvxml.py [deleted file]
bin/idna.py
bin/koi2lat
bin/l
bin/lat2koi
bin/latin1_to_ascii.py [deleted file]
bin/mc_type.py
bin/mv_recode_fname [new symlink]
bin/r
bin/recode-filenames-recursive.py
bin/recode-inplace
bin/recode_filenames.py
bin/rm-pyc
bin/rucal [new file with mode: 0755]
bin/s
bin/smplay [deleted file]
bin/smplay-gui [deleted symlink]
bin/text-wrap.py
bin/unicode_norm_nfd.py [new file with mode: 0755]
bin/unzip.py
bin/webbrowser
bin/webbrowser-encode-url
bin/wget-download
bin/wget-m [changed from file to symlink]
bin/wget-mirror [new file with mode: 0755]
bin/xtitle
bin/zip.py
lib/python/init.py

index 5ed041b87634f7d3ad8c21d11303f4f719a752de..ee553f989b8abdc79524d0672f367cffb4e914e6 100644 (file)
@@ -9,4 +9,4 @@ _cgmem_nice()
    fi
 }
 
-complete -F _cgmem_nice cgmem_nice
+complete -F _cgmem_nice cgmem_nice cgmn
diff --git a/.bash_completion.d/git-funcs b/.bash_completion.d/git-funcs
new file mode 100644 (file)
index 0000000..e41a138
--- /dev/null
@@ -0,0 +1,124 @@
+if test -x /usr/bin/git >/dev/null 2>&1; then
+    # chdir to a remote's directory (if the remote is on the local FS)
+    cdremote() {
+        if [ $# -gt 1 ]; then
+            echo "Usage: cdremote [remote_name]" >&2
+            return 1
+        fi
+
+        if [ -z "$1" ]; then
+            branch="`git rev-parse --abbrev-ref HEAD`"
+            remote="`git config --get branch.$branch.remote`"
+        else
+            remote="$1"
+        fi
+
+        if [ -n "$remote" ] && git config --get remote.$remote.url |
+                grep -q '^\(file:/\|/\|\.\./\)'; then # (file:/ or / or ../ at the beginning)
+            cdgitpath remote.$remote.url
+            return
+        fi
+
+        if [ -n "$1" ]; then
+            echo "Cannot find directory for remote $1" >&2
+            echo "Usage: cdremote [remote_name]" >&2
+            return 1
+        fi
+
+        _list_remotes '^\(file:/\|/\|\.\./\)' # (file:/ or / or ../ at the beginning)
+        if [ ${#GIT_REMOTES[*]} -eq 1 ]; then
+            remote=${GIT_REMOTES[0]}
+            unset GIT_REMOTES
+            cdgitpath remote.$remote.url
+        else
+            unset GIT_REMOTES
+            echo "Cannot find directory for any remote" >&2
+            echo "Usage: cdremote [remote_name]" >&2
+            return 1
+        fi
+    }
+
+    # completion for `cd_worktree`
+
+    _cd_worktree_comp() {
+        local cur="${COMP_WORDS[COMP_CWORD]}"
+        COMPREPLY=(`compgen -W "$(
+            git worktree list | awk '{s=$3; gsub("[\\\\[\\\\]]", "", s); print s}'
+        )" -- "$cur"`)
+    }
+
+    _cd_worktree_comp_loader() {
+        _completion_loader git
+        unset _cd_worktree_comp_loader
+        complete -F _cd_worktree_comp cd_worktree
+        return 124
+    }
+
+    complete -F _cd_worktree_comp_loader cd_worktree
+
+    # completion for aliases in global .gitconfig
+
+    # fixup rbi rbia rbiap rbip - do refs name completion
+    _git_fixup() { __gitcomp_nl "$(__git_refs)" ; }
+    _git_rbi() { __gitcomp_nl "$(__git_refs)" ; }
+    _git_rbia() { __gitcomp_nl "$(__git_refs)" ; }
+    _git_rbiap() { __gitcomp_nl "$(__git_refs)" ; }
+    _git_rbip() { __gitcomp_nl "$(__git_refs)" ; }
+    #
+    # push-to-all-remotes - do branch name completion
+    _git_push_to_all_remotes() { __gitcomp_nl "$(__git_heads)" ; }
+
+    _cdgitpath_complete() {
+        local cur="${COMP_WORDS[COMP_CWORD]}"
+        COMPREPLY=(`compgen -W "$(__git_config_get_set_variables)" -- "$cur"`)
+    }
+
+    _git_open() {
+        _cdgitpath_complete
+    }
+
+    complete -F _cdgitpath_complete cdgitpath git-open
+
+    # list remotes with URLs matching a regexp
+    _list_remotes() {
+        if [ $# -ne 1 ]; then
+            echo "Usage: _list_remotes remote_regexp" >&2
+            return 1
+        fi
+        declare -ag GIT_REMOTES=()
+        local remote
+        for remote in `git remote`; do
+            if git config --get remote.$remote.url | grep -q "$1"; then
+                GIT_REMOTES+=($remote)
+            fi
+        done
+    }
+
+    # completion for cdremote and git-open-remote - list remotes with a pattern
+    _list_remotes_completion() {
+        local cur="${COMP_WORDS[COMP_CWORD]}"
+        _list_remotes "$1"
+        COMPREPLY=(`compgen -W "${GIT_REMOTES[*]}" -- "$cur"`)
+        unset GIT_REMOTES
+    }
+
+    # completion for cdremote - list remotes with directories as URLs
+    _cdremote_complete() {
+        _list_remotes_completion '^\(file:/\|/\|\.\./\)' # (file:/ or / or ../ at the beginning)
+        if [ ${#COMPREPLY[*]} -eq 0 ]; then
+            _list_remotes_completion .
+        fi
+    }
+
+    complete -F _cdremote_complete cdremote
+
+    # completion for git-open-remote - list remotes with http(s) URLs
+    _git_open_remote() {
+        _list_remotes_completion '^http\(s\)\?://'
+        if [ ${#COMPREPLY[*]} -eq 0 ]; then
+            _list_remotes_completion .
+        fi
+    }
+
+    complete -F _git_open_remote git-open-remote
+fi
diff --git a/.bash_completion.d/python-pip b/.bash_completion.d/python-pip
new file mode 100644 (file)
index 0000000..f6e3126
--- /dev/null
@@ -0,0 +1,14 @@
+PY_VERSIONS="2,2.7,3,"
+PY_VERSIONS+="$(eval echo 3.{`seq -s, 4 12`} | sed 's/ /,/g')"
+
+eval delegate_completion python python{$PY_VERSIONS}
+
+_pip_completion_loader() {
+    if [ "`type -t _pip_completion`" != function ]; then
+        eval "`pip3 completion --bash`"
+    fi
+    eval complete -F _pip_completion pip pip{$PY_VERSIONS}
+    unset _pip_completion_loader PY_VERSIONS
+    return 124
+}
+eval complete -F _pip_completion_loader pip pip{$PY_VERSIONS}
diff --git a/.bashrc b/.bashrc
index 867f11d40a3011f0e9c5e583bf74165a7151a1d4..8c05ad26d5155c59cb452177b160c0db87364f96 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -1,2 +1,213 @@
-if [ "$SHLVL" -eq 1 -a -f "$HOME"/.profile ] ; then . "$HOME"/.profile ; fi
-if [ "$SHLVL" -gt 1 -a -f "$HOME"/.shellrc ] ; then . "$HOME"/.shellrc ; fi
+#
+# $HOME/.bashrc
+#
+
+# ~/.bashrc: executed by bash(1) for non-login shells.
+# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
+# for examples
+
+# Copied from .profile to do minor initialization for non-interactive non-login-shells
+umask 077
+
+# Fix default PATH
+if [ "$PATH" = "/usr/local/bin:/usr/bin:/bin:/usr/games" ]; then
+    PATH="$HOME"/bin:"$HOME"/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+fi
+
+if [ -n "$DISPLAY" ]; then
+    PATH=$PATH:/usr/games
+fi
+
+# Make `ssh host date` to display in 24-hour format
+LANG=C
+
+# If not running interactively, don't do anything
+case $- in
+    *i*) ;;
+      *) return ;;
+esac
+
+# Stop if non-interactive shell
+[ -z "$PS1" ] && return
+
+. "$HOME"/.shellrc
+
+# This is the default value set by interactive bash
+# when the global value was unset. Unset it here too.
+if [ "$HISTFILE" = "$HOME/.bash_history" ]; then
+    history -r
+    unset HISTFILE
+fi
+
+# check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+
+# If set, the pattern "**" used in a pathname expansion context will
+# match all files and zero or more directories and subdirectories.
+#shopt -s globstar
+
+# append to the history file, don't overwrite it
+shopt -s histappend
+
+[ "`type -t ls`" = alias ] && unalias ls
+[ "`type -t ll`" = alias ] && unalias ll
+
+back() { cd - "$@"; }
+functions() { typeset -f "$@"; }
+j() { jobs; }
+
+if [ -r "$HOME"/admin/prog/bash_prompt ]; then
+    . "$HOME"/admin/prog/bash_prompt
+    set_prompt
+    unset set_prompt
+else
+    PS1="${debian_chroot:+($debian_chroot)}\u@\h:\W \$SHLVL\\$ "
+fi
+
+if [ -z "$BASH_COMPLETION_COMPAT_DIR" ]; then
+    if [ -d /usr/share/bash-completion -a -r /usr/share/bash-completion/bash_completion ]; then
+        _BASH_COMPLETIONS_DIR=/usr/share/bash-completion/completions
+        . /usr/share/bash-completion/bash_completion
+    elif [ -r /etc/bash_completion ]; then
+        _BASH_COMPLETIONS_DIR=/etc/bash_completion.d
+        . /etc/bash_completion
+    elif [ -d /etc/bash_completion.d ] &&
+            [ -n "`ls -A /etc/bash_completion.d`" ]; then
+        _BASH_COMPLETIONS_DIR=/etc/bash_completion.d
+        for _compf in /etc/bash_completion.d/*; do
+            . $_compf
+        done
+    elif [ -d /usr/local/etc/bash_completion.d ] &&
+            [ -n "`ls -A /usr/local/etc/bash_completion.d`" ]; then
+        _BASH_COMPLETIONS_DIR=/usr/local/etc/bash_completion.d
+        for _compf in /usr/local/etc/bash_completion.d/*; do
+            . $_compf
+        done
+    else
+        echo "Unknown OS type, cannot source bash_completion" >&2
+    fi
+fi
+
+has_completion() {
+    [ -n "$_BASH_COMPLETIONS_DIR" -a -d "$_BASH_COMPLETIONS_DIR" -a -r "$_BASH_COMPLETIONS_DIR/$1" ] ||
+    complete -p $1 >/dev/null 2>&1
+}
+
+for cmd in builtin cgmem_nice command dbus-launch exec \
+        killall man nice nohup pidof pidOf KillAll pgrep pkill psg pswg \
+        run-hosts su sudo time whence whereis which xargs; do
+    has_completion $cmd || complete -o default -A command $cmd
+done
+
+for cmd in dig host mtr nslookup nc netcat nmap p ping ping6 \
+        ssh2 s2 socat telnet t tt \
+        tcptraceroute tcptraceroute6 tracert tracert6 traceroute traceroute6 \
+        whois wd wget wget-download wget-m wget-wrapper ww; do
+    has_completion $cmd || complete -A hostname $cmd
+done
+
+for cmd in distribute ftp lftp r rsync \
+        s scp ssh smbclient tcpdump tshark wireshark; do
+    has_completion $cmd || complete -o default -A hostname $cmd
+done
+
+for cmd in bg fg jobs; do
+    has_completion $cmd || complete -A job $cmd
+done
+
+complete -A job j wait
+
+for cmd in unset; do
+    has_completion $cmd || complete -A function -A variable $cmd
+done
+
+delegate_completion() {
+    local prog programs
+    prog=$1
+    has_completion $prog || return 0
+    shift
+    programs="$@"
+    eval "_${prog}_completion_loader() {
+        _completion_loader $prog
+        if [ x"$DELEGATE_NOSPACE" = x1 ]; then
+            complete -o nospace -F _$prog $programs
+        else
+            complete -F _$prog $programs
+        fi
+        unset _${prog}_completion_loader
+        return 124
+    }"
+    complete -F _${prog}_completion_loader $programs
+}
+
+delegate_completion make m
+delegate_completion ping p
+DELEGATE_NOSPACE=1 delegate_completion rsync r rsync_cgmn rsync_cgmn_recode rsync_cgmn_recode2
+delegate_completion ssh s
+delegate_completion wget wget-m wget-wrapper ww
+
+if [ -d "$HOME"/.bash_completion.d ] &&
+        [ -n "`ls -A $HOME/.bash_completion.d`" ]; then
+    for _compf in "$HOME"/.bash_completion.d/*; do
+        . $_compf
+    done
+fi
+
+unset _BASH_COMPLETIONS_DIR has_completion delegate_completion
+
+if [ -d "$HOME/lib/config" ]; then
+    complete -W "`cd \"$HOME/lib/config\" && echo *`" include
+fi
+complete -W "`echo $BROWSER | sed 's/:/ /g'`" start-browser
+
+
+if [ -n "$VIRTUAL_ENV" ] && ! type deactivate >/dev/null 2>&1; then
+    . "$VIRTUAL_ENV/bin/activate"
+fi
+
+# Clean up python virtual environment on exit
+# See https://virtualenvwrapper.readthedocs.io/en/latest/tips.html#clean-up-environments-on-exit
+
+trap '[ "$VIRTUAL_ENV" ] && deactivate' EXIT
+
+. virtualenvwrapper_lazy.sh 2>/dev/null
+
+
+if test -d "$HOME"/.pyenv
+then
+    PYENV_ROOT="$HOME"/.pyenv
+    export PYENV_ROOT
+    PATH="$PYENV_ROOT/bin:$PATH"
+    if which pyenv >/dev/null 2>&1; then
+#        eval "`pyenv init --path`"
+        eval "`pyenv init -`"
+        eval "`pyenv virtualenv-init -`"
+    fi
+fi
+
+
+if test -x /usr/bin/screen >/dev/null 2>&1; then
+    screen_newwin() {
+        history -a
+        screen "$@"
+    }
+fi
+
+if [ "$SHLVL" -eq 1 -a "`type -t X`" = function ] && which startx >/dev/null 2>&1; then
+    # From https://stackoverflow.com/a/18839557
+
+    copy_function() {
+        test -n "$(declare -f "$1")" || return
+        eval "${_/$1/$2}"
+    }
+
+    rename_function() {
+        copy_function "$@" || return
+        unset -f "$1"
+    }
+
+    rename_function X _non_bash_X
+
+    X() { history -a; _non_bash_X; history -r; }
+fi
index 3fb994b7511fa645d2930758d0c2a9171ff5a68e..8e7c740d554987f64e61a16d6698db271ab97610 100644 (file)
@@ -4,35 +4,22 @@
 
 dnl The file is in m4 format, use FvwmM4 module to read it
 dnl like this: ModuleSynchronous FvwmM4 -lock main.m4
-
+dnl
 dnl This is to prevent FvwmM4 to shadow $HOME
-undefine(`HOME')
-
+undefine(`HOME')dnl
+dnl
 dnl Echo dimension
-`#' width = WIDTH
-
+`#' width = WIDTH()dnl
 divert(-1)
-dnl koi8-r Fonts
-dnl define(`SMALL_FONT_KOI8', `-*-fixed-medium-r-normal-*-*-100-*-*-*-*-koi8-r')
-dnl define(`MEDIUM_FONT_KOI8', `-*-fixed-medium-r-normal-*-*-120-*-*-*-*-koi8-r')
-dnl define(`BIG_FONT_KOI8', `-*-fixed-medium-r-normal-*-*-140-*-*-*-*-koi8-r')
-
-dnl cp1251 Fonts
-dnl define(`SMALL_FONT_CP1251', `-*-fixed-medium-r-normal-*-*-100-*-*-*-*-*-cp1251')
-dnl define(`MEDIUM_FONT_CP1251', `-*-fixed-medium-r-normal-*-*-120-*-*-*-*-*-cp1251')
-dnl define(`BIG_FONT_CP1251', `-*-fixed-medium-r-normal-*-*-140-*-*-*-*-*-cp1251')
-
-dnl define(`XBUFFY_FONT', `-cronyx-helvetica-bold-r-*-*-*-100-*-*-*-*-koi8-r')
-
 
 dnl TrueType Fonts
-define(`VERY_SMALL_FONT', `xft:Sans:size=10')
-define(`SMALL_FONT', `xft:Sans:size=12')
-define(`MEDIUM_FONT', `xft:Sans:size=14')
-define(`BIG_FONT', `xft:Sans:size=16')
-define(`LARGE_FONT', `xft:Sans:size=18')
-define(`HUGE_FONT', `xft:Sans:size=20')
-define(`GIGANTIC_FONT', `xft:Sans:size=22')
+define(`VERY_SMALL_FONT', `"xft:Liberation Mono:size=10"')
+define(`SMALL_FONT', `"xft:Liberation Mono:size=12"')
+define(`MEDIUM_FONT', `"xft:Liberation Mono:size=14"')
+define(`BIG_FONT', `"xft:Liberation Mono:size=16"')
+define(`LARGE_FONT', `"xft:Liberation Mono:size=18"')
+define(`HUGE_FONT', `"xft:Liberation Mono:size=20"')
+define(`GIGANTIC_FONT', `"xft:Liberation Mono:size=22"')
 
 dnl Bold TT fonts
 define(`SMALL_BOLD_FONT', SMALL_FONT`:Bold')
@@ -80,7 +67,7 @@ define(`TERM_GEOM_BOTRT', TERM_GEOM`-0-0')
 
 define(`TERM_GEOM_BIG',
 ifelse(eval(WIDTH < 1024), 1, `96x30',
-       eval(WIDTH < 1920), 1, `112x32+2-0', `119x32+1-0'))
+       eval(WIDTH < 1920), 1, `112x32+2-0', `127x32+1-0'))
 
 
 define(`TERM', `urxvt')
@@ -92,58 +79,110 @@ define(`TERM_KOI8_BOTLT', `TERM_KOI8 -geometry TERM_GEOM_BOTLT')
 define(`TERM_RU_UTF8_BOTLT', `TERM_RU_UTF8 -geometry TERM_GEOM_BOTLT')
 define(`TERM_KOI8_BOTRT', `TERM_KOI8 -geometry TERM_GEOM_BOTRT')
 define(`TERM_RU_UTF8_BOTRT', `TERM_RU_UTF8 -geometry TERM_GEOM_BOTRT')
+define(`TERM_KOI8_BIG', `TERM_KOI8 -geometry TERM_GEOM_BIG')
+define(`TERM_UTF8_BIG', `TERM_RU_UTF8 -geometry TERM_GEOM_BIG')
+
+
+define(`SSH', `cgmem_nice 300 ssh')
+
+define(`TERM_SSH', `$1 -e SSH $2')
+
+define(`TERM_TITLE_SSH', `$1 -title "$3" -n "$3" -e SSH $2')
+
+define(`TERM_KOI8_SSH',
+`TERM_TITLE_SSH(`TERM_KOI8', $1, $2)')
+
+define(`SSH_SCREEN_KOI8',
+`SSH -t $1 TZ="$(cat /etc/timezone)" exec /usr/bin/screen -xRR -S default-koi8')
+define(`SSH_SCREEN_UTF8',
+`SSH -t $1 TZ="$(cat /etc/timezone)" exec /usr/bin/screen -xRR -S default-utf8')
+
+define(`TERM_TITLE_SSH_SCREEN_KOI8',
+`$1 -title "$3 scr" -n "$3 scr" -e SSH_SCREEN_KOI8($2)')
+
+define(`TERM_TITLE_SSH_SCREEN_UTF8',
+`$1 -title "$3 scr" -n "$3 scr" -e SSH_SCREEN_UTF8($2)')
+
+define(`MENU_TERM_KOI8_SSH',
+`"$2 (koi8)" TERM_KOI8_SSH($1, $2)')
+
+define(`TERM_KOI8_BOTLT_SSH',
+`TERM_TITLE_SSH(`TERM_KOI8_BOTLT', $1, $2)')
+
+define(`TERM_KOI8_BOTRT_SSH',
+`TERM_TITLE_SSH(`TERM_KOI8_BOTRT', $1, $2)')
+
+define(`MENU_TERM_KOI8_BOTLT_SSH',
+`"$2 (btlt,koi8)" TERM_KOI8_BOTLT_SSH($1, $2)')
+
+define(`MENU_TERM_KOI8_BOTRT_SSH',
+`"$2 (btrt,koi8)" TERM_KOI8_BOTRT_SSH($1, $2)')
+
+define(`TERM_KOI8_SSH_SCREEN',
+`TERM_TITLE_SSH_SCREEN_KOI8(`TERM_KOI8', $1, $2)')
+
+define(`MENU_TERM_KOI8_SSH_SCREEN',
+`"$2 (koi8,scr)" TERM_TITLE_SSH_SCREEN_KOI8(`TERM_KOI8', $1, $2)')
+
+define(`TERM_KOI8_BOTLT_SSH_SCREEN',
+`TERM_TITLE_SSH_SCREEN_KOI8(`TERM_KOI8_BOTLT', $1, $2)')
 
+define(`TERM_KOI8_BOTRT_SSH_SCREEN',
+`TERM_TITLE_SSH_SCREEN_KOI8(`TERM_KOI8_BOTRT', $1, $2)')
 
-define(`SSH', `cgmem_nice 300 ssh -4')
+define(`MENU_TERM_KOI8_BOTLT_SSH_SCREEN',
+`"$2 (btlt,koi8,scr)" TERM_KOI8_BOTLT_SSH_SCREEN($1, $2)')
 
-define(`REMOTE_HOST_TERM', `$1 -e SSH $2')
+define(`MENU_TERM_KOI8_BOTRT_SSH_SCREEN',
+`"$2 (btrt,koi8,scr)" TERM_KOI8_BOTRT_SSH_SCREEN($1, $2)')
 
-define(`REMOTE_HOST_TERM_TITLE', `$1 -title $3 -n $3 -e SSH $2')
+define(`TERM_UTF8_SSH',
+`TERM_TITLE_SSH(`TERM_RU_UTF8', $1, $2)')
 
-define(`REMOTE_HOST_KOI8',
-REMOTE_HOST_TERM_TITLE(TERM_KOI8, $1, $2))
+define(`MENU_TERM_UTF8_SSH',
+`"$2 (utf8)" TERM_UTF8_SSH($1, $2)')
 
-define(`REMOTE_SCREEN_KOI8', `-t $1 exec /usr/bin/screen -xRR -S default-koi8')
-define(`REMOTE_SCREEN_UTF8', `-t $1 exec /usr/bin/screen -xRR -S default-utf8')
+define(`TERM_UTF8_BOTLT_SSH',
+`TERM_TITLE_SSH(`TERM_RU_UTF8_BOTLT', $1, $2)')
 
-define(`REMOTE_HOST_KOI8_MENU',
-"$2 (koi8)" REMOTE_HOST_KOI8($1, $2))
+define(`TERM_UTF8_BOTRT_SSH',
+`TERM_TITLE_SSH(`TERM_RU_UTF8_BOTRT', $1, $2)')
 
-define(`REMOTE_HOST_KOI8_BOTLT',
-REMOTE_HOST_TERM_TITLE(TERM_KOI8_BOTLT, $1, $2))
+define(`MENU_TERM_UTF8_BOTLT_SSH',
+`"$2 (btlt,utf8)" TERM_UTF8_BOTLT_SSH($1, $2)')
 
-define(`REMOTE_HOST_KOI8_BOTRT',
-REMOTE_HOST_TERM_TITLE(TERM_KOI8_BOTRT, $1, $2))
+define(`MENU_TERM_UTF8_BOTRT_SSH',
+`"$2 (btrt,utf8)" TERM_UTF8_BOTRT_SSH($1, $2)')
 
-define(`REMOTE_HOST_KOI8_BOTLT_MENU',
-"$2 (koi8,btlt)" REMOTE_HOST_KOI8_BOTLT($1, $2))
+define(`TERM_UTF8_SSH_SCREEN',
+`TERM_TITLE_SSH_SCREEN_UTF8(`TERM_RU_UTF8', $1, $2)')
 
-define(`REMOTE_HOST_KOI8_BOTRT_MENU',
-"$2 (koi8,btrt)" REMOTE_HOST_KOI8_BOTRT($1, $2))
+define(`MENU_TERM_UTF8_SSH_SCREEN',
+`"$2 (utf8,scr)" TERM_UTF8_SSH_SCREEN($1, $2)')
 
-define(`REMOTE_HOST_UTF8',
-REMOTE_HOST_TERM_TITLE(TERM_RU_UTF8, $1, $2))
+define(`TERM_UTF8_BOTLT_SSH_SCREEN',
+`TERM_TITLE_SSH_SCREEN_UTF8(`TERM_RU_UTF8_BOTLT', $1, $2)')
 
-define(`REMOTE_HOST_UTF8_MENU',
-"$2 (utf8)" REMOTE_HOST_UTF8($1, $2))
+define(`TERM_UTF8_BOTRT_SSH_SCREEN',
+`TERM_TITLE_SSH_SCREEN_UTF8(`TERM_RU_UTF8_BOTRT', $1, $2)')
 
-define(`REMOTE_HOST_UTF8_BOTLT',
-REMOTE_HOST_TERM_TITLE(TERM_RU_UTF8_BOTLT, $1, $2))
+define(`MENU_TERM_UTF8_BOTLT_SSH_SCREEN',
+`"$2 (btlt,utf8,scr)" TERM_UTF8_BOTLT_SSH_SCREEN($1, $2)')
 
-define(`REMOTE_HOST_UTF8_BOTRT',
-REMOTE_HOST_TERM_TITLE(TERM_RU_UTF8_BOTRT, $1, $2))
+define(`MENU_TERM_UTF8_BOTRT_SSH_SCREEN',
+`"$2 (btrt,utf8,scr)" TERM_UTF8_BOTRT_SSH_SCREEN($1, $2)')
 
-define(`REMOTE_HOST_UTF8_BOTLT_MENU',
-"$2 (utf8,btlt)" REMOTE_HOST_UTF8_BOTLT($1, $2))
+define(`TERM_KOI8_BIG_SSH',
+`TERM_KOI8_BIG -title "$2" -n "$2" -e SSH "$1"')
 
-define(`REMOTE_HOST_UTF8_BOTRT_MENU',
-"$2 (utf8,btrt)" REMOTE_HOST_UTF8_BOTRT($1, $2))
+define(`MENU_TERM_KOI8_BIG_SSH',
+`"$2 (koi8)" TERM_KOI8_BIG_SSH($1, $2)')
 
-define(`REMOTE_HOST_KOI8_BIG',
-TERM_KOI8 -geometry TERM_GEOM_BIG -title "$2" -n "$2" -e SSH "$1")
+define(`TERM_KOI8_BIG_SSH_SCREEN',
+`TERM_KOI8_BIG -title "$2" -n "$2" -e SSH_SCREEN_KOI8 "$1"')
 
-define(`REMOTE_HOST_KOI8_BIG_MENU',
-"$2 (koi8)" REMOTE_HOST_KOI8_BIG($1, $2))
+define(`MENU_TERM_KOI8_BIG_SSH_SCREEN',
+`"$2 (koi8,scr)" TERM_KOI8_BIG_SSH_SCREEN($1, $2)')
 
 divert
 
@@ -152,7 +191,7 @@ divert
 #
 # Colon seperated unix directory paths for Modules, xpm files, and bitmaps
 #ModulePath /usr/lib/fvwm
-ImagePath /usr/share/pixmaps/fvwm:/usr/share/pixmaps:/usr/include/X11/bitmaps #:/usr/local/firefox/browser/chrome/icons/default:/usr/local/firefox/browser/icons
+ImagePath /usr/share/icons/hicolor/32x32/apps/:/usr/share/pixmaps/fvwm:/usr/share/pixmaps:/usr/include/X11/bitmaps #:/usr/local/firefox/browser/chrome/icons/default:/usr/local/firefox/browser/icons
 
 ############################################################################
 # COLORS and FONTS
@@ -251,10 +290,6 @@ Style "FvwmPager"       Layer 2
 # Terminals
 Style "*term"           Icon term.xpm
 Style "*rxvt"           Icon term.xpm
-Style "term-im-local"   Icon pidgin-menu.xpm
-Style "term-im-remote"  Icon rcalc2.xpm
-Style "term-im-*"       IconBox 630 -75 -2 -2, IconGrid 200 80
-Style "term-im-*"       StartsOnPage 1 1 0, StartIconic
 
 # Browsers' windows
 Style "Certificate Manager" PositionPlacement Center
@@ -263,18 +298,11 @@ Style "*Mozilla*"       PositionPlacement +0 -0
 
 Style "*Chromium*"      PositionPlacement +0 -0
 
-# IM
-Style "Gajim"           PositionPlacement +0 -0
-Style "* - Gajim"       MinOverlapPercentPlacement
-# Pidgin
-Style "Buddy List"      PositionPlacement +0 -0
-Style "*Pidgin*"        MinOverlapPercentPlacement
-
-# (S)MPlayer
-Style "*MPlayer*"       Layer 6, PositionPlacement 250p 100p
-Style "*mpv"            Layer 6, PositionPlacement 250p 100p
+# Video player(s)
+Style "*mpv"            Layer 6, PositionPlacement 200p 150p
 
 Style "*clock"          !Title, Sticky, WindowListSkip, Color Black/#40c040, NeverFocus, PositionPlacement 50-50w +1p, Layer 2
+Style "deadbeef"        PositionPlacement -0 -0
 Style "gxmessage"       PositionPlacement 50-50w +20
 Style "*lock"           !Title, Sticky, WindowListSkip
 Style "Mosaic"          NoPPosition
@@ -477,7 +505,7 @@ AddToFunc RestartFunction
 DestroyFunc UrgencyFunc
 AddToFunc UrgencyFunc
 +                             I Iconify off
-+                             I ThisWindow ("*Downloads") Break
++                             I ThisWindow ("*Downloads|Skype") Break 1
 +                             I FlipFocus
 +                             I Raise
 +                             I WarpToWindow 5p 5p
@@ -487,19 +515,15 @@ AddToFunc StartStandardSession
 +              I GotoDeskAndPage 0 0 0
 +              I TERM_KOI8
 +              I Wait TERM
-+              I GotoDeskAndPage 0 0 1
-+              I TERM_RU_UTF8 -geometry 38x30+0-0
-+              I Wait URxvt
 +              I Exec exec cgmem_nice 200 pulseaudio --start
 +              I PaVuControl
 +              I Exec exec "$HOME"/current/projects/audio-cdr-video/audio/pa-mic-off
 +              I XsetbgFilename
 +              I Wait gxmessage
 +              I GotoDeskAndPage 2 0 1
-+              I TERM_KOI8 -geometry TERM_GEOM_BIG
++              I TERM_KOI8_BIG
 +              I Wait TERM
 +              I FireFox
-+              I GotoDeskAndPage 0 1 1
 
 DestroyFunc ResumeFunction
 AddToFunc ResumeFunction
@@ -512,7 +536,7 @@ AddToFunc ResumeFunction
 +              I XsetbgFilename
 +              I Wait gxmessage
 +              I Any ("*Mozilla Firefox") GotoDeskAndPage 0 1 1
-+              I TestRc (Match) Break
++              I TestRc (Match) Break 1
 +              I None ("*Mozilla Firefox") FireFox
 
 ############################################################################
@@ -583,50 +607,43 @@ AddToFunc Raise-All           I All Raise
 
 DestroyFunc PaVuControl
 AddToFunc PaVuControl         I GotoDeskAndPage 0 1 1
++                             I Exec exec pulseaudio --kill
++                             I Exec exec cgmem_nice 200 pulseaudio --start
 +                             I Exec exec cgmem_nice 200 pavucontrol
 +                             I Wait "Volume Control"
 
-changequote([,])
 DestroyFunc Id3Info
-AddToFunc Id3Info             I Exec "$HOME"/lib/audio/mp3/id3info.py "`audtool --current-song-filename`" | text-wrap.py | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -
-changequote([`], ['])
-
-DestroyFunc AudioPlayer
-AddToFunc AudioPlayer         I GotoDeskAndPage 0 1 1
-+                             I Exec LC_CTYPE=ru_RU.KOI8-R exec cgmem_nice 200 audacious
-
-DestroyFunc Term-Iskra
-AddToFunc Term-Iskra          I GotoDeskAndPage 1 1 2
-+                             I REMOTE_HOST_KOI8(REMOTE_SCREEN_KOI8(iskra-aviel.phdru.name), iskra)
-
-DestroyFunc Term-Iskra-Big
-AddToFunc Term-Iskra-Big      I GotoDeskAndPage 1 1 2
-+                             I REMOTE_HOST_KOI8_BIG(iskra-aviel.phdru.name, ISKRA)
-
-DestroyFunc Term-Oper
-AddToFunc Term-Oper           I GotoDeskAndPage 1 1 2
-+                             I REMOTE_HOST_KOI8_BOTRT(REMOTE_SCREEN_KOI8(oper.med.ru), oper)
-
-DestroyFunc Term-Oper-Big
-AddToFunc Term-Oper-Big       I GotoDeskAndPage 1 1 2
-+                             I REMOTE_HOST_KOI8_BIG(oper.med.ru, OPER)
-
-DestroyFunc Term-Phdru
-AddToFunc Term-Phdru          I GotoDeskAndPage 1 0 1
-+                             I REMOTE_HOST_KOI8(REMOTE_SCREEN_KOI8(phdru.name), phdru.name)
-
-DestroyFunc Term-Phdru-Big
-AddToFunc Term-Phdru-Big      I GotoDeskAndPage 1 0 1
-+                             I REMOTE_HOST_KOI8_BIG(phdru.name, phdru.name)
+AddToFunc Id3Info             I Exec "$HOME"/lib/audio/mp3/id3info.py "$(audtool --current-song-filename)" | text-wrap.py | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -
+
+DestroyFunc Term2HostsHome
+AddToFunc Term2HostsHome      I GotoDeskAndPage 1 1 2
++                             I PipeRead 'test -n "$(ip address show tun0 up 2>/dev/null)" || test -n "$(ip address show wg0 up 2>/dev/null)" || { echo Exec exec gxmessage -buttons Ok -default Ok "ERROR: Cannot find tun0/wg0 interfaces!"; echo Wait gxmessage; echo Break 1; }'
++                             I TERM_KOI8_SSH_SCREEN(iskra-aviel.phdru.name, iskra)
++                             I Wait TERM
++                             I GotoDeskAndPage 1 0 1
++                             I TERM_KOI8_SSH_SCREEN(-D 1080 phdru.name, phdru.name)
++                             I Wait TERM
++                             I GotoDeskAndPage 1 1 2
 
 DestroyFunc FireFox
-AddToFunc FireFox             I Any ("*Mozilla Firefox") Break
+AddToFunc FireFox             I Any ("*Mozilla Firefox") Break 1
 +                             I GotoDeskAndPage 1 0 0
-+                             I Exec LC_CTYPE=ru_RU.KOI8-R exec cgmem_nice 4000 start-browser firefox
-+                             I Wait "*Mozilla Firefox"
-+                             I Exec LC_CTYPE=ru_RU.KOI8-R exec cgmem_nice 4000 firefox --new-window
++                             I Exec LC_CTYPE=ru_RU.KOI8-R exec cgmem_nice 4000 start-browser firefox -P phd
 +                             I Wait "*Mozilla Firefox"
-+                             I Next ("*Mozilla Firefox") Iconify true
+
+DestroyFunc SuspendFireFox
+AddToFunc SuspendFireFox      I Exec exec pkill -STOP firefox
++                             I All ("*Mozilla Firefox") Iconify True
+
+DestroyFunc ResumeFireFox
+AddToFunc ResumeFireFox       I Exec exec pkill -CONT firefox
++                             I All ("*Mozilla Firefox") Iconify False
+
+DestroyFunc Chromium
+AddToFunc Chromium            I Any ("*Chromium") Break 1
++                             I GotoDeskAndPage 1 1 0
++                             I Exec LC_CTYPE=ru_RU.KOI8-R exec cgmem_nice 2000 start-browser chromium
++                             I Wait "*Chromium"
 
 DestroyFunc Gajim
 AddToFunc Gajim               I GotoDeskAndPage 1 1 0
@@ -636,6 +653,10 @@ DestroyFunc Pidgin
 AddToFunc Pidgin              I GotoDeskAndPage 1 1 0
 +                             I Exec exec cgmem_nice 300 pidgin
 
+DestroyFunc Skype
+AddToFunc Skype               I GotoDeskAndPage 0 0 1
++                             I Exec BROWSER=firefox exec cgmem_nice 2000 skypeforlinux
+
 DestroyFunc XFilename
 AddToFunc XSetbgFilename      I Exec "$HOME"/current/projects/xsetbg/print-filename.py | text-wrap.py -w TEXT_WIDTH -s | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -
 
@@ -683,12 +704,12 @@ AddToMenu Terminals     "Terminals" Title
 +               "Grey term (koi8)" TERM_KOI8
 +               "Grey term (utf8)" TERM_RU_UTF8
 +               "Grey term (heb-utf8)" TERM_HEB_UTF8
-+               "Grey term (koi8,btlt)" TERM_KOI8_BOTLT
-+               "Grey term (koi8,btrt)" TERM_KOI8_BOTRT
-+               "Grey term (utf8,btlt)" TERM_RU_UTF8_BOTLT
-+               "Grey term (utf8,btrt)" TERM_RU_UTF8_BOTRT
-+               "Big grey term (koi8)" TERM_KOI8 -geometry TERM_GEOM_BIG
-+               "Big grey term (utf8)" TERM_RU_UTF8 -geometry TERM_GEOM_BIG
++               "Grey term (btlt,koi8)" TERM_KOI8_BOTLT
++               "Grey term (btrt,koi8)" TERM_KOI8_BOTRT
++               "Grey term (btlt,utf8)" TERM_RU_UTF8_BOTLT
++               "Grey term (btrt,utf8)" TERM_RU_UTF8_BOTRT
++               "Big grey term (koi8)" TERM_KOI8_BIG
++               "Big grey term (utf8)" TERM_UTF8_BIG
 +                       ""      Nop
 +               "White/black term (koi8)" TERM_KOI8 -fg white -cr white -bg black
 +               "White/black term (utf8)" TERM_RU_UTF8 -fg white -bg black
@@ -719,23 +740,25 @@ AddToMenu TermColors    "Term Colors" Title
 +                       "Term: white/black" TERM_KOI8 -fg white -cr white -bg black
 
 AddToMenu Systems       "Systems" Title
-+                       REMOTE_HOST_KOI8_MENU(REMOTE_SCREEN_KOI8(iskra-aviel.phdru.name), iskra)
-+                       REMOTE_HOST_UTF8_BOTLT_MENU(iskra-aviel.phdru.name, iskra)
-+                       REMOTE_HOST_KOI8_BIG_MENU(iskra-aviel.phdru.name, ISKRA)
++                       "Iskra+Phdru" Term2HostsHome
 +                       ""        Nop
-+                       REMOTE_HOST_KOI8_BOTRT_MENU(REMOTE_SCREEN_KOI8(oper.med.ru), oper)
-+                       REMOTE_HOST_UTF8_BOTRT_MENU(oper.med.ru, oper)
-+                       REMOTE_HOST_KOI8_BIG_MENU(oper.med.ru, OPER)
+pushdef(`TERM_KOI8', `Exec LC_CTYPE=ru_RU.KOI8-R exec TERM -xrm "*Page: 1 1 1"')dnl
+pushdef(`TERM_RU_UTF8', `Exec LC_CTYPE=ru_RU.UTF-8 exec TERM -name URxvt -xrm "*Page: 1 1 1"')dnl
++                       MENU_TERM_KOI8_SSH_SCREEN(iskra-aviel.phdru.name, iskra)
++                       MENU_TERM_UTF8_BOTLT_SSH(iskra-aviel.phdru.name, iskra)
++                       MENU_TERM_KOI8_BIG_SSH(iskra-aviel.phdru.name, ISKRA)
 +                       ""        Nop
-+                       REMOTE_HOST_KOI8_MENU(REMOTE_SCREEN_KOI8(phdru.name), phdru)
-+                       REMOTE_HOST_UTF8_BOTLT_MENU(phdru.name, phdru)
-+                       REMOTE_HOST_KOI8_BIG_MENU(phdru.name, PHDRU)
+pushdef(`TERM_KOI8', `Exec LC_CTYPE=ru_RU.KOI8-R exec TERM -xrm "*Page: 1 0 1"')dnl
+pushdef(`TERM_RU_UTF8', `Exec LC_CTYPE=ru_RU.UTF-8 exec TERM -name URxvt -xrm "*Page: 1 0 1"')dnl
++                       MENU_TERM_KOI8_SSH_SCREEN(phdru.name, phdru)
++                       MENU_TERM_KOI8_SSH_SCREEN(-D 1080 phdru.name, phdru SOCKS5)
++                       MENU_TERM_UTF8_BOTLT_SSH(phdru.name, phdru)
++                       MENU_TERM_KOI8_BIG_SSH(phdru.name, PHDRU)
+popdef(`TERM_KOI8', `TERM_RU_UTF8')dnl
 
 AddToMenu FvwmCommands  "Fvwm Commands" Title
 +                       "Restart" Restart
 +                       "Raise all" Raise-All
-#+                       "Restart Fvwm2" Restart fvwm2
-#+                       "Start Fvwm"    Restart fvwm
 +                       "Fvwm Setup"    Popup FvwmSetup
 +                       "Fvwm Modules"  Popup FvwmModules
 +                       "" Nop
@@ -800,39 +823,33 @@ AddToMenu RootMenu "Root Menu"  Title
 +               "XSetBg"        Popup XSetBgMenu
 +               "Fvwm Commands" Popup FvwmCommands
 
+DestroyMenu OSMenu
+AddToMenu OSMenu        "OS commands:" Title
++                       "Suspend to both" Exec exec s2b
++                       "Suspend to disk" Exec exec s2d
++                       "Suspend to ram"  Exec exec s2r
+
 # This menu will fire up some often used programs
-DestroyMenu  Utilities
+DestroyMenu Utilities
 AddToMenu Utilities     "Choose one:" Title
-+                       "Evince" Exec LC_CTYPE=ru_RU.KOI8-R exec evince
-+                       "FBReader" Exec LC_CTYPE=ru_RU.KOI8-R exec fbreader
++                       "OS"     Popup OSMenu
 +                       ""       Nop
 +                       "GVim (koi8)" Exec LC_CTYPE=ru_RU.KOI8-R exec gvim
 +                       "GVim (utf8)" Exec LC_CTYPE=ru_RU.UTF-8  exec gvim
 +                       ""       Nop
-#+                       "XFortune" Exec /usr/games/fortune | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -
-#+                       "xbuffy" Exec exec xbuffy -fn 'XBUFFY_FONT' -geometry +0+125 -boxfile mail/misc/.xbuffyrc
-#+                       ""       Nop
-+                       "pavucontrol" PaVuControl
-+                       "AudioPlayer" AudioPlayer
-+                       "Id3Info"     Id3Info
-+                       ""       Nop
-+                       "xload"  Exec exec xload -geometry =136x136+0+0
-+                       "Top"    TERM_KOI8 -T Top -n Top -e top
-+                       ""       Nop
 +                       "Refresh Screen" Refresh
 +                       "xrefresh" Exec exec xrefresh
 +                       ""       Nop
-+                       "Pidgin"      Pidgin
-+                       "xcalc"  Exec exec xcalc
-+                       ""       Nop
-+                       "xclipboard" Exec exec xclipboard
-+                       "xcutsel" Exec exec xcutsel
++                       "Skype" Skype
++                       "pavucontrol" PaVuControl
 
 DestroyMenu  Browsers
 AddToMenu Browsers      "Choose one:" Title
 +                       "FireFox" FireFox
-+                       "Chromium" None ("*Chromium") Exec LC_CTYPE=ru_RU.KOI8-R exec cgmem_nice 2000 start-browser chromium
-+                       "Opera" None ("*Opera") Exec LC_CTYPE=ru_RU.KOI8-R exec cgmem_nice 2000 start-browser opera
++                       "Suspend FireFox" SuspendFireFox
++                       "Resume FireFox" ResumeFireFox
++                       ""       Nop
++                       "Chromium" Chromium
 
 # A wide variety of screenlocking options...
 #AddToMenu XlockMenu     "Choose one:" Title
@@ -849,14 +866,17 @@ AddToMenu Browsers      "Choose one:" Title
 #+                       "Blank" Exec exec xlock -mode blank
 
 AddToMenu XScreenSaverMenu     "Choose mode:" Title
-+                       "Blank Screen Now" Exec exec xscreensaver-command -activate
-+                       "Lock Screen Now"  Exec exec xscreensaver-command -lock
-+                       "Screen Saver Demo" Exec exec xscreensaver-command -demo
-+                       "Screen Saver Preferences"  Exec exec xscreensaver-command -prefs
-+                       "Reinitialize Screen Saver" Exec exec xscreensaver-command -restart
++                       "Blank Screen via xset" Exec xset dpms force off
+#+                       "Blank Screen Now" Exec exec xscreensaver-command --suspend
++                       "Activate A Hack Now" Exec exec xscreensaver-command --activate
++                       "Lock Screen Now"  Exec exec xscreensaver-command --lock
++                       "" Nop
++                       "Screen Saver Demo" Exec exec xscreensaver-demo
++                       "Screen Saver Settings"  Exec exec xscreensaver-settings
 +                       "" Nop
-+                       "Kill Screen Saver"         Exec exec xscreensaver-command -exit
++                       "Kill Screen Saver"         Exec exec xscreensaver-command --exit
 +                       "Launch Screen Saver"       Exec exec xscreensaver
++                       "Reinitialize Screen Saver" Exec exec xscreensaver-command --restart
 
 AddToMenu XSetBgMenu    "XSetBg" Title
 +                       "Change wallpaper" Exec exec "$HOME"/current/projects/xsetbg/xsetbg-force
@@ -864,18 +884,16 @@ AddToMenu XSetBgMenu    "XSetBg" Title
 +                       "Stop" Exec exec "$HOME"/current/projects/xsetbg/xsetbg-http-stop
 +                       "Restart" Exec exec "$HOME"/current/projects/xsetbg/xsetbg-http-restart
 +                       ""       Nop
-changequote([,])
-+                       "Xli" Exec fn="`$HOME/current/projects/xsetbg/print-filename.py -e koi8-r`" && exec xli -title "`echo $fn | sed 's/ /_/g'`" "$fn"
-+                       "Xli (scaled)" Exec fn="`$HOME/current/projects/xsetbg/print-filename.py -e koi8-r`" && exec xli -title "`echo $fn | sed 's/ /_/g'`" -zoom auto "$fn"
-+                       "Open in browser" Exec exec webbrowserX -n "`$HOME/current/projects/xsetbg/print-filename.py -e koi8-r`"
++                       "Xli" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" "$fn"
++                       "Xli (scaled)" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" -zoom auto "$fn"
++                       "Open in browser" Exec exec cgmem_nice 4000 webbrowserX -n "$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r)"
 +                       "Filename" Exec exec "$HOME"/current/projects/xsetbg/print-filename.py -e koi8-r
 +                       "XFilename" Exec "$HOME"/current/projects/xsetbg/print-filename.py | text-wrap.py | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -
 +                       "XFilename (wrapped)" XSetbgFilename
 +                       ""       Nop
-+                       "Xli (prev.)" Exec fn="`$HOME/current/projects/xsetbg/print-filename.py -e koi8-r 1`" && exec xli -title "`echo $fn | sed 's/ /_/g'`" "$fn"
-+                       "Xli (prev., scaled)" Exec fn="`$HOME/current/projects/xsetbg/print-filename.py -e koi8-r 1`" && exec xli -title "`echo $fn | sed 's/ /_/g'`" -zoom auto "$fn"
-+                       "Open in browser (prev.)" Exec exec webbrowserX -n "`$HOME/current/projects/xsetbg/print-filename.py -e koi8-r 1`"
-changequote([`], ['])
++                       "Xli (prev.)" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r 1)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" "$fn"
++                       "Xli (prev., scaled)" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r 1)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" -zoom auto "$fn"
++                       "Open in browser (prev.)" Exec exec cgmem_nice 4000 webbrowserX -n "$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r 1)"
 +                       "Filename (prev.)" Exec exec "$HOME"/current/projects/xsetbg/print-filename.py -e koi8-r 1
 +                       "XFilename (prev.)" Exec "$HOME"/current/projects/xsetbg/print-filename.py 1 | text-wrap.py | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -
 +                       "XFilename (prev., wrapped)" Exec "$HOME"/current/projects/xsetbg/print-filename.py 1 | text-wrap.py -w TEXT_WIDTH -s | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -
@@ -917,21 +935,25 @@ changequote([`], ['])
 #*FvwmButtons: (Swallow XClock 'Exec exec xclock -update 1 -geometry -3000-3000')
 
 # Buttons
-pushdef(`TERM_KOI8', `Exec "TERM" LC_CTYPE=ru_RU.KOI8-R exec TERM')
-pushdef(`TERM_RU_UTF8', `Exec "URxvt" LC_CTYPE=ru_RU.UTF-8 exec TERM -name URxvt')
+pushdef(`TERM_KOI8', `Exec "TERM" LC_CTYPE=ru_RU.KOI8-R exec TERM')dnl
+pushdef(`TERM_RU_UTF8', `Exec "URxvt" LC_CTYPE=ru_RU.UTF-8 exec TERM -name URxvt')dnl
 *FvwmButtons: (Title Term,     Icon rterm2.xpm,      Action TERM_KOI8)
 *FvwmButtons: (Title UTF-8,    Icon rterm2.xpm,      Action TERM_RU_UTF8)
-*FvwmButtons: (Title phdru,    Icon xterm-sgi.xpm,   Action REMOTE_HOST_KOI8(REMOTE_SCREEN_KOI8(-D 1080 phdru.name), phdru.name))
-*FvwmButtons: (Title iskra,    Icon xterm-sgi.xpm,   Action REMOTE_HOST_KOI8(REMOTE_SCREEN_KOI8(iskra-aviel.phdru.name), iskra))
-*FvwmButtons: (Title oper,     Icon xterm-linux.xpm, Action REMOTE_HOST_KOI8_BOTRT(REMOTE_SCREEN_KOI8(oper.med.ru), oper))
-popdef(`TERM_KOI8', `TERM_RU_UTF8')
+popdef(`TERM_KOI8', `TERM_RU_UTF8')dnl
+pushdef(`TERM_KOI8', `Exec "TERM" LC_CTYPE=ru_RU.KOI8-R exec TERM -xrm "*Page: 1 0 1"')dnl
+*FvwmButtons: (Title "phdru (k8,s)",    Icon xterm-sgi.xpm,   Action TERM_KOI8_SSH_SCREEN(phdru.name, phdru.name))
+popdef(`TERM_KOI8')dnl
+pushdef(`TERM_KOI8', `Exec "TERM" LC_CTYPE=ru_RU.KOI8-R exec TERM -xrm "*Page: 1 1 1"')dnl
+*FvwmButtons: (Title "iskra (k8,s)",    Icon xterm-sgi.xpm,   Action TERM_KOI8_SSH_SCREEN(iskra-aviel.phdru.name, iskra))
+popdef(`TERM_KOI8')dnl
 
 *FvwmButtons: (Title Wallpaper, Icon find1.xpm,        Action Exec "gxmessage" "$HOME"/current/projects/xsetbg/print-filename.py | text-wrap.py -w TEXT_WIDTH -s | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -)
 *FvwmButtons: (Title "-1",      Icon find1.xpm,        Action Exec "gxmessage" "$HOME"/current/projects/xsetbg/print-filename.py 1 | text-wrap.py -w TEXT_WIDTH -s | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -)
 *FvwmButtons: (Title Next,      Icon Jrecycle.xpm,     Action Exec exec "$HOME"/current/projects/xsetbg/xsetbg-http-force)
-*FvwmButtons: (Title pavucontrol, Icon mini.sound.xpm, Action Exec "Volume Control" exec cgmem_nice 200 pavucontrol)
+#*FvwmButtons: (Title pavucontrol, Icon mini.sound.xpm, Action Exec "Volume Control" exec cgmem_nice 200 pavucontrol)
 #*FvwmButtons: (Title Id3Info,  Icon bell.xpm,         Action Id3Info)
-*FvwmButtons: (Title AudioPlayer,  Icon bell.xpm,      Action Exec "Audacious" LC_CTYPE=ru_RU.KOI8-R exec cgmem_nice 200 audacious)
+#*FvwmButtons: (Title Skype,    Icon skypeforlinux.png, Action Exec "Skype" FvwmCommand "GotoDeskAndPage 0 0 1" && BROWSER=firefox exec cgmem_nice 2000 skypeforlinux)
+*FvwmButtons: (Title AudioPlayer,  Icon bell.xpm,      Action Exec "deadbeef" LC_CTYPE=ru_RU.KOI8-R FvwmCommand "GotoDeskAndPage 0 1 1" && exec cgmem_nice 400 deadbeef)
 #*FvwmButtons: (Title XLock,     Icon Jxlock.xpm,      Action Exec exec xscreensaver-command -lock)
 
 ############################################################################
@@ -960,7 +982,7 @@ popdef(`TERM_KOI8', `TERM_RU_UTF8')
 #*Rlogin: Input        UserName  10   ""
 #*Rlogin: Line         expand
 #*Rlogin: Button       quit "Login" ^M
-#*Rlogin: Command      TERM_KOI8 -T term@$(HostName) -e rlogin $(HostName) $(Custom?-l $(UserName))
+`#'*Rlogin: Command      TERM_KOI8 -T term@$(HostName) -e rlogin $(HostName) $(Custom?-l $(UserName))
 #*Rlogin: Button       restart   "Clear"
 #*Rlogin: Command Beep
 #*Rlogin: Button       quit "Cancel"
index b91ec8dc967666d20dc7d07680cec2248486e713..e38baa0e704ab3c020dd017f1a57e768c5f791a4 100644 (file)
        sw = show --word-diff --decorate
        unstage = reset HEAD --
 
-       pr = "!f() { git fetch ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f"
+       # Github: pull request, Gitlab: merge request
+       mpr = "!f() { git fetch ${2:-origin} refs/$3/$1/head:pr/$1 && if [ \"$4\" = checkout ]; then git checkout pr/$1; fi; }; f"
+       fetch-mr = "!f() { git mpr $1 ${2:-origin} merge-requests; }; f"
+       merge-request = "!f() { git mpr $1 ${2:-origin} merge-requests checkout; }; f"
+       fetch-pr = "!f() { git mpr $1 ${2:-origin} pull; }; f"
+       pull-request = "!f() { git mpr $1 ${2:-origin} pull checkout; }; f"
        clean-pr = "!git checkout master ; git for-each-ref refs/heads/pr/* --format=\"%(refname)\" | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done"
 
 [branch]
 [include]
        path = ~/lib/config/git/light_bg
 
+[init]
+       defaultBranch = master
+
 [log]
        abbrevCommit = true
        #mailmap = true
 #[tag]
 #      sort = version:refname
 
+[tar "tar.bz2"]
+       command = bzip2 -c
+[tar "tar.xz"]
+       command = xz -c
+
 #[transfer]
 #      fsckObjects = true
 
        fontui = -family \"DejaVu Sans\" -size 18 -weight normal -slant roman -underline 0 -overstrike 0
        fontdiff = -family \"DejaVu Sans Mono\" -size 18 -weight normal -slant roman -underline 0 -overstrike 0
 
-# Github URL shortcuts
-[url "git@github.com:"]
-       insteadOf = "gh:"
-       insteadOf = "github:"
-       insteadOf = "git://github.com/"
-[url "git@gist.github.com:"]
-       insteadOf = "gst:"
-       insteadOf = "gist:"
-       insteadOf = "git://gist.github.com/"
+# git:// protocol fixers
+#[url "https://github.com/"]
+#      insteadOf = "git://github.com/"
+#[url "https://gist.github.com/"]
+#      insteadOf = "git://gist.github.com/"
+#[url "ssh://git@github.com/"]
+#      insteadOf = "git://github.com/"
+#[url "ssh://git@gist.github.com/"]
+#      insteadOf = "git://gist.github.com/"
+#[url "https://gitlab.com/"]
+#      insteadOf = "git://gitlab.com/"
+#[url "https://gist.gitlab.com/"]
+#      insteadOf = "git://gist.gitlab.com/"
+#[url "ssh://git@gitlab.com/"]
+#      insteadOf = "git://gitlab.com/"
+#[url "ssh://git@gist.gitlab.com/"]
+#      insteadOf = "git://gist.gitlab.com/"
+
+# Protocol changers
+#[url "https://github.com/"]
+#      insteadOf = ssh://github.com/
+#      insteadOf = ssh://git@github.com/
+#      insteadOf = git@github.com:
+
+#[url "ssh://git@github.com/"]
+#      insteadOf = https://github.com/
+
+#[url "https://gitlab.com/"]
+#      insteadOf = ssh://gitlab.com/
+#      insteadOf = ssh://git@gitlab.com/
+#      insteadOf = git@gitlab.com:
+
+#[url "ssh://git@gitlab.com/"]
+#      insteadOf = https://gitlab.com/
index 7f3b9cdb0ae659bc907a8958bb57fb421dc4a84a..3284ff7cf03b7e4a36b4dd51aea4b1385307b961 100644 (file)
 ### phd
+# For MC version 3
 
-type/^Berkeley\ DB\ 1.85
-   View=%view{ascii} db_dump185 -p %f
+Type/^Berkeley\ DB\ 1.85
+View=%view{ascii} db_dump185 -p %f
 
 # Compiled HTML
-#shell/.chm
-#   Open=fbreader %f &
+#Shell/.chm
+#Open=fbreader %f &
 #
 ## DejaVu
-#shell/.djvu
-#   Open=djview %f &
+#Shell/.djvu
+#Open=djview %f &
 #
 # EPUB
-shell/.epub
-   Open=fbreader %f &
+Shell/.epub
+Open=fbreader %f &
 
 # FB2
-shell/.fb2
-   Open=fbreader %f &
-   View=%view{ascii} xsltproc /usr/local/src/distr/FictionBook/FB2_2_txt_ru.xsl %f
+Shell/.fb2
+Open=fbreader %f &
+View=%view{ascii} xsltproc /usr/local/src/distr/FictionBook/FB2_2_txt_ru.xsl %f
 
-#type/^PostScript
-#   Open=libreoffice %f &
-#   View=%view{ascii} ps2ascii %f
+#Type/^PostScript
+#Open=libreoffice %f &
+#View=%view{ascii} ps2ascii %f
 #
-## RTF
-#regex/i/\.rtf$
-#   Open=fbreader %f &
-#   View=%view{ascii} catdoc %f
+# RTF
+#Regex/i/\.rtf$
+#Open=fbreader %f &
+#View=%view{ascii} catdoc %f
 #
-#regex/i/\.(doc|wri)$
-#   Include=msoffice-doc
+#Regex/i/\.(doc|wri)$
+#Include=msoffice-doc
 #
-regex/i/\.docx$
-   Edit=libreoffice %f &
-   Open=libreoffice %f &
-   View=%view{ascii} docx2txt %f - | iconv.py -f utf-8
+Regex/i/\.docx$
+Edit=libreoffice %f &
+Open=libreoffice %f &
+View=%view{ascii} docx2txt %f - | iconv.py -f utf-8
 
-type/^Microsoft\ Word 2007+
-   Include=msoffice-doc
+Type/^Microsoft\ Word\ 2007+
+Include=msoffice-doc
 
-type/^Microsoft\ Office\ Document
-   Include=msoffice-doc
+Type/^Microsoft\ Office\ Document
+Include=msoffice-doc
 
-regex/i/\.xlsx$
-   Include=msoffice-xlsx
+Regex/i/\.xlsx$
+Include=msoffice-xlsx
 
-type/^Microsoft\ Excel 2007+
-   Include=msoffice-xlsx
+Type/^Microsoft\ Excel\ 2007+
+Include=msoffice-xlsx
 
-#type/^Composite\ Document\ File
-#   Include=msoffice-doc
+#Type/^Composite\ Document\ File
+#Include=msoffice-doc
 #
 # ftplist
-regex/\.ftplist$
-   Open=%cd %p#ftplist
+Regex/\.ftplist$
+Open=%cd %p#ftplist
 
 # Play list
-regex/i/\.(m3u|pls)$
-   Include=audio
+Regex/i/\.(m3u8?|pls)$
+Include=audio
 
 # Lossless audio
-regex/\.(cue|aac|ac3|ape|flac|wv|mka)$
-   Include=audio
+Regex/\.(cue|aac|ac3|ape|flac|wv|mka)$
+Include=audio
 
 ## Object
-#shell/.o
-#   View=%view{ascii} nm %f
-#   Disassemble=%view{ascii} objdump -d -r %f
+#Shell/.o
+#View=%view{ascii} nm %f
+#Disassemble=%view{ascii} objdump -d -r %f
 #
 ## Python
-#shell/.py
-#   Open=python %f
-#   View=%view{ascii}
-#   Compile=compyle %s
-#   Icon=snake.xpm
-#
-#regex/i/\.tiff?$
-#   Open=xview %f
+#Shell/.py
+#Open=python %f
+#View=%view{ascii} cat %f
+#Compile=compyle %s
+#Icon=snake.xpm
+
+# Conda/python packages
+Regex/\.(conda|egg|whl)$
+Include=zip
+
+#Regex/i/\.tiff?$
+#Open=xview %f
 #
-shell/.torrent
-   Open=%cd %p/torrent://
+Shell/.torrent
+Open=%cd %p/torrent://
 
-regex/i/\.xml$
-   Include=xml
+Regex/i/\.xml$
+Include=xml
 
-type/^XML *(1\.0 *)?document
-   Include=xml
+Type/^XML\ *(1\.0\ *)?document
+Include=xml
 
-#regex/i/\.zip$
-#   Open=%cd %p/uzip://
-#   View=%view{ascii} unzip -v %f
-#
-include/audio
-   Open=[ "`audtool --get-volume`" -eq 0 ] && (audacious & sleep 3); audtool --playlist-clear --playlist-addurl %f --playback-play
-   #Open=mplayer %f &
-   #Open=deadbeef %f &
-   View=%view{ascii} %f
+# LRE/Flibusta INPX
+Regex/\.(inpx)$
+Include=zip
+
+Include/audio
+#Open=[ "`audtool --get-volume`" -eq 0 ] && (cgmem_nice 200 audacious & sleep 3); audtool --playlist-clear; case %f in *.m3u8?) while read song; do audtool --playlist-addurl "$song"; done < %f ;; *) audtool --playlist-addurl %f ;; esac; audtool --playback-play
+#Open=mplay %f &
+Open=deadbeef %f &
+View=%view{ascii} cat %f
 
-include/msoffice-doc
-   Edit=libreoffice %f &
-   Open=libreoffice %f &
-   View=%view{ascii} catdoc %f
+Include/msoffice-doc
+Edit=libreoffice %f &
+Open=libreoffice %f &
+View=%view{ascii} catdoc %f
 
-include/msoffice-xlsx
-   Edit=libreoffice %f &
-   Open=libreoffice %f &
-   View=%view{ascii} xlsx2csv %f | iconv.py -f utf-8
+Include/msoffice-xlsx
+Edit=libreoffice %f &
+Open=libreoffice %f &
+View=%view{ascii} xlsx2csv %f | iconv.py -f utf-8
 
-#include/video
-#   Open=mplayer %f &
-#   View=%view{ascii} %f
+#Include/video
+#Open=mplay %f &
+#View=%view{ascii} cat %f
 #
-include/xml
-   Open=%cd %p/xml://
+Include/xml
+Open=%cd %p/xml://
+
+Include/zip
+Open=%cd %p/uzip://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip
 
 ### /phd
 
@@ -230,240 +239,240 @@ include/xml
 
 ### GIT Repo ###
 # gitfs changeset
-regex/^\[git\]
-       Open=%cd %p/changesetfs://
-       View=%cd %p/patchsetfs://
+Regex/^\[git\]
+Open=%cd %p/changesetfs://
+View=%cd %p/patchsetfs://
 
 ### Archives ###
 
 # .tgz, .tpz, .tar.gz, .tar.z, .tar.Z, .ipk, .gem
-regex/\.t([gp]?z|ar\.g?[zZ])$|\.ipk$|\.gem$
-       Open=%cd %p/utar://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.gz
+Regex/\.t([gp]?z|ar\.g?[zZ])$|\.ipk$|\.gem$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.gz
 
-shell/.tar.bz
-       # Open=%cd %p/utar://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.bzip
+Shell/.tar.bz
+# Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.bzip
 
-regex/\.t(ar\.bz2|bz2?|b2)$
-       Open=%cd %p/utar://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.bzip2
+Regex/\.t(ar\.bz2|bz2?|b2)$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.bzip2
 
 # .tar.lzma, .tlz
-regex/\.t(ar\.lzma|lz)$
-       Open=%cd %p/utar://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.lzma
+Regex/\.t(ar\.lzma|lz)$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.lzma
 
 # .tar.lz
-shell/.tar.lz
-       Open=%cd %p/utar://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.lz
+Shell/.tar.lz
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.lz
 
 # .tar.lz4, .tlz4
-regex/\.t(ar\.lz4|lz4)$
-       Open=%cd %p/utar://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.lz4
+Regex/\.t(ar\.lz4|lz4)$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.lz4
 
 # .tar.xz, .txz
-regex/\.t(ar\.xz|xz)$
-       Open=%cd %p/utar://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.xz
+Regex/\.t(ar\.xz|xz)$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.xz
 
 # .tar.zst, .tzst
-regex/\.t(ar\.zst|zst)$
-       Open=%cd %p/utar://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.zst
+Regex/\.t(ar\.zst|zst)$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.zst
 
 # .tar.F - used in QNX
-shell/.tar.F
-       # Open=%cd %p/utar://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.F
+Shell/.tar.F
+# Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.F
 
 # .qpr/.qpk - QNX Neutrino package installer files
-regex/\.qp[rk]$
-       Open=%cd %p/utar://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.qpr
+Regex/\.qp[rk]$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.qpr
 
 # tar
-shell/i/.tar
-       Open=%cd %p/utar://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar
+Shell/i/.tar
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar
 
 # lha
-type/^LHa\ .*archive
-       Open=%cd %p/ulha://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lha
+Type/^LHa\ .*archive
+Open=%cd %p/ulha://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lha
 
 # arj
-regex/i/\.a(rj|[0-9][0-9])$
-       Open=%cd %p/uarj://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view arj
+Regex/i/\.a(rj|[0-9][0-9])$
+Open=%cd %p/uarj://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view arj
 
 # cab
-shell/i/.cab
-       Open=%cd %p/ucab://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cab
+Shell/i/.cab
+Open=%cd %p/ucab://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cab
 
 # ha
-shell/i/.ha
-       Open=%cd %p/uha://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view ha
+Shell/i/.ha
+Open=%cd %p/uha://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view ha
 
 # rar
-regex/i/\.r(ar|[0-9][0-9])$
-       Open=%cd %p/urar://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view rar
+Regex/i/\.r(ar|[0-9][0-9])$
+Open=%cd %p/urar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view rar
 
 # ALZip
-shell/i/.alz
-       Open=%cd %p/ualz://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view alz
+Shell/i/.alz
+Open=%cd %p/ualz://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view alz
 
 # cpio
-shell/.cpio.Z
-       Open=%cd %p/ucpio://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.z
+Shell/.cpio.Z
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.z
 
-shell/.cpio.lz
-       Open=%cd %p/ucpio://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.lz
+Shell/.cpio.lz
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.lz
 
-shell/.cpio.lz4
-       Open=%cd %p/ucpio://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.lz4
+Shell/.cpio.lz4
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.lz4
 
-shell/.cpio.xz
-       Open=%cd %p/ucpio://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.xz
+Shell/.cpio.xz
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.xz
 
-shell/.cpio.zst
-       Open=%cd %p/ucpio://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.zst
+Shell/.cpio.zst
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.zst
 
-shell/.cpio.gz
-       Open=%cd %p/ucpio://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.gz
+Shell/.cpio.gz
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.gz
 
-shell/i/.cpio
-       Open=%cd %p/ucpio://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio
+Shell/i/.cpio
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio
 
 # initrd
-regex/^(initramfs.*\.img|initrd(-.+)?\.img(-.+)?)$
-       Open=%cd %p/ucpio://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio
+Regex/^(initramfs.*\.img|initrd(-.+)?\.img(-.+)?)$
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio
 
 # 7zip archives (they are not man pages)
-shell/i/.7z
-       Open=%cd %p/u7z://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view 7z
+Shell/i/.7z
+Open=%cd %p/u7z://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view 7z
 
 # patch
-regex/\.(diff|patch)(\.bz2)$
-       Open=%cd %p/patchfs://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view bz2
+Regex/\.(diff|patch)(\.bz2)$
+Open=%cd %p/patchfs://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view bz2
 
-regex/\.(diff|patch)(\.(gz|Z))$
-       Open=%cd %p/patchfs://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view gz
+Regex/\.(diff|patch)(\.(gz|Z))$
+Open=%cd %p/patchfs://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view gz
 
-regex/\.(diff|patch)(\.xz)$
-    Open=%cd %p/patchfs://
-    View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view xz
+Regex/\.(diff|patch)(\.xz)$
+Open=%cd %p/patchfs://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view xz
 
-regex/\.(diff|patch)(\.zst)$
-    Open=%cd %p/patchfs://
-    View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zst
+Regex/\.(diff|patch)(\.zst)$
+Open=%cd %p/patchfs://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zst
 
 # ls-lR
-regex/(^|\.)ls-?lR(\.gz|Z|bz2)$
-       Open=%cd %p/lslR://
+Regex/(^|\.)ls-?lR(\.gz|Z|bz2)$
+Open=%cd %p/lslR://
 
 # trpm
-shell/.trpm
-       Open=%cd %p/trpm://
-       View=%view{ascii} /usr/lib/mc/ext.d/package.sh view trpm
+Shell/.trpm
+Open=%cd %p/trpm://
+View=%view{ascii} /usr/lib/mc/ext.d/package.sh view trpm
 
 # RPM packages (SuSE uses *.spm for source packages)
-regex/\.(src\.rpm|spm)$
-       Open=%cd %p/rpm://
-       View=%view{ascii} /usr/lib/mc/ext.d/package.sh view src.rpm
+Regex/\.(src\.rpm|spm)$
+Open=%cd %p/rpm://
+View=%view{ascii} /usr/lib/mc/ext.d/package.sh view src.rpm
 
-shell/.rpm
-       Open=%cd %p/rpm://
-       View=%view{ascii} /usr/lib/mc/ext.d/package.sh view rpm
+Shell/.rpm
+Open=%cd %p/rpm://
+View=%view{ascii} /usr/lib/mc/ext.d/package.sh view rpm
 
 # deb
-regex/\.u?deb$
-       Open=%cd %p/deb://
-       View=%view{ascii} /usr/lib/mc/ext.d/package.sh view deb
+Regex/\.u?deb$
+Open=%cd %p/deb://
+View=%view{ascii} /usr/lib/mc/ext.d/package.sh view deb
 
 # dpkg
-shell/.debd
-        Open=%cd %p/debd://
-       View=%view{ascii} /usr/lib/mc/ext.d/package.sh view debd
+Shell/.debd
+Open=%cd %p/debd://
+View=%view{ascii} /usr/lib/mc/ext.d/package.sh view debd
 
 # apt
-shell/.deba
-        Open=%cd %p/deba://
-       View=%view{ascii} /usr/lib/mc/ext.d/package.sh view deba
+Shell/.deba
+Open=%cd %p/deba://
+View=%view{ascii} /usr/lib/mc/ext.d/package.sh view deba
 
 # ISO9660
-shell/i/.iso
-       Open=%cd %p/iso9660://
-       View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view iso9660
+Shell/i/.iso
+Open=%cd %p/iso9660://
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view iso9660
 
 
-regex/\.(diff|patch)$
-       Open=%cd %p/patchfs://
-       View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view cat
+Regex/\.(diff|patch)$
+Open=%cd %p/patchfs://
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view cat
 
 # ar library
-regex/\.s?a$
-       Open=%cd %p/uar://
-       #Open=%view{ascii} ar tv %f
-       View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view ar
+Regex/\.s?a$
+Open=%cd %p/uar://
+#Open=%view{ascii} ar tv %f
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view ar
 
 # gplib
-shell/i/.lib
-       Open=%cd %p/ulib://
-       View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view lib
+Shell/i/.lib
+Open=%cd %p/ulib://
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view lib
 
 
 # Mailboxes
-type/^ASCII\ mail\ text
-       Open=%cd %p/mailfs://
+Type/^ASCII\ mail\ text
+Open=%cd %p/mailfs://
 
 
 ### Sources ###
 
 # C/C++
-regex/i/\.(c|cc|cpp)$
-       Include=editor
+Regex/i/\.(c|cc|cpp)$
+Include=editor
 
 # C/C++ header
-regex/i/\.(h|hh|hpp)$
-       Include=editor
+Regex/i/\.(h|hh|hpp)$
+Include=editor
 
 # Fortran
-shell/i/.f
-       Include=editor
+Shell/i/.f
+Include=editor
 
 # Assembler
-regex/i/\.(s|asm)$
-       Include=editor
+Regex/i/\.(s|asm)$
+Include=editor
 
-include/editor
-       Open=%var{EDITOR:editor} %f
+Include/editor
+Open=%var{EDITOR:editor} %f
 
 # .so libraries
-regex/\.(so|so\.[0-9\.]*)$
-       View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view so
+Regex/\.(so|so\.[0-9\.]*)$
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view so
 
 # Object
-type/^ELF
-       #Open=%var{PAGER:more} %f
-       View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view elf
+Type/^ELF
+#Open=%var{PAGER:more} %f
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view elf
 
 ### Documentation ###
 
@@ -471,479 +480,479 @@ type/^ELF
 #regex/\.(te?xi|texinfo)$
 
 # GNU Info page
-type/^Info\ text
-       Open=/usr/lib/mc/ext.d/text.sh open info
+Type/^Info\ text
+Open=/usr/lib/mc/ext.d/text.sh open info
 
-shell/.info
-       Open=/usr/lib/mc/ext.d/text.sh open info
+Shell/.info
+Open=/usr/lib/mc/ext.d/text.sh open info
 
 # Exception: .3gp are video files not manual pages
-shell/i/.3gp
-       Include=video
+Shell/i/.3gp
+Include=video
 
 # Manual page
-regex/(([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])|\.man)$
-       Open=/usr/lib/mc/ext.d/text.sh open man %var{PAGER:more}
-       View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man %var{PAGER:more}
+Regex/(([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])|\.man)$
+Open=/usr/lib/mc/ext.d/text.sh open man %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man %var{PAGER:more}
 
 # Perl pod page
-shell/.pod
-       Open=/usr/lib/mc/ext.d/text.sh open pod %var{PAGER:more}
-       View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view pod %var{PAGER:more}
+Shell/.pod
+Open=/usr/lib/mc/ext.d/text.sh open pod %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view pod %var{PAGER:more}
 
 # Troff with me macros.
 # Exception - "read.me" is not a nroff file.
-shell/read.me
-       Open=
-       View=
+Shell/read.me
+Open=
+View=
 
-shell/.me
-       Open=/usr/lib/mc/ext.d/text.sh open nroff.me %var{PAGER:more}
-       View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view nroff.me %var{PAGER:more}
+Shell/.me
+Open=/usr/lib/mc/ext.d/text.sh open nroff.me %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view nroff.me %var{PAGER:more}
 
 # Troff with ms macros.
-shell/.ms
-       Open=/usr/lib/mc/ext.d/text.sh open nroff.ms %var{PAGER:more}
-       View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view nroff.ms %var{PAGER:more}
+Shell/.ms
+Open=/usr/lib/mc/ext.d/text.sh open nroff.ms %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view nroff.ms %var{PAGER:more}
 
 # Manual page - compressed
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.g?[Zz]$
-       Open=/usr/lib/mc/ext.d/text.sh open man.gz %var{PAGER:more}
-       View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.gz %var{PAGER:more}
+Regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.g?[Zz]$
+Open=/usr/lib/mc/ext.d/text.sh open man.gz %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.gz %var{PAGER:more}
 
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz$
-       Open=/usr/lib/mc/ext.d/text.sh open man.bz %var{PAGER:more}
-       View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.bz %var{PAGER:more}
+Regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz$
+Open=/usr/lib/mc/ext.d/text.sh open man.bz %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.bz %var{PAGER:more}
 
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz2$
-       Open=/usr/lib/mc/ext.d/text.sh open man.bz2 %var{PAGER:more}
-       View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.bz2 %var{PAGER:more}
+Regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz2$
+Open=/usr/lib/mc/ext.d/text.sh open man.bz2 %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.bz2 %var{PAGER:more}
 
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lz$
-       Open=/usr/lib/mc/ext.d/text.sh open man.lz %var{PAGER:more}
-       View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.lz %var{PAGER:more}
+Regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lz$
+Open=/usr/lib/mc/ext.d/text.sh open man.lz %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.lz %var{PAGER:more}
 
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lz4$
-       Open=/usr/lib/mc/ext.d/text.sh open man.lz4 %var{PAGER:more}
-       View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.lz4 %var{PAGER:more}
+Regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lz4$
+Open=/usr/lib/mc/ext.d/text.sh open man.lz4 %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.lz4 %var{PAGER:more}
 
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lzma$
-       Open=/usr/lib/mc/ext.d/text.sh open man.lzma %var{PAGER:more}
-       View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.lzma %var{PAGER:more}
+Regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lzma$
+Open=/usr/lib/mc/ext.d/text.sh open man.lzma %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.lzma %var{PAGER:more}
 
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.xz$
-       Open=/usr/lib/mc/ext.d/text.sh open man.xz %var{PAGER:more}
-       View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.xz %var{PAGER:more}
+Regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.xz$
+Open=/usr/lib/mc/ext.d/text.sh open man.xz %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.xz %var{PAGER:more}
 
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.zst$
-       Open=/usr/lib/mc/ext.d/text.sh open man.zst %var{PAGER:more}
-       View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.zst %var{PAGER:more}
+Regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.zst$
+Open=/usr/lib/mc/ext.d/text.sh open man.zst %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.zst %var{PAGER:more}
 
 # CHM
-shell/i/.chm
-       Open=/usr/lib/mc/ext.d/text.sh open chm
+Shell/i/.chm
+Open=/usr/lib/mc/ext.d/text.sh open chm
 
 ### Images ###
 
-type/^GIF
-       Include=image
+Type/^GIF
+Include=image
 
-type/^JPEG
-       View=%view{ascii} /usr/lib/mc/ext.d/image.sh view jpeg
-       Include=image
+Type/^JPEG
+View=%view{ascii} /usr/lib/mc/ext.d/image.sh view jpeg
+Include=image
 
-type/^PC\ bitmap
-       Include=image
+Type/^PC\ bitmap
+Include=image
 
-type/^PNG
-       Include=image
+Type/^PNG
+Include=image
 
-type/^JNG
-       Include=image
+Type/^JNG
+Include=image
 
-type/^MNG
-       Include=image
+Type/^MNG
+Include=image
 
-type/^TIFF
-       Include=image
+Type/^TIFF
+Include=image
 
-type/^PBM
-       Include=image
+Type/^PBM
+Include=image
 
-type/^PGM
-       Include=image
+Type/^PGM
+Include=image
 
-type/^PPM
-       Include=image
+Type/^PPM
+Include=image
 
-type/^Netpbm
-       Include=image
+Type/^Netpbm
+Include=image
 
-shell/.xcf
-       Open=/usr/lib/mc/ext.d/image.sh open xcf
+Shell/.xcf
+Open=/usr/lib/mc/ext.d/image.sh open xcf
 
-shell/.xbm
-       Open=/usr/lib/mc/ext.d/image.sh open xbm
+Shell/.xbm
+Open=/usr/lib/mc/ext.d/image.sh open xbm
 
-shell/.xpm
-       Include=image
-       View=/usr/lib/mc/ext.d/image.sh view xpm %f
+Shell/.xpm
+Include=image
+View=/usr/lib/mc/ext.d/image.sh view xpm %f
 
-shell/.ico
-       Include=image
+Shell/.ico
+Include=image
 
-shell/i/.svg
-       View=%view{ascii} /usr/lib/mc/ext.d/image.sh view svg
-       Open=/usr/lib/mc/ext.d/image.sh open svg
+Shell/i/.svg
+View=%view{ascii} /usr/lib/mc/ext.d/image.sh view svg
+Open=/usr/lib/mc/ext.d/image.sh open svg
 
-include/image
-       Open=/usr/lib/mc/ext.d/image.sh open ALL_FORMATS
-       View=%view{ascii} /usr/lib/mc/ext.d/image.sh view ALL_FORMATS
+Include/image
+Open=/usr/lib/mc/ext.d/image.sh open ALL_FORMATS
+View=%view{ascii} /usr/lib/mc/ext.d/image.sh view ALL_FORMATS
 
 
 ### Sound files ###
 
-regex/i/\.(wav|snd|voc|au|smp|aiff|snd|m4a|ape|aac|wv)$
-       Open=/usr/lib/mc/ext.d/sound.sh open common
+Regex/i/\.(wav|snd|voc|au|smp|aiff|snd|m4a|ape|aac|wv)$
+Open=/usr/lib/mc/ext.d/sound.sh open common
 
-regex/i/\.(mod|s3m|xm|it|mtm|669|stm|ult|far)$
-       Open=/usr/lib/mc/ext.d/sound.sh open mod
+Regex/i/\.(mod|s3m|xm|it|mtm|669|stm|ult|far)$
+Open=/usr/lib/mc/ext.d/sound.sh open mod
 
-shell/i/.waw22
-       Open=/usr/lib/mc/ext.d/sound.sh open wav22
+Shell/i/.waw22
+Open=/usr/lib/mc/ext.d/sound.sh open wav22
 
-shell/i/.mp3
-       Open=/usr/lib/mc/ext.d/sound.sh open mp3
-       View=%view{ascii} /usr/lib/mc/ext.d/sound.sh view mp3
+Shell/i/.mp3
+Open=/usr/lib/mc/ext.d/sound.sh open mp3
+View=%view{ascii} /usr/lib/mc/ext.d/sound.sh view mp3
 
-regex/i/\.og[gax]$
-       Open=/usr/lib/mc/ext.d/sound.sh open ogg
-       View=%view{ascii} /usr/lib/mc/ext.d/sound.sh view ogg
+Regex/i/\.og[gax]$
+Open=/usr/lib/mc/ext.d/sound.sh open ogg
+View=%view{ascii} /usr/lib/mc/ext.d/sound.sh view ogg
 
-regex/i/\.(spx|flac)$
-       Open=/usr/lib/mc/ext.d/sound.sh open common
+Regex/i/\.(spx|flac)$
+Open=/usr/lib/mc/ext.d/sound.sh open common
 
-regex/i/\.(midi?|rmid?)$
-       Open=/usr/lib/mc/ext.d/sound.sh open midi
+Regex/i/\.(midi?|rmid?)$
+Open=/usr/lib/mc/ext.d/sound.sh open midi
 
-shell/i/.wma
-       Open=/usr/lib/mc/ext.d/sound.sh open wma
-       View=%view{ascii} /usr/lib/mc/ext.d/sound.sh view wma
+Shell/i/.wma
+Open=/usr/lib/mc/ext.d/sound.sh open wma
+View=%view{ascii} /usr/lib/mc/ext.d/sound.sh view wma
 
 
 ### Play lists ###
 
-regex/i/\.(m3u|pls)$
-       Open=/usr/lib/mc/ext.d/sound.sh open playlist
+Regex/i/\.(m3u8?|pls)$
+Open=/usr/lib/mc/ext.d/sound.sh open playlist
 
 
 ### Video ###
 
-shell/i/.avi
-       Include=video
+Shell/i/.avi
+Include=video
 
-regex/i/\.as[fx]$
-       Include=video
+Regex/i/\.as[fx]$
+Include=video
 
-shell/i/.divx
-       Include=video
+Shell/i/.divx
+Include=video
 
-shell/i/.mkv
-       Include=video
+Shell/i/.mkv
+Include=video
 
-regex/i/\.(mov|qt)$
-       Include=video
+Regex/i/\.(mov|qt)$
+Include=video
 
-regex/i/\.(mp4|m4v|mpe?g)$
-       Include=video
+Regex/i/\.(mp4|m4v|mpe?g)$
+Include=video
 
 # MPEG-2 TS container + H.264 codec
-shell/i/.mts
-       Include=video
+Shell/i/.mts
+Include=video
 
-shell/i/.ts
-       Include=video
+Shell/i/.ts
+Include=video
 
-shell/i/.vob
-       Include=video
+Shell/i/.vob
+Include=video
 
-shell/i/.wmv
-       Include=video
+Shell/i/.wmv
+Include=video
 
-regex/i/\.fl[icv]$
-       Include=video
+Regex/i/\.fl[icv]$
+Include=video
 
-shell/i/.ogv
-       Include=video
+Shell/i/.ogv
+Include=video
 
-regex/i/\.ra?m$
-       Open=/usr/lib/mc/ext.d/video.sh open ram
+Regex/i/\.ra?m$
+Open=/usr/lib/mc/ext.d/video.sh open ram
 
 # WebM
-shell/i/.webm
-    Include=video
+Shell/i/.webm
+Include=video
 
-type/WebM
-    Include=video
+Type/WebM
+Include=video
 
-include/video
-       Open=/usr/lib/mc/ext.d/video.sh open ALL_FORMATS
-       View=%view{ascii} /usr/lib/mc/ext.d/video.sh view ALL_FORMATS
+Include/video
+Open=/usr/lib/mc/ext.d/video.sh open ALL_FORMATS
+View=%view{ascii} /usr/lib/mc/ext.d/video.sh view ALL_FORMATS
 
 
 ### Documents ###
 
 # Postscript
-type/^PostScript
-       Open=/usr/lib/mc/ext.d/doc.sh open ps
-       View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view ps
+Type/^PostScript
+Open=/usr/lib/mc/ext.d/doc.sh open ps
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view ps
 
 # PDF
-type/^PDF
-       Open=/usr/lib/mc/ext.d/doc.sh open pdf
-       View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view pdf
+Type/^PDF
+Open=/usr/lib/mc/ext.d/doc.sh open pdf
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view pdf
 
 # html
-regex/i/\.html?$
-       Open=/usr/lib/mc/ext.d/web.sh open html
-       View=%view{ascii} /usr/lib/mc/ext.d/web.sh view html
+Regex/i/\.html?$
+Open=/usr/lib/mc/ext.d/web.sh open html
+View=%view{ascii} /usr/lib/mc/ext.d/web.sh view html
 
 # StarOffice 5.2
-shell/.sdw
-       Open=/usr/lib/mc/ext.d/doc.sh open ooffice
+Shell/.sdw
+Open=/usr/lib/mc/ext.d/doc.sh open ooffice
 
 # StarOffice 6 and OpenOffice.org formats
-regex/i/\.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg)$
-       Open=/usr/lib/mc/ext.d/doc.sh open ooffice
-       View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view odt
+Regex/i/\.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg)$
+Open=/usr/lib/mc/ext.d/doc.sh open ooffice
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view odt
 
 # AbiWord
-shell/.abw
-       Open=/usr/lib/mc/ext.d/doc.sh open abw
+Shell/.abw
+Open=/usr/lib/mc/ext.d/doc.sh open abw
 
 # Gnumeric
-shell/i/.gnumeric
-       Open=/usr/lib/mc/ext.d/doc.sh open gnumeric
+Shell/i/.gnumeric
+Open=/usr/lib/mc/ext.d/doc.sh open gnumeric
 
 # Microsoft Word Document
-regex/i/\.(do[ct]|wri|docx)$
-       Open=/usr/lib/mc/ext.d/doc.sh open msdoc
-       View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msdoc
-type/^Microsoft\ Word
-       Open=/usr/lib/mc/ext.d/doc.sh open msdoc
-       View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msdoc
+Regex/i/\.(do[ct]|wri|docx)$
+Open=/usr/lib/mc/ext.d/doc.sh open msdoc
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msdoc
+Type/^Microsoft\ Word
+Open=/usr/lib/mc/ext.d/doc.sh open msdoc
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msdoc
 
 # RTF document
-shell/i/.rtf
-       Open=/usr/lib/mc/ext.d/doc.sh open msdoc
+Shell/i/.rtf
+Open=/usr/lib/mc/ext.d/doc.sh open msdoc
 
 # Microsoft Excel Worksheet
-regex/i/\.(xl[sw]|xlsx)$
-       Open=/usr/lib/mc/ext.d/doc.sh open msxls
-       View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msxls
-type/^Microsoft\ Excel
-       Open=/usr/lib/mc/ext.d/doc.sh open msxls
-       View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msxls
+Regex/i/\.(xl[sw]|xlsx)$
+Open=/usr/lib/mc/ext.d/doc.sh open msxls
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msxls
+Type/^Microsoft\ Excel
+Open=/usr/lib/mc/ext.d/doc.sh open msxls
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msxls
 
 # Microsoft PowerPoint Presentation
-regex/i/\.(pp[ts]|pptx)$
-       Open=/usr/lib/mc/ext.d/doc.sh open msppt
-       View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msppt
+Regex/i/\.(pp[ts]|pptx)$
+Open=/usr/lib/mc/ext.d/doc.sh open msppt
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msppt
 
 # Use OpenOffice.org/LibreOffice to open any MS Office documents
-type/^Microsoft\ Office\ Document
-       Open=/usr/lib/mc/ext.d/doc.sh open ooffice
-type/^Microsoft\ OOXML
-       Open=/usr/lib/mc/ext.d/doc.sh open ooffice
+Type/^Microsoft\ Office\ Document
+Open=/usr/lib/mc/ext.d/doc.sh open ooffice
+Type/^Microsoft\ OOXML
+Open=/usr/lib/mc/ext.d/doc.sh open ooffice
 
 # Framemaker
-type/^FrameMaker
-       Open=/usr/lib/mc/ext.d/doc.sh open framemaker
+Type/^FrameMaker
+Open=/usr/lib/mc/ext.d/doc.sh open framemaker
 
 # DVI
-shell/i/.dvi
-       Open=/usr/lib/mc/ext.d/doc.sh open dvi
-       View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view dvi
+Shell/i/.dvi
+Open=/usr/lib/mc/ext.d/doc.sh open dvi
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view dvi
 
 # TeX
-shell/i/.tex
-       Include=editor
+Shell/i/.tex
+Include=editor
 
 # DjVu
-regex/i/\.djvu?$
-       Open=/usr/lib/mc/ext.d/doc.sh open djvu
-       View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view djvu
+Regex/i/\.djvu?$
+Open=/usr/lib/mc/ext.d/doc.sh open djvu
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view djvu
 
 # Comic Books
-regex/i/\.cb[zr]$
-       Open=/usr/lib/mc/ext.d/doc.sh open comic
+Regex/i/\.cb[zr]$
+Open=/usr/lib/mc/ext.d/doc.sh open comic
 
 # Epub & mobi
-regex/i/\.(epub|mobi)$
-       Open=/usr/lib/mc/ext.d/doc.sh open epub
-       View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view epub
+Regex/i/\.(epub|mobi)$
+Open=/usr/lib/mc/ext.d/doc.sh open epub
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view epub
 
 
 ### Miscellaneous ###
 
 # Compiled Java classes
-shell/.class
-       View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view javaclass
+Shell/.class
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view javaclass
 
 # Makefile
-regex/^[Mm]akefile$
-       Open=make -f %f %{Enter parameters}
+Regex/^[Mm]akefile$
+Open=make -f %f %{Enter parameters}
 
 # Imakefile
-shell/Imakefile
-       Open=xmkmf -a
+Shell/Imakefile
+Open=xmkmf -a
 
 # Makefile.PL (MakeMaker)
-regex/^Makefile\.(PL|pl)$
-       Open=%var{PERL:perl} %f
+Regex/^Makefile\.(PL|pl)$
+Open=%var{PERL:perl} %f
 
 # sqlite3.db
-type/^SQLite 3.x database
-       Open=/usr/lib/mc/ext.d/misc.sh open sqlite
-       View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view sqlite
+Type/^SQLite\ 3.x\ database
+Open=/usr/lib/mc/ext.d/misc.sh open sqlite
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view sqlite
 
 # dbf
-shell/i/.dbf
-       Open=/usr/lib/mc/ext.d/misc.sh open dbf
-       View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view dbf
+Shell/i/.dbf
+Open=/usr/lib/mc/ext.d/misc.sh open dbf
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view dbf
 
 # REXX script
-regex/\.(rexx?|cmd)$
-       Open=rexx %f %{Enter parameters};echo "Press ENTER";read y
+Regex/\.(rexx?|cmd)$
+Open=rexx %f %{Enter parameters};echo "Press ENTER";read y
 
 # Disk images for Commodore computers (VIC20, C64, C128)
-shell/i/.d64
-       Open=%cd %p/uc1541://
-       View=%view{ascii} c1541 %f -list
-       Extract=c1541 %f -extract
+Shell/i/.d64
+Open=%cd %p/uc1541://
+View=%view{ascii} c1541 %f -list
+Extract=c1541 %f -extract
 
 # Glade, a user interface designer for GTK+ and GNOME
-shell/i/.glade
-       Open=/usr/lib/mc/ext.d/misc.sh open glade
+Shell/i/.glade
+Open=/usr/lib/mc/ext.d/misc.sh open glade
 
 # Gettext Catalogs
-regex/\.g?mo$
-       View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view mo
+Regex/\.g?mo$
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view mo
 
 # po
-shell/.po
-       Open=/usr/lib/mc/ext.d/misc.sh open po
+Shell/.po
+Open=/usr/lib/mc/ext.d/misc.sh open po
 
 # lyx
-shell/i/.lyx
-       Open=/usr/lib/mc/ext.d/misc.sh open lyx
-       View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view lyx
+Shell/i/.lyx
+Open=/usr/lib/mc/ext.d/misc.sh open lyx
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view lyx
 
 # torrent
-shell/i/.torrent
-       View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view torrent
+Shell/i/.torrent
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view torrent
 
 ### Plain compressed files ###
 
 # ace
-shell/i/.ace
-       Open=%cd %p/uace://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view ace
-       Extract=unace x %f
+Shell/i/.ace
+Open=%cd %p/uace://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view ace
+Extract=unace x %f
 
 # arc
-shell/i/.arc
-       Open=%cd %p/uarc://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view arc
-       Extract=arc x %f '*'
-       Extract (with flags)=I=%{Enter any Arc flags:}; if test -n "$I"; then arc x $I %f; fi
+Shell/i/.arc
+Open=%cd %p/uarc://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view arc
+Extract=arc x %f '*'
+Extract (with flags)=I=%{Enter any Arc flags:}; if test -n "$I"; then arc x $I %f; fi
 
 # zip
-shell/i/.zip
-       Open=%cd %p/uzip://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip
+Shell/i/.zip
+Open=%cd %p/uzip://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip
 
 # zip
-type/i/^zip\ archive
-       Open=%cd %p/uzip://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip
+Type/i/^zip\ archive
+Open=%cd %p/uzip://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip
 
 # jar(zip)
-type/i/^Java\ (Jar\ file|archive)\ data\ \((zip|JAR)\)
-       Open=%cd %p/uzip://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip
+Type/i/^Java\ (Jar\ file|archive)\ data\ \((zip|JAR)\)
+Open=%cd %p/uzip://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip
 
 # zoo
-shell/i/.zoo
-       Open=%cd %p/uzoo://
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zoo
+Shell/i/.zoo
+Open=%cd %p/uzoo://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zoo
 
 # gzip
-type/^gzip
-       Open=/usr/lib/mc/ext.d/archive.sh view gz %var{PAGER:more}
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view gz
+Type/^gzip
+Open=/usr/lib/mc/ext.d/archive.sh view gz %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view gz
 
-regex/\.(gz|Z)$
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view gz
+Regex/\.(gz|Z)$
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view gz
 
 # bzip2
-type/^bzip2
-       Open=/usr/lib/mc/ext.d/archive.sh view bzip2 %var{PAGER:more}
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view bz2
+Type/^bzip2
+Open=/usr/lib/mc/ext.d/archive.sh view bzip2 %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view bz2
 
-regex/\.bz2?$
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view bz2
+Regex/\.bz2?$
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view bz2
 
 # bzip
-type/^bzip
-       Open=/usr/lib/mc/ext.d/archive.sh view bzip %var{PAGER:more}
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view bzip
+Type/^bzip
+Open=/usr/lib/mc/ext.d/archive.sh view bzip %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view bzip
 
 # compress
-type/^compress
-       Open=/usr/lib/mc/ext.d/archive.sh view gz %var{PAGER:more}
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view gz
+Type/^compress
+Open=/usr/lib/mc/ext.d/archive.sh view gz %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view gz
 
 # lz
-regex/\.lz$
-       Open=/usr/lib/mc/ext.d/archive.sh view lz %var{PAGER:more}
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lz
+Regex/\.lz$
+Open=/usr/lib/mc/ext.d/archive.sh view lz %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lz
 
 # lz
-type/^LZIP
-       Open=/usr/lib/mc/ext.d/archive.sh view lz %var{PAGER:more}
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lz
+Type/^LZIP
+Open=/usr/lib/mc/ext.d/archive.sh view lz %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lz
 
 # lz4
-regex/\.lz4$
-       Open=/usr/lib/mc/ext.d/archive.sh view lz4 %var{PAGER:more}
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lz4
+Regex/\.lz4$
+Open=/usr/lib/mc/ext.d/archive.sh view lz4 %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lz4
 
 # lzma
-regex/\.lzma$
-       Open=/usr/lib/mc/ext.d/archive.sh view lzma %var{PAGER:more}
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lzma
+Regex/\.lzma$
+Open=/usr/lib/mc/ext.d/archive.sh view lzma %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lzma
 
 # xz
-regex/\.xz$
-       Open=/usr/lib/mc/ext.d/archive.sh view xz %var{PAGER:more}
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view xz
+Regex/\.xz$
+Open=/usr/lib/mc/ext.d/archive.sh view xz %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view xz
 
 # zstd
-regex/\.zst$
-       Open=/usr/lib/mc/ext.d/archive.sh view zst %var{PAGER:more}
-       View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zst
+Regex/\.zst$
+Open=/usr/lib/mc/ext.d/archive.sh view zst %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zst
 
 # Parity Archive
-type/^Parity\ Archive\ Volume\ Set
-       Open=/usr/lib/mc/ext.d/archive.sh open par2
+Type/^Parity\ Archive\ Volume\ Set
+Open=/usr/lib/mc/ext.d/archive.sh open par2
 
 ### Default ###
 
 # Default target for anything not described above
-default/*
-       Open=
-       View=
+Default/*
+Open=
+View=
 
 
 ### EOF ###
diff --git a/.mc/mc.ext.ini b/.mc/mc.ext.ini
new file mode 100644 (file)
index 0000000..51475db
--- /dev/null
@@ -0,0 +1,1266 @@
+# Midnight Commander 4.0 extension file
+#
+# Warning: The structure of this file has been completely changed with the version 4.0!
+#
+# All lines starting with # or empty lines are ignoted.
+#
+# IMPORTANT: mc scans this file only upon first use or after editing it using the
+# mc "Edit extension file" command (F9-c-e). If you edit this file in any other way
+# while mc is running, you will need to press F9-c-e and exit the editor for your
+# changes to take effect, or exit mc and start it again.
+#
+# Section name can be anything with following exceptions:
+#    there are two reserved section names:
+#        mc.ext.ini
+#        Default
+#    special name pattern:
+#        Include/xxxxx
+# See below for more details.
+#
+# Section [mc.ext.ini] is mandatory. It contains file metadata.
+# "Version" parameter is mandatory. It contains the file format version.
+#
+# Section [Default] is optional. It is applied only if no other match was found.
+#
+# Sections like [Include/xxxx] can be referenced as "Include=xxxx" from other sections.
+# Section [Include/xxxx] can be located as before as after sections that point to it.
+#
+# Sections are processed from top to bottom, thus the order is important.
+# If there are more than one sections with the same name in this file, the first
+# section will be used.
+#
+# [Default] should be a catch-all action and come last.
+#
+# A section describing a file can contain following keys:
+#
+#    File descriptions:
+#
+#        Directory
+#            Matches any directory matching regular expression.
+#            Always case sensitive.
+#            This key has the highest priority over other keys. If this key is in a section,
+#            other keys are ignored.
+#
+#        Type
+#            Matches files if `file %f` matches regular expression
+#            (the "filename:" part is removed from `file %f` output).
+#            Ignored if the "file" utility isn't used (not found during the configure step
+#            or disabled in the ini-file).
+#
+#        TypeIgnoreCase [true|false]
+#            Defines whether the Type value is case sensitive or not.
+#            If absent, Type is case sensitive.
+#
+#        Regex
+#            An extended regular expression
+#            Please note that we are using the PCRE library and thus \| matches
+#            the literal | and | has a special meaning (or), and () have a special meaning
+#            and \( \) stand for literal ( ).
+#
+#            Example:
+#                Regex=\.t(ar\.lzma|lz)$
+#            matches *.tar.lzma or *.tlz.
+#
+#        RegexIgnoreCase [true|false]
+#            Defines whether the Regex value is case sensitive or not.
+#            If absent, Regex is case sensitive.
+#
+#        Shell
+#            Describes an extension when starting with a dot (no wildcards).
+#
+#            Example:
+#                Shell=.tar
+#            matches *.tar.
+#
+#            If it doesn't start with a dot, it matches only a file of that name.
+#
+#            If both keys Regex and Shell are in the same section, Regex is used
+#            and Shell is ignored.
+#
+#        ShellIgnoreCase [true|false]
+#            Defines whether the Shell value is case sensitive or not.
+#            If absent, Shell is case sensitive.
+#
+#        Include
+#            Reference to another section.
+#
+#            Example:
+#                Include=video
+#            points to the [Include/video] section.
+#
+#    Commands:
+#
+#        Open
+#            Execute the command if the user presses Enter or doubleclicks it.
+#
+#        View
+#            Execute the command if the user presses F3.
+#
+#        Edit
+#            Execute the command if the user presses F4.
+#
+#    All commands are ignored if the section contains the Include key.
+#
+#    Command is any one-line shell command, with the following substitutions:
+#
+#        %%
+#            The % character
+#
+#        %p
+#            Name of the current file without the path.
+#            Also provided to the external application as MC_EXT_BASENAME environment variable.
+#
+#        %f
+#            Name of the current file. Unlike %p, if the file is located on a non-local
+#            virtual filesystem, that is either tarfs or ftpfs, then the file will be
+#            temporarily copied into a local directory and %f will be the full path
+#            to this local temporary file.
+#            If you don't want to get a local copy and want to get the virtual fs path
+#            (like /ftp://ftp.cvut.cz/pub/hungry/xword), then use %d/%p instead of %f.
+#            Also provided to the external application as MC_EXT_FILENAME environment variable.
+#
+#        %d
+#            Name of the current directory without the trailing slash (`pwd`).
+#            Also provided to the external application as MC_EXT_CURRENTDIR environment variable.
+#
+#        %s
+#            "Selected files", that is space separated list of tagged files if any or the name
+#            of the current file.
+#            Also provided to the external application as MC_EXT_SELECTED environment variable.
+#
+#        %t
+#            List of the tagged files.
+#            Also provided to the external application as MC_EXT_ONLYTAGGED environment variable.
+#
+#        %u
+#            List of the tagged files (they will be untaged after the command is executed).
+#
+#        (If the letter following the % is uppercase, then it refers to the opposite panel.
+#        But you shouldn't have to use it in this file.)
+#
+#        %cd
+#            The rest is a path mc should change into (cd won't work, since it's a child process).
+#            %cd handles even vfs names.
+#
+#        %view
+#            The command output will be piped into mc's internal file viewer. If you use
+#            only %view and no command, the viewer will load %f file instead (that is no piping,
+#            which is the difference to %view cat %f).
+#
+#            %view may be directly followed by {} with one or more of the following
+#            separated by commas:
+#                ascii (ascii mode)
+#                hex (hex mode),
+#                nroff (color highlighting for text using escape sequences),
+#                unform (no highlighting for nroff sequences)
+#
+#        %var{VAR:default}
+#            This macro will expand to the value of the VAR variable in the environment if it's
+#            set, otherwise the default value will be used. This is similar to the Bourne shell
+#            ${VAR-default} construct.
+#
+#    Section can contain both Type and Regex or Type and Shell keys. In this case
+#    they are handled as an AND condition.
+#
+#    Example:
+#        Shell=.3gp
+#        Type=^ISO Media.*3GPP
+#
+#    matches *.3gp files for which `file` output is a line starting with "ISO Media"
+#    and containing "3GPP".
+#
+#    If there are more than one keys with the same name in a section, the last key will be used.
+#
+#
+# Any new entries you want to add are always welcome if they are useful on more than one
+# system. You can post your modifications as tickets at www.midnight-commander.org.
+
+
+### Changes ###
+#
+# Reorganization: 2012-03-07 Slava Zanko <slavazanko@gmail.com>
+#                 2021-03-28 Andrew Borodin <aborodin@vmail.ru>
+#                 2021-08-24 Tomas Szepe <szepe@pinerecords.com>
+#                 2022-09-11 Andrew Borodin <aborodin@vmail.ru>: port to INI format.
+
+[mc.ext.ini]
+Version=4.0
+
+### phd
+# For MC version 4
+
+[Berkeley DB 1.85]
+Type=^Berkeley\ DB\ 1.85
+View=%view{ascii} db_dump185 -p %f
+
+# [Compiled HTML]
+#Shell=.chm
+#Open=fbreader %f &
+#
+## [DejaVu]
+#Shell=.djvu
+#Open=djview %f &
+#
+[EPUB]
+Shell=.epub
+Open=fbreader %f &
+
+[FB2]
+Shell=.fb2
+Open=fbreader %f &
+View=%view{ascii} xsltproc /usr/local/src/distr/FictionBook/FB2_2_txt_ru.xsl %f
+
+#[PostScript]
+#Type=^PostScript
+#Open=libreoffice %f &
+#View=%view{ascii} ps2ascii %f
+
+#[RTF]
+#Regex=\.rtf$
+#Open=fbreader %f &
+#View=%view{ascii} catdoc %f
+
+#[doc-wri]
+#Regex=\.(doc|wri)$
+#Include=msoffice-doc
+
+[docs]
+Regex=\.docx$
+Edit=libreoffice %f &
+Open=libreoffice %f &
+View=%view{ascii} docx2txt %f - | iconv.py -f utf-8
+
+#[Composite Document File]
+#Type=^Composite\ Document\ File
+#Include=msoffice-doc
+
+[Microsoft Word 2007]
+Type=^Microsoft\ Word\ 2007+
+Include=msoffice-doc
+
+[Microsoft Office Document]
+Type=^Microsoft\ Office\ Document
+Include=msoffice-doc
+
+[xlsx]
+Regex=\.xlsx$
+Include=msoffice-xlsx
+
+[/^Microsoft Excel 2007+]
+Include=msoffice-xlsx
+
+[ftplist]
+Regex=\.ftplist$
+Open=%cd %p#ftplist
+
+[Play list]
+Regex=\.(m3u8?|pls)$
+Include=audio
+
+[Lossless audio]
+Regex=\.(cue|aac|ac3|ape|flac|wv|mka)$
+Include=audio
+
+## Object
+#Shell=.o
+#View=%view{ascii} nm %f
+#Disassemble=%view{ascii} objdump -d -r %f
+#
+## Python
+#Shell=.py
+#Open=python %f
+#View=%view{ascii} cat %f
+#Compile=compyle %s
+#Icon=snake.xpm
+
+[Conda/python packages]
+Regex=\.(conda|egg|whl)$
+Include=zip
+
+# TIFF
+#Regex=\.tiff?$
+#Open=xview %f
+
+[torrent]
+Shell=.torrent
+Open=%cd %p/torrent://
+
+[xml-ext]
+Regex=\.xml$
+Include=xml
+
+[xml-type]
+Type=^XML\ *(1\.0\ *)?document
+Include=xml
+
+[LRE/Flibusta INPX]
+Regex=\.(inpx)$
+Include=zip
+
+[Include/audio]
+#Open=[ "`audtool --get-volume`" -eq 0 ] && (cgmem_nice 200 audacious & sleep 3); audtool --playlist-clear; case %f in *.m3u8?) while read song; do audtool --playlist-addurl "$song"; done < %f ;; *) audtool --playlist-addurl %f ;; esac; audtool --playback-play
+#Open=mplay %f &
+Open=deadbeef %f &
+View=%view{ascii} cat %f
+
+[Include/msoffice-doc]
+Edit=libreoffice %f &
+Open=libreoffice %f &
+View=%view{ascii} catdoc %f
+
+[Include/msoffice-xlsx]
+Edit=libreoffice %f &
+Open=libreoffice %f &
+View=%view{ascii} xlsx2csv %f | iconv.py -f utf-8
+
+#[Include/video]
+#Open=mplay %f &
+#View=%view{ascii} cat %f
+
+[Include/xml]
+Open=%cd %p/xml://
+
+[Include/zip]
+Open=%cd %p/uzip://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip
+
+### /phd
+
+### GIT Repo ###
+[gitfs changeset]
+Regex=^\[git\]
+Open=%cd %p/changesetfs://
+View=%cd %p/patchsetfs://
+
+### Archives ###
+# Since we use "file -z", we should use Regex and Shell first, then Type.
+
+
+######### Files by name (Regex and Shell) #########
+
+# .tgz, .tpz, .tar.gz, .tar.z, .tar.Z
+[tar.gzip]
+Regex=\.t([gp]?z|ar\.g?[zZ])$
+Include=tar.gz
+
+[ipk]
+Shell=.ipk
+Include=tar.gz
+
+[gem]
+Shell=.gem
+Include=tar.gz
+
+[tar.bzip]
+Shell=.tar.bz
+# Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.bzip
+
+[tar.bzip2]
+Regex=\.t(ar\.bz2|bz2?|b2)$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.bzip2
+
+# .tar.lzma, .tlz
+[tar.lzma]
+Regex=\.t(ar\.lzma|lz)$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.lzma
+
+[tar.lz]
+Shell=.tar.lz
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.lz
+
+# .tar.lz4, .tlz4
+[tar.lz4]
+Regex=\.t(ar\.lz4|lz4)$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.lz4
+
+# .tar.xz, .txz
+[tar.xz]
+Regex=\.t(ar\.xz|xz)$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.xz
+
+# .tar.zst, .tzst
+[tar.zst]
+Regex=\.t(ar\.zst|zst)$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.zst
+
+# .tar.F - used on QNX
+[tar.F]
+Shell=.tar.F
+# Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.F
+
+# .qpr/.qpk - QNX Neutrino package installer files
+[tar.qpr]
+Regex=\.qp[rk]$
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.qpr
+
+[tar]
+Shell=.tar
+ShellIgnoreCase=true
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar
+
+[arj]
+Regex=\.a(rj|[0-9][0-9])$
+RegexIgnoreCase=true
+Open=%cd %p/uarj://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view arj
+
+[cab]
+Shell=.cab
+ShellIgnoreCase=true
+Open=%cd %p/ucab://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cab
+
+[ha]
+Shell=.ha
+ShellIgnoreCase=true
+Open=%cd %p/uha://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view ha
+
+[rar]
+Regex=\.r(ar|[0-9][0-9])$
+RegexIgnoreCase=true
+Open=%cd %p/urar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view rar
+
+# ALZip
+[alz]
+Shell=.alz
+ShellIgnoreCase=true
+Open=%cd %p/ualz://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view alz
+
+[cpio.Z]
+Shell=.cpio.Z
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.z
+
+[cpio.lz]
+Shell=.cpio.lz
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.lz
+
+[cpio.lz4]
+Shell=.cpio.lz4
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.lz4
+
+[cpio.xz]
+Shell=.cpio.xz
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.xz
+
+[cpio.zst]
+Shell=.cpio.zst
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.zst
+
+[cpio.gz]
+Shell=.cpio.gz
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio.gz
+
+[cpio]
+Shell=.cpio
+ShellIgnoreCase=true
+Include=cpio
+
+[initrd]
+Regex=^(initramfs.*\.img|initrd(-.+)?\.img(-.+)?)$
+Include=cpio
+
+[7zip]
+Shell=.7z
+ShellIgnoreCase=true
+Open=%cd %p/u7z://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view 7z
+
+[patch]
+Regex=\.(diff|patch)$
+Open=%cd %p/patchfs://
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view cat
+
+[patch.gz]
+Regex=\.(diff|patch)\.(gz|Z)$
+Open=%cd %p/patchfs://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view gz
+
+[patch.bz2]
+Regex=\.(diff|patch)\.bz2$
+Open=%cd %p/patchfs://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view bz2
+
+[patch.xz]
+Regex=\.(diff|patch)\.xz$
+Open=%cd %p/patchfs://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view xz
+
+[patch.zst]
+Regex=\.(diff|patch)\.zst$
+Open=%cd %p/patchfs://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zst
+
+[ls-lR]
+Regex=(^|\.)ls-?lR(\.gz|Z|bz2)$
+Open=%cd %p/lslR://
+
+[trpm]
+Shell=.trpm
+Open=%cd %p/trpm://
+View=%view{ascii} /usr/lib/mc/ext.d/package.sh view trpm
+
+# RPM packages (SuSE uses *.spm for source packages)
+[src.rpm]
+Regex=\.(src\.rpm|spm)$
+Open=%cd %p/rpm://
+View=%view{ascii} /usr/lib/mc/ext.d/package.sh view src.rpm
+
+[rpm]
+Shell=.rpm
+Open=%cd %p/rpm://
+View=%view{ascii} /usr/lib/mc/ext.d/package.sh view rpm
+
+[deb]
+Regex=\.u?deb$
+Open=%cd %p/deb://
+View=%view{ascii} /usr/lib/mc/ext.d/package.sh view deb
+
+[dpkg]
+Shell=.debd
+Open=%cd %p/debd://
+View=%view{ascii} /usr/lib/mc/ext.d/package.sh view debd
+
+[apt]
+Shell=.deba
+Open=%cd %p/deba://
+Ciew=%view{ascii} /usr/lib/mc/ext.d/package.sh view deba
+
+[ISO9660]
+Shell=.iso
+ShellIgnoreCase=true
+Open=%cd %p/iso9660://
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view iso9660
+
+[ar]
+Regex=\.s?a$
+Open=%cd %p/uar://
+#Open=%view{ascii} ar tv %f
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view ar
+
+[gplib]
+Shell=.lib
+ShellIgnoreCase=true
+Open=%cd %p/ulib://
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view lib
+
+### Sources ###
+
+[C/C++]
+Regex=\.(c|cc|cpp|cxx|c\+\+)$
+RegexIgnoreCase=true
+Include=editor
+
+[C/C++ header]
+Regex=\.(h|hh|hpp|hxx|h\+\+)$
+RegexIgnoreCase=true
+Include=editor
+
+[Fortran]
+Shell=.f
+ShellIgnoreCase=true
+Include=editor
+
+[Assembler]
+Regex=\.(s|asm)$
+RegexIgnoreCase=true
+Include=editor
+
+[Typescript]
+Shell=.ts
+ShellIgnoreCase=true
+Type=^Java source
+Include=editor
+
+# .so libraries
+[so]
+Regex=\.(so|so\.[0-9\.]*)$
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view so
+
+
+### Documentation ###
+
+#[Texinfo]
+#Regex=\.(te?xi|texinfo)$
+
+[info-by-shell]
+Shell=.info
+Open=/usr/lib/mc/ext.d/text.sh open info
+
+# Exception: .3gp are video files, not manual pages
+[3gp]
+Shell=.3gp
+ShellIgnoreCase=true
+Type=^ISO Media.*3GPP
+Include=video
+
+# Troff with me macros.
+# Exception - "read.me" is not a nroff file.
+[read.me]
+Shell=read.me
+Open=
+View=
+
+[troff]
+Shell=.me
+Open=/usr/lib/mc/ext.d/text.sh open nroff.me %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view nroff.me %var{PAGER:more}
+
+[roff with ms macros]
+Shell=.ms
+Open=/usr/lib/mc/ext.d/text.sh open nroff.ms %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view nroff.ms %var{PAGER:more}
+
+# Manual page
+
+[man.lz]
+Regex=([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lz$
+Open=/usr/lib/mc/ext.d/text.sh open man.lz %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.lz %var{PAGER:more}
+
+[man.lz4]
+Regex=([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lz4$
+Open=/usr/lib/mc/ext.d/text.sh open man.lz4 %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.lz4 %var{PAGER:more}
+
+[man.lzma]
+Regex=([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lzma$
+Open=/usr/lib/mc/ext.d/text.sh open man.lzma %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.lzma %var{PAGER:more}
+
+[man.xz]
+Regex=([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.xz$
+Open=/usr/lib/mc/ext.d/text.sh open man.xz %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.xz %var{PAGER:more}
+
+[man.zst]
+Regex=([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.zst$
+Open=/usr/lib/mc/ext.d/text.sh open man.zst %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.zst %var{PAGER:more}
+
+# Perl pod page
+[pod]
+Shell=.pod
+Open=/usr/lib/mc/ext.d/text.sh open pod %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view pod %var{PAGER:more}
+
+[chm]
+Shell=.chm
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/text.sh open chm
+
+### Images ###
+
+[xcf]
+Shell=.xcf
+Open=/usr/lib/mc/ext.d/image.sh open xcf
+
+[xbm]
+Shell=.xbm
+Open=/usr/lib/mc/ext.d/image.sh open xbm
+
+[xpm]
+Shell=.xpm
+Include=image
+
+[ico]
+Shell=.ico
+Include=image
+
+[svg]
+Shell=.svg
+ShellIgnoreCase=true
+View=%view{ascii} /usr/lib/mc/ext.d/image.sh view svg
+Open=/usr/lib/mc/ext.d/image.sh open svg
+
+
+### Sound files ###
+
+[sound]
+Regex=\.(wav|snd|voc|au|smp|aiff|snd|m4a|ape|aac|wv|spx|flac)$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/sound.sh open common
+View=%view{ascii} /usr/lib/mc/ext.d/sound.sh view common
+
+[mod]
+Regex=\.(mod|s3m|xm|it|mtm|669|stm|ult|far)$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/sound.sh open mod
+
+[wav22]
+Shell=.waw22
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/sound.sh open wav22
+
+[mp3]
+Shell=.mp3
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/sound.sh open mp3
+View=%view{ascii} /usr/lib/mc/ext.d/sound.sh view mp3
+
+[ogg]
+Regex=\.og[gax]$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/sound.sh open ogg
+View=%view{ascii} /usr/lib/mc/ext.d/sound.sh view ogg
+
+[opus]
+Shell=.opus
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/sound.sh open opus
+View=%view{ascii} /usr/lib/mc/ext.d/sound.sh view opus
+
+[midi]
+Regex=\.(midi?|rmid?)$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/sound.sh open midi
+
+[wma]
+Shell=.wma
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/sound.sh open wma
+View=%view{ascii} /usr/lib/mc/ext.d/sound.sh view wma
+
+# Play list
+[playlist]
+Regex=\.(m3u|pls)$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/sound.sh open playlist
+
+
+### Video ###
+
+[avi]
+Shell=.avi
+ShellIgnoreCase=true
+Include=video
+
+[asf]
+Regex=\.as[fx]$
+RegexIgnoreCase=true
+Include=video
+
+[divx]
+Shell=.divx
+ShellIgnoreCase=true
+Include=video
+
+[mkv]
+Shell=.mkv
+ShellIgnoreCase=true
+Include=video
+
+[mov]
+Regex=\.(mov|qt)$
+RegexIgnoreCase=true
+Include=video
+
+[mp4]
+Regex=\.(mp4|m4v|mpe?g)$
+RegexIgnoreCase=true
+Include=video
+
+# MPEG-2 TS container + H.264 codec
+[mts]
+Shell=.mts
+ShellIgnoreCase=true
+Include=video
+
+[ts]
+Shell=.ts
+ShellIgnoreCase=true
+Include=video
+
+[bob]
+Shell=.vob
+ShellIgnoreCase=true
+Include=video
+
+[wmv]
+Shell=.wmv
+ShellIgnoreCase=true
+Include=video
+
+[fli]
+Regex=\.fl[icv]$
+RegexIgnoreCase=true
+Include=video
+
+[ogv]
+Shell=.ogv
+ShellIgnoreCase=true
+Include=video
+
+[realaudio]
+Regex=\.ra?m$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/video.sh open ram
+
+[webm-by-shell]
+Shell=.webm
+ShellIgnoreCase=true
+Include=video
+
+
+### Documents ###
+
+[html]
+Regex=\.html?$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/web.sh open html
+View=%view{ascii} /usr/lib/mc/ext.d/web.sh view html
+
+[StarOffice-5.2]
+Shell=.sdw
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/doc.sh open ooffice
+
+# StarOffice 6 and OpenOffice.org formats
+[OpenOffice.org]
+Regex=\.(odt|fodt|ott|sxw|stw|ods|fods|ots|sxc|stc|odp|fodp|otp|sxi|sti|odg|fodg|otg|sxd|std|odb|odf|sxm|odm|sxg)$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/doc.sh open ooffice
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view odt
+
+[AbiWord]
+Shell=.abw
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/doc.sh open abw
+
+[Gnumeric]
+Shell=.gnumeric
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/doc.sh open gnumeric
+
+[rtf]
+Shell=.rtf
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/doc.sh open msdoc
+
+# Microsoft Word Document
+[msdoc-by-shell]
+Regex=\.(do[ct]|wri|docx)$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/doc.sh open msdoc
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msdoc
+
+# Microsoft Excel Worksheet
+[msxls-by-shell]
+Regex=\.(xl[sw]|xlsx)$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/doc.sh open msxls
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msxls
+
+# Microsoft PowerPoint Presentation
+[msppt]
+Regex=\.(pp[ts]|pptx)$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/doc.sh open msppt
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msppt
+
+[dvi]
+Shell=.dvi
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/doc.sh open dvi
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view dvi
+
+[tex]
+Shell=.tex
+ShellIgnoreCase=true
+Include=editor
+
+[markdown]
+Regex=\.(md|mkd)$
+ShellIgnoreCase=true
+Include=editor
+
+[djvu]
+Regex=\.djvu?$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/doc.sh open djvu
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view djvu
+
+# Comic Books
+[cbr]
+Regex=\.cb[zr]$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/doc.sh open comic
+
+# Epup, mobi, fb2
+[ebook]
+Regex=\.(epub|mobi|fb2)$
+RegexIgnoreCase=true
+Open=/usr/lib/mc/ext.d/doc.sh open ebook
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view ebook
+
+
+### Miscellaneous ###
+
+# Compiled Java classes
+[javaclass]
+Shell=.class
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view javaclass
+
+[Imakefile]
+Shell=Imakefile
+Open=xmkmf -a
+
+# Makefile.PL (MakeMaker)
+[Makefile.pl]
+Regex=^Makefile\.(PL|pl)$
+Open=%var{PERL:perl} %f
+
+[Makefile]
+Regex=^[Mm]akefile
+Open=make -f %f %{Enter parameters}
+
+[dbf]
+Shell=.dbf
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/misc.sh open dbf
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view dbf
+
+# REXX script
+[rexx]
+Regex=\.(rexx?|cmd)$
+Open=rexx %f %{Enter parameters};echo "Press ENTER";read y
+
+# Disk images for Commodore computers (VIC20, C64, C128)
+[d64]
+Shell=.d64
+ShellIgnoreCase=true
+Open=%cd %p/uc1541://
+View=%view{ascii} c1541 %f -list
+
+# Glade, a user interface designer for GTK+ and GNOME
+[glade]
+Shell=.glade
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/misc.sh open glade
+
+# Gettext Catalogs
+[mo]
+Regex=.g?mo$
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view mo
+
+[po]
+Shell=.po
+Open=/usr/lib/mc/ext.d/misc.sh open po
+
+[lyx]
+Shell=.lyx
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/misc.sh open lyx
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view lyx
+
+[torrent]
+Shell=.torrent
+ShellIgnoreCase=true
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view torrent
+
+
+### Plain compressed files ###
+
+[ace]
+Shell=.ace
+ShellIgnoreCase=true
+Open=%cd %p/uace://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view ace
+
+[arc]
+Shell=.arc
+ShellIgnoreCase=true
+Open=%cd %p/uarc://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view arc
+
+[zip-by-shell]
+Shell=.zip
+ShellIgnoreCase=true
+Open=%cd %p/uzip://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip
+
+[zoo]
+Shell=.zoo
+ShellIgnoreCase=true
+Open=%cd %p/uzoo://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zoo
+
+[lz4]
+Shell=.lz4
+ShellIgnoreCase=true
+Open=/usr/lib/mc/ext.d/archive.sh view lz4 %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lz4
+
+[wim]
+Shell=.wim
+ShellIgnoreCase=true
+Open=%cd %p/uwim://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view wim
+
+
+######### Files by Type #########
+
+### Archives ###
+
+[mailbox]
+Type=^ASCII\ mail\ text
+Open=%cd %p/mailfs://
+
+
+### Sources ###
+
+# Object
+[elf]
+Type=^ELF
+#Open=%var{PAGER:more} %f
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view elf
+
+
+### Documentation ###
+
+# GNU Info page
+[info-by-type]
+Type=^Info\ text
+Open=/usr/lib/mc/ext.d/text.sh open info
+
+# Manual page - compressed
+[troff.gz]
+Type=troff.*gzip compressed
+Open=/usr/lib/mc/ext.d/text.sh open man.gz %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.gz %var{PAGER:more}
+
+[troff.bzip]
+Type=troff.*bzip compressed
+Open=/usr/lib/mc/ext.d/text.sh open man.bz %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.bz %var{PAGER:more}
+
+[troff.bzip2]
+Type=troff.*bzip2 compressed
+Open=/usr/lib/mc/ext.d/text.sh open man.bz2 %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man.bz2 %var{PAGER:more}
+
+# Manual page
+[man]
+Type=troff or preprocessor input
+Open=/usr/lib/mc/ext.d/text.sh open man %var{PAGER:more}
+View=%view{ascii,nroff} /usr/lib/mc/ext.d/text.sh view man %var{PAGER:more}
+
+
+### Images ###
+
+[gif]
+Type=^GIF
+Include=image
+
+[jpeg]
+Type=^JPEG
+Include=image
+
+[bitmap]
+Type=^PC\ bitmap
+Include=image
+
+[png]
+Type=^PNG
+Include=image
+
+[jng]
+Type=^JNG
+Include=image
+
+[mng]
+Type=^MNG
+Include=image
+
+[tiff]
+Type=^TIFF
+Include=image
+
+[rbm]
+Type=^PBM
+Include=image
+
+[pgm]
+Type=^PGM
+Include=image
+
+[ppm]
+Type=^PPM
+Include=image
+
+[netpbm]
+Type=^Netpbm
+Include=image
+
+
+### Video ###
+
+[webm-by-type]
+Type=WebM
+Include=video
+
+
+### Documents ###
+
+[postscript]
+Type=^PostScript
+Open=/usr/lib/mc/ext.d/doc.sh open ps
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view ps
+
+[pdf]
+Type=^PDF
+Open=/usr/lib/mc/ext.d/doc.sh open pdf
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view pdf
+
+# Microsoft Word Document
+[msdoc-by-type]
+Type=^Microsoft\ Word
+Open=/usr/lib/mc/ext.d/doc.sh open msdoc
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msdoc
+
+# Microsoft Excel Worksheet
+[msxls-by-type]
+Type=^Microsoft\ Excel
+Open=/usr/lib/mc/ext.d/doc.sh open msxls
+View=%view{ascii} /usr/lib/mc/ext.d/doc.sh view msxls
+
+# Use OpenOffice.org/LibreOffice to open any MS Office documents
+[mso-doc-1]
+Type=^Microsoft\ Office\ Document
+Open=/usr/lib/mc/ext.d/doc.sh open ooffice
+
+[mso-doc-2]
+Type=^Microsoft\ OOXML
+Open=/usr/lib/mc/ext.d/doc.sh open ooffice
+
+[framemaker]
+Type=^FrameMaker
+Open=/usr/lib/mc/ext.d/doc.sh open framemaker
+
+
+### Miscellaneous ###
+
+[sqlite3.db]
+Type=^SQLite 3.x database
+Open=/usr/lib/mc/ext.d/misc.sh open sqlite
+View=%view{ascii} /usr/lib/mc/ext.d/misc.sh view sqlite
+
+
+### Plain compressed files ###
+
+[gzip]
+Type=\(gzip compressed
+Open=/usr/lib/mc/ext.d/archive.sh view gz %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view gz
+
+[bzip]
+Type=\(bzip compressed
+Open=/usr/lib/mc/ext.d/archive.sh view bzip %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view bzip
+
+[bzip2]
+Type=\(bzip2 compressed
+Open=/usr/lib/mc/ext.d/archive.sh view bzip2 %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view bz2
+
+[compress]
+Type=\(compress'd
+Open=/usr/lib/mc/ext.d/archive.sh view gz %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view gz
+
+[lz]
+Type=\(lzip compressed
+Open=/usr/lib/mc/ext.d/archive.sh view lz %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lz
+
+[lzma]
+Type=\(LZMA compressed
+Open=/usr/lib/mc/ext.d/archive.sh view lzma %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lzma
+
+[xz]
+Type=\(XZ compressed
+Open=/usr/lib/mc/ext.d/archive.sh view xz %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view xz
+
+[zstd]
+Type=\(Zstandard compressed
+Open=/usr/lib/mc/ext.d/archive.sh view zst %var{PAGER:more}
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zst
+
+[zip-by-type]
+Type=\(Zip archive
+Open=%cd %p/uzip://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip
+
+[jar]
+Type=\(Java\ (Jar\ file|archive)\ data\ \((zip|JAR)\)
+TypeIgnoreCase=true
+Open=%cd %p/uzip://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view zip
+
+[lha]
+Type=^LHa\ .*archive
+Open=%cd %p/ulha://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view lha
+
+[pak]
+Type=^PAK\ .*archive
+Open=%cd %p/unar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view pak
+
+# Parity Archive
+[par2]
+Type=^Parity\ Archive\ Volume\ Set
+Open=/usr/lib/mc/ext.d/archive.sh open par2
+
+
+######### Includes #########
+# Includes should be at end of the bindings
+
+[Include/tar.gz]
+Open=%cd %p/utar://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.gz
+
+[Include/cpio]
+Open=%cd %p/ucpio://
+View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view cpio
+
+[Include/editor]
+Open=%var{EDITOR:editor} %f
+
+[Include/image]
+Open=/usr/lib/mc/ext.d/image.sh open ALL_FORMATS
+View=%view{ascii} /usr/lib/mc/ext.d/image.sh view ALL_FORMATS
+
+[Include/video]
+Open=/usr/lib/mc/ext.d/video.sh open ALL_FORMATS
+View=%view{ascii} /usr/lib/mc/ext.d/video.sh view ALL_FORMATS
+
+
+######### Default #########
+
+# Default target for anything not described above
+[Default]
+Open=
+View=
+
+### EOF ###
index e0a3bd511a7d4f6ecbb0c9089719ecb11e906ce3..c2198c8978457c3e3ae2b81f25ad519b2ef36151 100644 (file)
--- a/.mc/menu
+++ b/.mc/menu
@@ -37,6 +37,10 @@ w  View the file in a new browser window
 t  View the file in a new browser tab
    exec webbrowser-encode-url -e utf-8 -t file://%d/%f
 
++ t lr
+p  View the file in a new private browser tab
+   exec webbrowser -p file://%d/%f
+
 += f \.fb2(\.bz2|\.gz|\.zip)?$ | f \.(chm|epub|htm(l?)|txt|rtf)$ & t lr
 f  View fb2/chm/epub with fbreader
    fbreader %f &
@@ -65,10 +69,14 @@ T  fb2txt
 v  View pdf
    pdftotext -layout -q %f - | iconv.py -f utf-8 | ${PAGER:-more}
 
-+= t lr & f \.(pdf|PDF)$
++ t lr & f \.(pdf|PDF)$
 e  View pdf with evince
    evince %f &
 
++= t lr & f \.(pdf|PDF)$
+e  View pdf with qpdfview
+   if [ %d/%f = "`echo %d/%f | iconv -t utf-8`" ]; then qpdfview %f & else src=%d/%f; dest="$HOME/tmp/`echo $src | iconv -t koi8-r | koi2lat | sed 's!/!%!g'`"; ln -s "$src" "$dest" && qpdfview "$dest" & (sleep 3; exec rm -f "$dest") & fi
+
 += t lr & f \.djvu(\.bz2|\.gz)?$
 e  View djvu
    djview %f &
@@ -102,14 +110,18 @@ o  View OpenXlsx with xlsx2csv
 x  View xls with xls2csv
    xls2csv %f | ${PAGER:-more}
 
++ t lr & f \.(bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|pbm|PBM|ppm|PPM|png|PNG|xbm|xpm|ico|jp2|tif|TIF|tiff|TIFF|webp)$ | t t
+e  Edit image(s)
+   gimp %s &
+
 + t lr & f \.(bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|pbm|PBM|ppm|PPM|png|PNG|xbm|xpm)$ | t t
 = t lr & f \.(bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|pbm|PBM|ppm|PPM|png|PNG|xbm|xpm)$
 i  View image(s) scaled
-   xli -title "`echo %s | sed 's/ /_/g'`" -zoom auto %s &
+   xli -title "`echo %s | sed 's/[ .]/_/g'`" -zoom auto %s &
 
 + t lr & f \.(bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|pbm|PBM|ppm|PPM|png|PNG|xbm|xpm)$ | t t
 I  View image(s) full size
-   xli -title "`echo %s | sed 's/ /_/g'`" %s &
+   xli -title "`echo %s | sed 's/[ .]/_/g'`" %s &
 
 + t lr & f \.(bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|pbm|PBM|ppm|PPM|png|PNG|xbm|xpm)$
 I  Identify image
@@ -120,47 +132,68 @@ I  Identify image
 I  View icon, JPEG-2000, TIFF, WebP image
    display %s &
 
-+ t lr & f \.(aac|ac3|ape|cue|dts|flac|m3u|mka|mp3|MP3|ogg|OGG|pls|WAV|wav|wv)$ | t t
-a  Add the audiofile(s) or playlist(s)
-   if [ "`audtool --get-volume`" -eq 0 ]; then audacious & sleep 3; fi
-   for f in %s; do
-      audtool --playlist-addurl "$f"
-   done
-   #deadbeef --queue %s &
++ t lr & f \.(ico|jp2|tif|TIF|tiff|TIFF|webp)$
+I  Identify image
+   identify %f
 
-+ t lr & f \.(aac|ac3|ape|cue|dts|flac|m3u|mka|mp3|MP3|ogg|OGG|pls|WAV|wav|wv)$ | t t
-= t lr & f \.(aac|ac3|ape|cue|dts|flac|m3u|mka|mp3|MP3|ogg|OGG|pls|WAV|wav|wv)$
++ t lr & f \.(aac|ac3|ape|cue|dts|flac|m3u8?|mka|mp3|MP3|ogg|OGG|pls|WAV|wav|wv)$ | t t
+a  Add the audiofile(s) or playlist(s)
+   #if [ "`audtool --get-volume`" -eq 0 ]; then audacious & sleep 3; fi
+   #for f in %s; do
+   #   case "$f" in
+   #      *.m3u8?) while read song; do
+   #         audtool --playlist-addurl "$song"
+   #      done < "$f" ;;
+   #      *) audtool --playlist-addurl "$f" ;;
+   #   esac
+   #done
+   deadbeef --queue %s &
+
++ t lr & f \.(aac|ac3|ape|cue|dts|flac|m3u8?|mka|mp3|MP3|ogg|OGG|pls|WAV|wav|wv)$ | t t
+= t lr & f \.(aac|ac3|ape|cue|dts|flac|m3u8?|mka|mp3|MP3|ogg|OGG|pls|WAV|wav|wv)$
 p  Load the audiofile(s) or playlist(s)
-   if [ "`audtool --get-volume`" -eq 0 ]; then audacious & sleep 3; fi
-   audtool --playlist-clear
-   for f in %s; do
-      audtool --playlist-addurl "$f"
-   done
-   #deadbeef --queue %s &
-
-+ t lr & f \.(aac|ac3|ape|cue|dts|flac|m3u|mka|mp3|MP3|ogg|OGG|pls|WAV|wav|wv)$ | t t
+   #if [ "`audtool --get-volume`" -eq 0 ]; then audacious & sleep 3; fi
+   #audtool --playlist-clear
+   #for f in %s; do
+   #   case "$f" in
+   #      *.m3u8?) while read song; do
+   #         audtool --playlist-addurl "$song"
+   #      done < "$f" ;;
+   #      *) audtool --playlist-addurl "$f" ;;
+   #   esac
+   #done
+   deadbeef %s & (sleep 1; exec deadbeef --stop)
+
++ t lr & f \.(aac|ac3|ape|cue|dts|flac|m3u8?|mka|mp3|MP3|ogg|OGG|pls|WAV|wav|wv)$ | t t
 P  Play the audiofile(s) or playlist(s)
-   if [ "`audtool --get-volume`" -eq 0 ]; then audacious & sleep 3; fi
-   audtool --playlist-clear
-   for f in %s; do
-      audtool --playlist-addurl "$f"
-   done
-   exec audtool --playback-play
+   #if [ "`audtool --get-volume`" -eq 0 ]; then audacious & sleep 3; fi
+   #audtool --playlist-clear
+   #for f in %s; do
+   #   case "$f" in
+   #      *.m3u8?) while read song; do
+   #         audtool --playlist-addurl "$song"
+   #      done < "$f" ;;
+   #      *) audtool --playlist-addurl "$f" ;;
+   #   esac
+   #done
+   #exec audtool --playback-play
+   deadbeef %s &
    #mplayer -playlist %f &
-   #deadbeef %s &
 
-+ t lr & f \.m3u
++ t lr & f \.m3u8?
 R  Play the playlist in random order
-   "$HOME"/admin/prog/audio-cdr-video/audio/shuffle-playlist.py %f random-playlist-tmp.m3u
-   if [ "`audtool --get-volume`" -eq 0 ]; then audacious & sleep 3; fi
-   audtool --playlist-clear
-   audtool --playlist-addurl random-playlist-tmp.m3u
-   audtool --playback-play
-   #mplayer -playlist random-playlist-tmp.m3u &
-   #deadbeef --queue random-playlist-tmp.m3u & deadbeef --play
-   (sleep 5; exec rm random-playlist-tmp.m3u) &
-
-+ t lr & f \.(m3u|mp3|MP3|cue|aac|ac3|ape|dts|flac|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$
+   "$HOME"/prog/audio-cdr-video/audio/shuffle-playlist.py %f /tmp/random-playlist-tmp.m3u
+   #if [ "`audtool --get-volume`" -eq 0 ]; then audacious & sleep 3; fi
+   #audtool --playlist-clear
+   #while read song; do
+   #   audtool --playlist-addurl "$song"
+   #done < /tmp/random-playlist-tmp.m3u
+   #audtool --playback-play
+   deadbeef /tmp/random-playlist-tmp.m3u &
+   #mplayer -playlist /tmp/random-playlist-tmp.m3u &
+   (sleep 5; exec rm /tmp/random-playlist-tmp.m3u) &
+
++ t lr & f \.(m3u8?|mp3|MP3|cue|aac|ac3|ape|dts|flac|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$
 i  Audio/video info
    exec "$HOME"/.config/mpv/mpv_identify.sh %f
 
@@ -168,30 +201,36 @@ i  Audio/video info
 i  DVD info
    exec "$HOME"/.config/mpv/mpv_identify.sh .
 
-+ f \.(aac|ac3|ape|cue|dts|flac|m3u|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t d | t t
-m  Play video file(s) with mpv
++ f \.(aac|ac3|ape|cue|dts|flac|m3u8?|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t d | t t
+m  Play video file(s) with mpv (quiet)
+   AUDIO_VOLUME=80
+   export AUDIO_VOLUME
    mplayer %s &
 
-+ f \.(aac|ac3|ape|cue|dts|flac|m3u|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t d | t t
++ f \.(aac|ac3|ape|cue|dts|flac|m3u8?|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t d | t t
+m  Play video file(s) with mpv (normal)
+   mplayer %s &
+
++ f \.(aac|ac3|ape|cue|dts|flac|m3u8?|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t d | t t
+= f \.(aac|ac3|ape|cue|dts|flac|m3u8?|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$
 m  Play video file(s) with mpv (loud)
    AUDIO_VOLUME=120
    export AUDIO_VOLUME
    mplayer %s &
 
-+ f \.(aac|ac3|ape|cue|dts|flac|m3u|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t d | t t
-= f \.(aac|ac3|ape|cue|dts|flac|m3u|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$
++ f \.(aac|ac3|ape|cue|dts|flac|m3u8?|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t d | t t
 m  Play video file(s) with mpv (louder)
    AUDIO_VOLUME=150
    export AUDIO_VOLUME
    mplayer %s &
 
-+ f \.(aac|ac3|ape|cue|dts|flac|m3u|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t d | t t
++ f \.(aac|ac3|ape|cue|dts|flac|m3u8?|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t d | t t
 m  Play video file(s) with mpv (ask for volume)
    AUDIO_VOLUME=%{Enter volume}
    export AUDIO_VOLUME
    mplayer %s &
 
-+ f \.(m3u|mp3|MP3|cue|aac|ac3|ape|dts|flac|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t t
++ f \.(m3u8?|mp3|MP3|cue|aac|ac3|ape|dts|flac|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t t
 M  Play audio/video with mpv GUI
    gmplayer %s &
 
@@ -513,6 +552,10 @@ D  Diff these directories
 v  Verify signature
    exec gpg --verify %f
 
++ f \.(asc|gpg|sig(n)?)$ & t lr
+v  Verify detached signature
+   exec gpg --verify %f "`echo %f | sed 's/\.[^.]*$//'`"
+
 += f \.[1-8]$ | f \.man$ & t lr
 1  Display the file with roff -man
    %view nroff -man %f
diff --git a/.muttrc b/.muttrc
index c5ff07711c85c562ab2c302309c938af1f0a629b..b347d4f6d72bf02c8c243f65171eaecbded05a5a 100644 (file)
--- a/.muttrc
+++ b/.muttrc
@@ -362,7 +362,12 @@ macro pager,attach M \
    <exit><Home><change-folder>=sent-mail<Enter> \
    "Go to sent-mail"
 
-macro attach V "<save-entry>~/tmp/_xxx.html<Enter><shell-escape>webbrowser -n ~/tmp/_xxx.html; exec rm ~/tmp/_xxx.html<Enter>" \
+macro index,pager \cV "<show-version>" \
+   "Show version"
+
+macro index,pager V "v/text/html<Enter>V" \
+   "View the 1st html attachment in a web browser"
+macro attach V "<save-entry>~/tmp/_xxx.html<Enter>n<shell-escape>webbrowser -n ~/tmp/_xxx.html; exec rm ~/tmp/_xxx.html<Enter><exit>" \
    "View html attachment in a web browser"
 
 # Go to python mailbox
index a5e970c4633098faf6a0bca94017d4617b585a4f..e1328729f0c0640026bd7c63052658ea83e956d4 100644 (file)
@@ -139,6 +139,12 @@ lists/python
 * ^List-Id: .*<cheetahtemplate-(announce|discuss)\.lists\.sourceforge\.net>
 lists/python
 
+:0
+* ^From: .+<notifications@github\.com>
+* ^To: CheetahTemplate3/cheetah3 <cheetah3@noreply\.github\.com>
+* ^List-ID: CheetahTemplate3/cheetah3 <cheetah3\.CheetahTemplate3\.github\.com>
+lists/python
+
 :0
 * ^Sender: ppa-qps-devel-admin@lists\.sourceforge\.net
 lists/python
index 93756db412a213909724bf2161e1fc8cef555c53..45b4a5686487f2e0558fbdc18e5db1ad525e728c 100644 (file)
--- a/.profile
+++ b/.profile
@@ -8,13 +8,8 @@
 # see /usr/share/doc/bash/examples/startup-files for examples.
 # the files are located in the bash-doc package.
 
-if test -n "$BASH_VERSION"; then
-   case "$SHELL" in
-      */bash) ;;
-      */*csh) SHELL=/bin/bash ;;
-      # this is for bash.exe
-      *command.com | *\\bash) SHELL=//c/ubin/bash ;;
-   esac
+#if test -n "$BASH_VERSION"; then
+#   bash
 #elif test -n "$KSH_VERSION"; then
 #   ksh93
 #elif test -n "$FCEDIT"; then
@@ -25,10 +20,10 @@ if test -n "$BASH_VERSION"; then
 #   unknown
 #else
 #   sh
-fi
+#fi
 
 if [ -z "$USER" ]; then
-   USER="$LOGNAME"; export USER
+    USER="$LOGNAME"; export USER
 fi
 
 # the default umask is set in /etc/profile; for setting the umask
@@ -47,11 +42,11 @@ export PATH MANPATH # LD_LIBRARY_PATH
 LANG=C
 #LC_ALL=C
 case "$LC_CTYPE" in
-   *UTF-8) # LC_CTYPE is already set
-   ;;
+    *UTF-8) # LC_CTYPE is already set
+    ;;
 
-   *) LC_CTYPE=ru_RU.KOI8-R
-   ;;
+    *) LC_CTYPE=ru_RU.KOI8-R
+    ;;
 esac
 LC_COLLATE="$LC_CTYPE"
 #LANGUAGE="ru en"
@@ -74,148 +69,147 @@ export ORGANIZATION # NNTPSERVER
 
 # Interactive only commands
 if [ -t 0 ] ; then
-   if [ -z "$TERM" ]; then
-      eval `tset -Q -s -m 'network:?xterm'`
-   fi
-
-   stty sane erase ^H
-
-   if which less >/dev/null 2>&1; then
-      HAS_LESS=true
-   fi
-
-   case "$TERM" in
-      linux)
-         # mutt, python and vim
-         BACKGROUND=DARK
-         export BACKGROUND
-         [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/dark_bg
-      ;;
-
-      *rxvt*|screen*|*term*|vt100)
-         BACKGROUND=LIGHT
-         export BACKGROUND
-         [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg
-      ;;
-   esac
-
-   if [ -x /usr/bin/dircolors ]; then
-       test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
-   fi
-
-   if [ -n "$HAS_LESS" ]; then
-      PAGER=less
-      LESS="Rgimq"
-      case "$LC_CTYPE" in
-         *UTF-8) LESSCHARSET=utf-8
-         ;;
-
-         *) LESSCHARSET=koi8-r
-         ;;
-      esac
-      #LESSCHARDEF=32c.
-      LESSEDIT='vim ?lt+%lt. -- %f'
-      export LESS LESSCHARSET LESSEDIT # LESSCHARDEF
-
-      # make less more friendly for non-text input files, see lesspipe(1)
-      #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
-
-   else
-      PAGER=more
-   fi
-   export PAGER
-
-   EDITOR="$HOME"/.vim/vim.sh
-   FCEDIT="$EDITOR"
-   VISUAL="$EDITOR"
-   export EDITOR FCEDIT VISUAL
-
-   HISTCONTROL=ignoreboth
-   HISTIGNORE='&: *:x:X:[bf]g'
-   HISTFILE="$HOME/.sh_history"
-   HISTFILESIZE=2000
-   HISTSIZE=1000
-   export HISTCONTROL HISTIGNORE HISTFILE HISTFILESIZE HISTSIZE
-
-   # Used by bash/mc for hostname completion
-   HOSTFILE="$HOME"/lib/config/hosts
-   export HOSTFILE
-
-   MAIL="/var/mail/$USER"
-   MAILPATH="$MAIL:$HOME/mail/admin:$HOME/mail/block:$HOME/mail/bulk"
-   if [ -d "$HOME"/mail/lists/ ]; then
-         MAILPATH="$MAILPATH:`echo $HOME/mail/lists/* | sed 's/ /:/g'`"
-   fi
-   export MAIL MAILPATH
-
-   BROWSER="links2:links:elinks:w3m:lynx"
-   case "$TERM" in
-      *rxvt*|screen*|*term*|vt100)
-         BROWSER="l:$BROWSER"
-      ;;
-   esac
-   export BROWSER
-
-   #all_proxy="http://localhost:3128"
-   #ftp_proxy="$all_proxy"
-   #gopher_proxy="$all_proxy"
-   #http_proxy="$all_proxy"
-   #https_proxy="$all_proxy"
-   auto_proxy="file:///home/phd/admin/WWW/Mozilla/mozilla.pac"
-   no_proxy="localhost,127.0.0.1"
-   #export all_proxy ftp_proxy http_proxy https_proxy auto_proxy no_proxy # gopher_proxy
-   export auto_proxy no_proxy
-
-   ENV="$HOME/.shellrc"
-   export ENV
-
-   # set variable identifying the chroot you work in (used in the prompt below)
-   if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
-       debian_chroot="`cat /etc/debian_chroot`"
-   fi
-
-   if test -n "$BASH_VERSION"; then
-      if [ -r "$HOME"/admin/prog/bash_prompt ]; then
-         . "$HOME"/admin/prog/bash_prompt
-         set_prompts
-         unset set_prompts
-      else
-         OPS1="${debian_chroot:+($debian_chroot)}\u@\h:\W \$SHLVL\\$ "
-      fi
-
-      . "$ENV"
-
-   else
-      OPS1="${debian_chroot:+($debian_chroot)}`/usr/bin/whoami`@`/bin/hostname -s` > "
-   fi
-
-   ### biff controls new mail notification
-   #biff n
-   ### mesg controls messages (write/talk) from other users
-   mesg n
-   # make mail(1) use a pager
-   crt=; export crt
-
-   PYTHONSTARTUP="$HOME"/lib/python/init.py
-   export PYTHONSTARTUP
-
-   name="Oleg Broytman"
-   email="phd@phdru.name"
-
-   GIT_AUTHOR_NAME="$name"
-   GIT_AUTHOR_EMAIL="$email"
-   GIT_COMMITTER_NAME="$name"
-   GIT_COMMITTER_EMAIL="$email"
-   export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
-
-   HGUSER="$name <$email>"
-   export HGUSER
-
-   unset name email
-
-   #if test -f .hushlogin && ! cmp -s .motd /etc/motd; then
-   #   tee $HOME/.motd < /etc/motd
-   #fi
+    #if test -f .hushlogin && ! cmp -s .motd /etc/motd; then
+    #   tee $HOME/.motd < /etc/motd
+    #fi
+
+    if [ -z "$TERM" ]; then
+        eval `tset -Q -s -m 'network:?xterm'`
+    fi
+
+    stty sane erase ^H
+
+    if which less >/dev/null 2>&1; then
+        HAS_LESS=true
+    fi
+
+    case "$TERM" in
+        linux)
+            # mutt, python and vim
+            BACKGROUND=DARK
+            export BACKGROUND
+            [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/dark_bg
+        ;;
+
+        *rxvt*|screen*|*term*|vt100)
+            BACKGROUND=LIGHT
+            export BACKGROUND
+            [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg
+        ;;
+    esac
+
+    if [ -x /usr/bin/dircolors ]; then
+        test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
+    fi
+
+    if [ -n "$HAS_LESS" ]; then
+        PAGER=less
+        LESS="Rgimq"
+        case "$LC_CTYPE" in
+            *UTF-8) LESSCHARSET=utf-8
+            ;;
+
+            *) LESSCHARSET=koi8-r
+            ;;
+        esac
+        #LESSCHARDEF=32c.
+        LESSEDIT='vim ?lt+%lt. -- %f'
+        export LESS LESSCHARSET LESSEDIT # LESSCHARDEF
+
+        # make less more friendly for non-text input files, see lesspipe(1)
+        #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
+
+    else
+        PAGER=more
+    fi
+    export PAGER
+
+    EDITOR="$HOME"/.vim/vim.sh
+    FCEDIT="$EDITOR"
+    VISUAL="$EDITOR"
+    export EDITOR FCEDIT VISUAL
+
+    HISTCONTROL=ignoreboth
+    HISTIGNORE="`echo '&: *:~\?*:[bf]g:cd:clear:e:exit:logout:l:ls:ll:llp:[m,]c:ьс:w:X:x' | iconv -f koi8-r`"
+    HISTFILE="$HOME/.sh_history"
+    HISTFILESIZE=2000
+    HISTSIZE=1000
+    export HISTCONTROL HISTIGNORE HISTFILE HISTFILESIZE HISTSIZE
+
+    # Used by bash/mc for hostname completion
+    HOSTFILE="$HOME"/lib/config/hosts
+    export HOSTFILE
+
+    MAIL="/var/mail/$USER"
+    MAILPATH="$MAIL:$HOME/mail/admin:$HOME/mail/block:$HOME/mail/bulk"
+    if [ -d "$HOME"/mail/lists/ ]; then
+            MAILPATH="$MAILPATH:`echo $HOME/mail/lists/* | sed 's/ /:/g'`"
+    fi
+    export MAIL MAILPATH
+    if [ -n "$STY" -a "$WINDOW" != 0 ]; then
+        unset MAILCHECK
+    fi
+
+    BROWSER="links2:links:elinks:w3m:lynx"
+    case "$TERM" in
+        *rxvt*|screen*|*term*|vt100)
+            BROWSER="l:$BROWSER"
+        ;;
+    esac
+    export BROWSER
+
+    #all_proxy="http://localhost:3128"
+    #ftp_proxy="$all_proxy"
+    #gopher_proxy="$all_proxy"
+    #http_proxy="$all_proxy"
+    #https_proxy="$all_proxy"
+    auto_proxy="file:///home/phd/admin/WWW/Mozilla/mozilla.pac"
+    no_proxy="localhost,127.0.0.1"
+    #export all_proxy ftp_proxy http_proxy https_proxy auto_proxy no_proxy # gopher_proxy
+    export auto_proxy no_proxy
+
+    ENV="$HOME/.shellrc"
+    export ENV
+
+    # set variable identifying the chroot you work in (used in the prompt below)
+    if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
+        debian_chroot="`cat /etc/debian_chroot`"
+    fi
+
+    if test -n "$BASH_VERSION"; then
+        . "$HOME/.bashrc"
+    else
+        PS1="${debian_chroot:+($debian_chroot)}`/usr/bin/whoami`@`/bin/hostname -s` > "
+    fi
+
+    ### biff controls new mail notification
+    #biff n
+    ### mesg controls messages (write/talk) from other users
+    mesg n
+    # make mail(1) use a pager
+    crt=; export crt
+
+    PYTHONSTARTUP="$HOME"/lib/python/init.py
+    export PYTHONSTARTUP
+
+    name="Oleg Broytman"
+    email="phd@phdru.name"
+
+    GIT_AUTHOR_NAME="$name"
+    GIT_AUTHOR_EMAIL="$email"
+    GIT_COMMITTER_NAME="$name"
+    GIT_COMMITTER_EMAIL="$email"
+    export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
+
+    HGUSER="$name <$email>"
+    export HGUSER
+
+    unset name email
+
+    #SCREENDIR="$HOME"/tmp/screen
+    #export SCREENDIR
+    #mkdir -p "$SCREENDIR"
+    #chmod 700 "$SCREENDIR"
 fi
 
 # No need to set DISPLAY - ssh sets DISPLAY and calls xauth
@@ -223,39 +217,41 @@ fi
 #export DISPLAY
 
 if [ -n "$DISPLAY" ]; then
-   # mutt, python and vim
-   BACKGROUND=LIGHT
-   export BACKGROUND
-   [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg
-
-   # BROWSERs
-   BROWSER="firefox:seamonkey:chromium:google-chrome:opera:xlinks2:$BROWSER"
-
-   ### X Window System Configuration
-   #XAPPLRESDIR="$HOME/lib/X11/app-defaults/"; export XAPPLRESDIR
-   ### Old-style XNLSPATH
-   #XNLSPATH=/usr/X11R6/lib/X11/nls; export XNLSPATH
-
-   # For GTK2/GLib to convert filenames between internal and locale encodings
-   G_FILENAME_ENCODING="@locale"
-   export G_FILENAME_ENCODING
-   #G_BROKEN_FILENAMES=1
-   #export G_BROKEN_FILENAMES
-
-   # X Input Method, for Multi key (Compose) to work
-   GTK_IM_MODULE=xim
-   QT_IM_MODULE=xim
-   export GTK_IM_MODULE QT_IM_MODULE
-
-   # GTK2 anti-aliasing
-   GDK_USE_XFT=1
-   export GDK_USE_XFT
-
-   # nVidia OpenGL full scene anti-aliasing
-   #__GL_FSAA_MODE=4
-   #export __GL_FSAA_MODE
-
-   #xhost +local:root > /dev/null 2>&1
+    PATH=$PATH:/usr/games
+
+    # mutt, python and vim
+    BACKGROUND=LIGHT
+    export BACKGROUND
+    [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg
+
+    # BROWSERs
+    BROWSER="firefox:seamonkey:chromium:google-chrome:opera:xlinks2:$BROWSER"
+
+    ### X Window System Configuration
+    #XAPPLRESDIR="$HOME/lib/X11/app-defaults/"; export XAPPLRESDIR
+    ### Old-style XNLSPATH
+    #XNLSPATH=/usr/X11R6/lib/X11/nls; export XNLSPATH
+
+    # For GTK2/GLib to convert filenames between internal and locale encodings
+    G_FILENAME_ENCODING="@locale"
+    export G_FILENAME_ENCODING
+    #G_BROKEN_FILENAMES=1
+    #export G_BROKEN_FILENAMES
+
+    # X Input Method, for Multi key (Compose) to work
+    GTK_IM_MODULE=xim
+    QT_IM_MODULE=xim
+    export GTK_IM_MODULE QT_IM_MODULE
+
+    # GTK2 anti-aliasing
+    GDK_USE_XFT=1
+    export GDK_USE_XFT
+
+    # nVidia OpenGL full scene anti-aliasing
+    #__GL_FSAA_MODE=4
+    #export __GL_FSAA_MODE
+
+    #xhost +local:root > /dev/null 2>&1
 fi
 
 [ -n "$HAS_LESS" ] && unset HAS_LESS
@@ -273,11 +269,11 @@ fi
 # If SUN console, start the windows system
 #
 # if [ `tty` = /dev/console ] ; then
-#    if [ "$TERM" = sun -o "$TERM" = AT386 ] ; then
+#   if [ "$TERM" = sun -o "$TERM" = AT386 ] ; then
 #
 #       if [ ${OPENWINHOME:-""} = "" ] ; then
-#          OPENWINHOME=/usr/openwin
-#          export OPENWINHOME
+#           OPENWINHOME=/usr/openwin
+#           export OPENWINHOME
 #       fi
 #
 #       echo ""
@@ -286,8 +282,8 @@ fi
 #
 #       "$OPENWINHOME"/bin/openwin
 #
-#       clear      # get rid of annoying cursor rectangle
-#       #exit      # logout after leaving windows system
+#       clear       # get rid of annoying cursor rectangle
+#       #exit       # logout after leaving windows system
 #
-#    fi
+#   fi
 # fi
index ad85a06e32b2c73f5c8956fe95f6678a61c11178..88ded7dbbdb1ee0f6d7b7a48c0ca2b2089b59a3f 100644 (file)
--- a/.project
+++ b/.project
@@ -1,2 +1 @@
 Programmer at STCnet "Atlas"/SmartTeleMax.
-Programmer/sysadmin at NRSC - https://oper.med.ru/ .
index 279a1204662c7f8e404802bc9e448b53ad9a309a..a085862f10c27b9c2382fc3b303694980a60e03b 100644 (file)
--- a/.screenrc
+++ b/.screenrc
@@ -90,11 +90,13 @@ termcapinfo xterm*|rxvt*|kterm*|Eterm* hs:ts=\E]0;:fs=\007:ds=\E]0;\007
 #hardstatus lastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
 
 # status line at the bottom of terminal
-# display numbers and titles:
-# for inactive windows - black on cyan
-# for active window - white on blue
-hardstatus alwayslastline
-hardstatus string "%{= yk}%-w%{= gk}%n%f %t%{-}%+w %-="
+# display window number, flags and title
+# for inactive windows - black on yellow (brown)
+# for active window - black on green
+#hardstatus alwayslastline
+#hardstatus string "%{= yk}%-w%{= gk}%n%f %t%{-}%+w %-="
+
+caption always "%{= yk}%-w%{= gk}%n%f %t%{-}%+w %-="
 
 # set these terminals up to be 'optimal' instead of vt100
 termcapinfo xterm*|rxvt*|linux*|Eterm* OP
@@ -116,7 +118,7 @@ termcapinfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
 #termcapinfo rxvt* 'ti=\E7\E[?47h:te=\E[2J\E[?47l\E8'
 
 # Do not use the alternate screen at all
-# run `tput smcup; screen -S test; tput rmcup`
+# run `tput smcup; screen; tput rmcup`
 termcapinfo xterm*|rxvt* 'ti=:te='
 
 # Enable non-blocking mode to better cope with flaky ssh connections.
index 7388d5a59743eb30f696805401708f4ed5f5c751..9f9242ae5e6a4d3d05448af6f06ceb2be68a222d 100644 (file)
--- a/.shellrc
+++ b/.shellrc
@@ -2,10 +2,6 @@
 # $HOME/.shellrc
 #
 
-# ~/.bashrc: executed by bash(1) for non-login shells.
-# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
-# for examples
-
 # If not running interactively, don't do anything
 case $- in
     *i*) ;;
@@ -15,20 +11,6 @@ esac
 # Stop if non-interactive shell
 [ -z "$PS1" ] && return
 
-if test -n "$BASH_VERSION"; then
-   # append to the history file, don't overwrite it
-   shopt -s histappend
-
-   # check the window size after each command and, if necessary,
-   # update the values of LINES and COLUMNS.
-   shopt -s checkwinsize
-
-   # If set, the pattern "**" used in a pathname expansion context will
-   # match all files and zero or more directories and subdirectories.
-   #shopt -s globstar
-fi
-
-
 #if [ -x /usr/bin/dircolors ]; then
 #   # I don't like these aliases - they work only in command line
 #   # but not in scripts I run from command line.
@@ -47,413 +29,184 @@ fi
 
 
 case "$HOME" in
-   /home/*)
-      if [ -L /home ]; then
-         START_DIR="`pwd`" &&
-         cd "$HOME" &&
-         HOME="`pwd`" &&
-         cd "$START_DIR"
-      fi
-   ;;
+    /home/*)
+        if [ -L /home ]; then
+            START_DIR="`pwd`" &&
+            cd "$HOME" &&
+            HOME="`pwd`" &&
+            cd "$START_DIR"
+        fi
+    ;;
 esac
 
-if test -n "$BASH_VERSION"; then
-   [ "`type -t ls`" = alias ] && unalias ls
-   [ "`type -t ll`" = alias ] && unalias ll
-   [ "`type -t mc`" = alias ] && unalias mc
-
-   back() { cd - "$@"; }
-   functions() { typeset -f "$@"; }
-   j() { jobs; }
-
-   if [ -z "$BASH_COMPLETION_COMPAT_DIR" ]; then
-      if [ -d /usr/share/bash-completion -a -r /usr/share/bash-completion/bash_completion ]; then
-         _BASH_COMPLETIONS_DIR=/usr/share/bash-completion/completions
-         . /usr/share/bash-completion/bash_completion
-      elif [ -r /etc/bash_completion ]; then
-         _BASH_COMPLETIONS_DIR=/etc/bash_completion.d
-         . /etc/bash_completion
-      elif [ -d /etc/bash_completion.d ]; then
-         _BASH_COMPLETIONS_DIR=/etc/bash_completion.d
-         for _compf in /etc/bash_completion.d/*; do
-            . $_compf
-         done
-      elif [ -d /usr/local/etc/bash_completion.d ]; then
-         _BASH_COMPLETIONS_DIR=/usr/local/etc/bash_completion.d
-         for _compf in /usr/local/etc/bash_completion.d/*; do
-            . $_compf
-         done
-      else
-         echo "Unknown OS type, cannot source bash_completion" >&2
-      fi
-   fi
-
-   has_completion() {
-      [ -n "$_BASH_COMPLETIONS_DIR" -a -d "$_BASH_COMPLETIONS_DIR" -a -r "$_BASH_COMPLETIONS_DIR/$1" ] ||
-      complete -p $1 >/dev/null 2>&1
-   }
-
-   for cmd in builtin cgmem_nice command dbus-launch exec \
-         killall man nice nohup pidof pidOf KillAll pgrep pkill psg pswg \
-         run-hosts su sudo time whence whereis which xargs; do
-      ! has_completion $cmd && complete -o default -A command $cmd
-   done
-
-   for cmd in dig host mtr nslookup nc netcat nmap p ping ping6 \
-         ssh2 s2 socat telnet t tt \
-         tcptraceroute tcptraceroute6 tracert tracert6 traceroute traceroute6 \
-         whois wd wget wget-download wget-m wget-wrapper ww; do
-      ! has_completion $cmd && complete -A hostname $cmd
-   done
-
-   for cmd in distribute ftp lftp r rsync \
-         s scp ssh smbclient tcpdump tshark wireshark; do
-      ! has_completion $cmd && complete -o default -A hostname $cmd
-   done
-
-   for cmd in bg fg jobs; do
-      ! has_completion $cmd && complete -A job $cmd
-   done
-
-   complete -A job j wait
-
-   for cmd in unset; do
-      ! has_completion $cmd && complete -A function -A variable $cmd
-   done
-
-   if [ -d "$HOME"/.bash_completion.d ]; then
-      for _compf in "$HOME"/.bash_completion.d/*; do
-         . $_compf
-      done
-   fi
-
-   delegate_completion() {
-      local prog programs
-      prog=$1
-      ! has_completion $prog && return
-      shift
-      programs="$@"
-      eval "_${prog}_completion_loader() {
-         _completion_loader $prog
-         complete -o nospace -F _$prog $programs
-         unset _${prog}_completion_loader
-         return 124
-      }"
-      complete -F _${prog}_completion_loader $programs
-   }
-
-   delegate_completion make m
-   delegate_completion ping p
-   delegate_completion rsync r rsync_cgmn rsync_cgmn_recode
-   delegate_completion ssh s
-   delegate_completion wget wget-m wget-wrapper ww
-
-   unset _BASH_COMPLETIONS_DIR has_completion delegate_completion
-
-   if [ -d "$HOME/lib/config" ]; then
-      complete -W "`cd \"$HOME/lib/config\" && echo *`" include
-   fi
-   complete -W "`echo $BROWSER | sed 's/:/ /g'`" start-browser
-
-   if [ "`type -t short_curdir`" != function -a \
-         -r "$HOME"/admin/prog/bash_prompt ]; then
-      . "$HOME"/admin/prog/bash_prompt
-   fi
-
-   #if type -p pip >/dev/null 2>&1; then
-   #   eval "`pip completion --bash`"
-   #   rm -rf /tmp/pip_build_"$USER"
-   #fi
-
-   #if which pyenv >/dev/null 2>&1; then
-   #   eval "`pyenv init -`"
-   #   eval "`pyenv virtualenv-init -`"
-   #fi
-
-   . virtualenvwrapper_lazy.sh 2>/dev/null
-
-   if [ -n "$VIRTUAL_ENV" ] && ! type deactivate >/dev/null 2>&1; then
-      . "$VIRTUAL_ENV/bin/activate"
-   fi
-
-   # Clean up python virtual environment on exit
-   # See https://virtualenvwrapper.readthedocs.io/en/latest/tips.html#clean-up-environments-on-exit
-
-   trap '[ "$VIRTUAL_ENV" ] && deactivate' EXIT
-
-elif test -n "$KSH_VERSION" -o -n "$FCEDIT"; then
-   back() { cd - "$@"; }
-   j() { jobs; }
+if test -n "$KSH_VERSION" -o -n "$FCEDIT"; then
+    back() { cd - "$@"; }
+    j() { jobs; }
 fi
 
-PS1="$OPS1"
-
 # clear screen and history, logout
 chlo() { clear; cd; >$HISTFILE; unset HISTFILE; history -c; logout || exit; }
 
+if [ -n "$STY" -a "$WINDOW" != 0 ]; then
+    #unset MAILCHECK everywhere except for the 1st GNU screen window
+    unset MAILCHECK
+fi
 
 if test -x /usr/bin/git >/dev/null 2>&1; then
-   # chdir to a directory
-   cdgitpath() {
-      if [ $# -ne 1 ]; then
-         echo "Usage: cdgitpath path_key" >&2
-         return 1
-      fi
-
-      path_key="$1"
-      if [ -z "$path_key" ]; then
-         echo "Usage: cdgitpath path_key" >&2
-         return 1
-      fi
-
-      path_url="`git config --get --path $path_key`"
-      if echo "$path_url" | grep -q '^file:/'; then
-         path_url="`echo \"$path_url\" | sed 's@^file:/\+@/@'`"
-      fi
-      cd "$path_url"
-   }
-
-   # chdir to a remote's directory (if the remote is on the local FS)
-   cdremote() {
-      if [ $# -gt 1 ]; then
-         echo "Usage: cdremote [remote_name]" >&2
-         return 1
-      fi
-
-      if [ -z "$1" ]; then
-         branch="`git rev-parse --abbrev-ref HEAD`"
-         remote="`git config --get branch.$branch.remote`"
-      else
-         remote="$1"
-      fi
-
-      if [ -n "$remote" ] && git config --get remote.$remote.url |
-            grep -q '^\(file:/\|/\|\.\./\)'; then # (file:/ or / or ../ at the beginning)
-         cdgitpath remote.$remote.url
-      else
-
-         if [ -n "$1" ]; then
-            echo "Cannot find directory for remote $1" >&2
-            echo "Usage: cdremote [remote_name]" >&2
+    # chdir to a directory
+    cdgitpath() {
+        if [ $# -ne 1 ]; then
+            echo "Usage: cdgitpath path_key" >&2
             return 1
-         fi
-
-         if test -n "$BASH_VERSION"; then
-            _list_remotes '^\(file:/\|/\|\.\./\)' # (file:/ or / or ../ at the beginning)
-            if [ ${#GIT_REMOTES[*]} -eq 1 ]; then
-               remote=${GIT_REMOTES[0]}
-               unset GIT_REMOTES
-               cdgitpath remote.$remote.url
-            else
-               unset GIT_REMOTES
-               echo "Cannot find directory for any remote" >&2
-               echo "Usage: cdremote [remote_name]" >&2
-               return 1
-            fi
-         else
-            echo "Cannot find directory for remote $1" >&2
-            echo "Usage: cdremote [remote_name]" >&2
+        fi
+
+        path_key="$1"
+        if [ -z "$path_key" ]; then
+            echo "Usage: cdgitpath path_key" >&2
             return 1
-         fi
-      fi
-   }
-
-   if test -n "$BASH_VERSION"; then
-      # completion for aliases in global .gitconfig
-
-      # fixup rbi rbia rbiap rbip - do refs name completion
-      _git_fixup() { __gitcomp_nl "$(__git_refs)" ; }
-      _git_rbi() { __gitcomp_nl "$(__git_refs)" ; }
-      _git_rbia() { __gitcomp_nl "$(__git_refs)" ; }
-      _git_rbiap() { __gitcomp_nl "$(__git_refs)" ; }
-      _git_rbip() { __gitcomp_nl "$(__git_refs)" ; }
-      #
-      # push-to-all-remotes - do branch name completion
-      _git_push_to_all_remotes() { __gitcomp_nl "$(__git_heads)" ; }
-
-      _cdgitpath_complete() {
-         local cur="${COMP_WORDS[COMP_CWORD]}"
-         COMPREPLY=(`compgen -W "$(__git_config_get_set_variables)" -- "$cur"`)
-      }
-
-      _git_open() {
-         _cdgitpath_complete
-      }
-
-      complete -F _cdgitpath_complete cdgitpath git-open
-
-      # list remotes with URLs matching a regexp
-      _list_remotes() {
-         if [ $# -ne 1 ]; then
-            echo "Usage: _list_remotes remote_regexp" >&2
+        fi
+
+        path_url="`git config --get --path $path_key`"
+        if echo "$path_url" | grep -q '^file:/'; then
+            path_url="`echo \"$path_url\" | sed 's@^file:/\+@/@'`"
+        fi
+        cd "$path_url"
+    }
+
+    # See https://stackoverflow.com/a/77266926/7976758
+
+    cd_worktree() {
+        if [ $# -ne 1 ]; then
+            echo "Usage: cd_worktree <branch>" >&2
             return 1
-         fi
-         declare -ag GIT_REMOTES=()
-         local remote
-         for remote in `git remote`; do
-            if git config --get remote.$remote.url | grep -q "$1"; then
-               GIT_REMOTES+=($remote)
-            fi
-         done
-      }
-
-      # completion for cdremote and git-open-remote - list remotes with a pattern
-      _list_remotes_completion() {
-         local cur="${COMP_WORDS[COMP_CWORD]}"
-         _list_remotes "$1"
-         COMPREPLY=(`compgen -W "${GIT_REMOTES[*]}" -- "$cur"`)
-         unset GIT_REMOTES
-      }
-
-      # completion for cdremote - list remotes with directories as URLs
-      _cdremote_complete() {
-         _list_remotes_completion '^\(file:/\|/\|\.\./\)' # (file:/ or / or ../ at the beginning)
-         if [ ${#COMPREPLY[*]} -eq 0 ]; then
-            _list_remotes_completion .
-         fi
-      }
-
-      complete -F _cdremote_complete cdremote
-
-      # completion for git-open-remote - list remotes with http(s) URLs
-      _git_open_remote() {
-         _list_remotes_completion '^http\(s\)\?://'
-         if [ ${#COMPREPLY[*]} -eq 0 ]; then
-            _list_remotes_completion .
-         fi
-      }
-
-      complete -F _git_open_remote git-open-remote
-   fi
+        fi
+        path="$(git worktree list | grep -F "$1" | awk '{print $1}')"
+        if [ -n "$path" ]; then
+            cd "$path"
+        else
+            echo "Cannot find path for branch '$1'" >&2
+            return 1
+        fi
+    }
 fi
 
-
 include() {
-   cfg="$1"
-   shift
-   if [ -f "./$cfg" -a -r "./$cfg" ]; then
-      echo "Reading config file \`$cfg'" 1>&2
-      . "./$cfg" "$@"
-   elif [ -f "$HOME/lib/config/$cfg" -a -r "$HOME/lib/config/$cfg" ]; then
-      echo "Reading config file \`$HOME/lib/config/$cfg'" 1>&2
-      . "$HOME/lib/config/$cfg" "$@"
-   else
-      echo "Cannot find config file \`$cfg'" 1>&2
-   fi
+    cfg="$1"
+    shift
+    if [ -f "./$cfg" -a -r "./$cfg" ]; then
+        echo "Reading config file \`$cfg'" 1>&2
+        . "./$cfg" "$@"
+    elif [ -f "$HOME/lib/config/$cfg" -a -r "$HOME/lib/config/$cfg" ]; then
+        echo "Reading config file \`$HOME/lib/config/$cfg'" 1>&2
+        . "$HOME/lib/config/$cfg" "$@"
+    else
+        echo "Cannot find config file \`$cfg'" 1>&2
+    fi
 }
 
 
+[ "`type -t mc`" = alias ] && unalias mc
 mc() {
-   if test -n "$BASH_VERSION"; then
-      MC_SAVE_OPS1="$OPS1"
-      if [ "`type -t short_curdir`" = function ]; then
-         OPS1="\`cgmem_which_prompt\`\u@\${HOSTNAME::5}:\`short_curdir\`"
-         if test -x /usr/bin/git >/dev/null 2>&1; then
-            if [ "`type -t __git_ps1`" = function ]; then
-               OPS1+="\$(__git_ps1)"
-            else
-               OPS1+="\$(prompt_git)"
-            fi
-         fi
-         OPS1+=" \$SHLVL\\$ "
-      else
-         OPS1="\u@\h:\W \$SHLVL\\$ "
-      fi
-   fi
-
-   if [ -n "$SLOWTERM" ]; then
-      MC_SLOW="--slow"
-   fi
-
-   case "$TERM" in
-      screen*) # screen, screen.rxvt
-         MC_XTERM="-x"
-      ;;
-   esac
-
-   #TMPDIR="$HOME"/tmp
-   #export TMPDIR
-
-   MC_FOUND=NO
-
-   for wrapper in \
-         /usr/local/share/mc/bin/mc-wrapper.sh \
-         /usr/local/libexec/mc/mc-wrapper.sh \
-         /usr/share/mc/bin/mc-wrapper.sh; do
-      if [ -r $wrapper ]; then
-         . $wrapper $MC_SLOW $MC_XTERM "$@"
-         rc=$?
-         MC_FOUND=YES
-         break
-      fi
-   done
-
-   if [ $MC_FOUND = NO ]; then
-      for mc in /usr/local/bin/mc /usr/bin/mc; do
-         if [ -x $mc ]; then
-            MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER"
-            if [ ! -d MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER" ]; then
-               MC_TMP_DIR="${TMPDIR-/tmp}"
-            fi
-            MC_PWD_FILE="$MC_TMP_DIR/mc.pwd.$$"
-            mc_type="`mc_type.py $mc`"
-            if [ "$mc_type" = old ]; then
-               $mc -P $MC_SLOW $MC_XTERM "$@" > "$MC_PWD_FILE"
-            elif [ "$mc_type" = new ]; then
-               $mc -P "$MC_PWD_FILE" $MC_SLOW $MC_XTERM "$@"
-            else
-               continue
-            fi
+    if [ -n "$SLOWTERM" ]; then
+        MC_SLOW="--slow"
+    fi
+
+    case "$TERM" in
+        screen*) # screen, screen.rxvt
+            MC_XTERM="-x"
+        ;;
+    esac
+
+    #TMPDIR="$HOME"/tmp
+    #export TMPDIR
+
+    MC_FOUND=NO
+
+    for wrapper in \
+            /usr/local/share/mc/bin/mc-wrapper.sh \
+            /usr/local/libexec/mc/mc-wrapper.sh \
+            /usr/share/mc/bin/mc-wrapper.sh; do
+        if [ -r $wrapper ]; then
+            . $wrapper $MC_SLOW $MC_XTERM "$@"
             rc=$?
             MC_FOUND=YES
-            cd "`cat \"$MC_PWD_FILE\"`" && /bin/rm "$MC_PWD_FILE"
             break
-         fi
-      done
-   fi
+        fi
+    done
+
+    if [ $MC_FOUND = NO ]; then
+        for mc in /usr/local/bin/mc /usr/bin/mc; do
+            if [ -x $mc ]; then
+                MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER"
+                if [ ! -d MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER" ]; then
+                    MC_TMP_DIR="${TMPDIR-/tmp}"
+                fi
+                MC_PWD_FILE="$MC_TMP_DIR/mc.pwd.$$"
+                mc_type="`mc_type.py $mc`"
+                if [ "$mc_type" = old ]; then
+                    $mc -P $MC_SLOW $MC_XTERM "$@" > "$MC_PWD_FILE"
+                elif [ "$mc_type" = new ]; then
+                    $mc -P "$MC_PWD_FILE" $MC_SLOW $MC_XTERM "$@"
+                else
+                    continue
+                fi
+                rc=$?
+                MC_FOUND=YES
+                cd "`cat \"$MC_PWD_FILE\"`" && /bin/rm "$MC_PWD_FILE"
+                break
+            fi
+        done
+    fi
 
-   if [ $MC_FOUND = NO ]; then
-      echo "Cannot find mc-wrapper.sh or mc" >&2
-      rc=1
-   fi
+    if [ $MC_FOUND = NO ]; then
+        echo "Cannot find mc-wrapper.sh or mc" >&2
+        rc=1
+    fi
 
-   [ -n "$MC_SAVE_OPS1" ] && OPS1="$MC_SAVE_OPS1"
-   unset MC_FOUND MC_PWD_FILE MC_SAVE_OPS1 MC_SLOW MC_TMP_DIR MC_XTERM
+    unset wrapper MC_FOUND MC_PWD_FILE MC_SLOW MC_TMP_DIR MC_XTERM
 
-   return $rc
+    return $rc
 }
 
 
 mkcd() {
-   if [ $# -ne 1 ]; then
-      echo "Usage: mkcd directory_name" >&2
-   elif [ -d "$1" ]; then
-      cd "$1"
-   elif [ -e "$1" ]; then
-      echo "Error: $1 is a file" >&2
-   else
-      mkdir -p "$1" && cd "$1"
-   fi
+    if [ $# -ne 1 ]; then
+        echo "Usage: mkcd directory_name" >&2
+    elif [ -d "$1" ]; then
+        cd "$1"
+    elif [ -e "$1" ]; then
+        echo "Error: $1 is a file" >&2
+    else
+        mkdir -p "$1" && cd "$1"
+    fi
 }
 
 
 if which tmux >/dev/null 2>&1; then
-   tmux() {
-      case "$TERM" in
-         rxvt)
-            TERM=rxvt-unicode command tmux "$@"
-         ;;
-
-         *)
-            command tmux "$@"
-         ;;
-      esac
-   }
+    tmux() {
+        case "$TERM" in
+            rxvt)
+                TERM=rxvt-unicode command tmux "$@"
+            ;;
+
+            *)
+                command tmux "$@"
+            ;;
+        esac
+    }
 fi
 
 
+vim() {
+    command vim "$@"
+    rc=$?
+    cd "`cat \"$HOME/tmp/vim/cwd\"`" && /bin/rm "$HOME/tmp/vim/cwd" &&
+    return $rc
+}
+
+
 if [ "$SHLVL" -eq 1 ] && which startx >/dev/null 2>&1; then
-   X() { startx >> .Xserver.log 2>&1; cyr; rm -f .Xauthority; }
+    X() { startx >> .Xserver.log 2>&1; cyr; /bin/rm -f .Xauthority; }
 fi
 
 x() { exit; }
index 5549c67560abfd25afbf88aef71f08f02bf91f4a..87190ba8ea505231b545fe0c5059e7d8b0fe849b 100644 (file)
@@ -18,7 +18,7 @@ set shiftwidth=2 softtabstop=2
 if expand("%:t") == "bookmarks.html"
    setlocal textwidth=0
    call SetNoWrap()
-   nmap \h G6k6dd1G0
+   nmap \h :%s!</meta>!!<CR>G6k6dd1G0
 else
    setlocal textwidth=78
 endif
diff --git a/.vim/ftplugin/javascript.vim b/.vim/ftplugin/javascript.vim
new file mode 100644 (file)
index 0000000..5887068
--- /dev/null
@@ -0,0 +1,5 @@
+if exists("b:did_ftplugin")
+   finish
+endif
+
+runtime! ftplugin/programming_lang.vim
index f207edcb9da4a41c1bcc873e9dd332d304959309..89effd96a1f1d1f8dd8533f34e3dd6efae731cbb 100644 (file)
@@ -12,6 +12,3 @@ if has("iconv") && !exists('b:encoding_set')
 endif
 
 setlocal textwidth=72
-
-" SpamCop reports - goto the 9th line and start a browser
-nmap <Esc>z 9G3<Bar>,b
diff --git a/.vim/ftplugin/programming_lang.vim b/.vim/ftplugin/programming_lang.vim
new file mode 100644 (file)
index 0000000..b05efc9
--- /dev/null
@@ -0,0 +1,4 @@
+" Settings common to all programming languages
+
+setlocal formatoptions-=t formatoptions+=croql
+setlocal shiftwidth=4 softtabstop=4
index 95333e6f57c50e17a8768bff14d08f1cdc99be45..3037539de83f862a1572db3beaadb127c498e4b3 100644 (file)
@@ -17,9 +17,8 @@ if has("iconv") && !exists('b:encoding_set')
    endif
 endif
 
-setlocal formatoptions-=t formatoptions+=croql
+runtime! ftplugin/programming_lang.vim
 setlocal keywordprg=pydoc
-setlocal shiftwidth=4 softtabstop=4
 compiler python
 
 if has("unix")
@@ -44,3 +43,6 @@ function! SavePython()
       endif
    endif
 endfunction
+
+" Avoid double indent. See https://stackoverflow.com/a/62348570/7976758
+let g:pyindent_open_paren=shiftwidth()
diff --git a/.vim/ftplugin/sh.vim b/.vim/ftplugin/sh.vim
new file mode 100644 (file)
index 0000000..5887068
--- /dev/null
@@ -0,0 +1,5 @@
+if exists("b:did_ftplugin")
+   finish
+endif
+
+runtime! ftplugin/programming_lang.vim
diff --git a/.vim/ftplugin/sshconfig.vim b/.vim/ftplugin/sshconfig.vim
new file mode 100644 (file)
index 0000000..453ce82
--- /dev/null
@@ -0,0 +1 @@
+setlocal shiftwidth=4 softtabstop=4
diff --git a/.vim/plugin/text.vim b/.vim/plugin/text.vim
new file mode 100644 (file)
index 0000000..77990ed
--- /dev/null
@@ -0,0 +1,12 @@
+function! SearchConflictMarkers()
+   normal /<<<<<<<\|=======\||||||||\|>>>>>>>
+endfunction
+
+function! StripTrailingSpaces()
+    %s/ \+$//
+endfunction
+
+function! SqueezeEmptyLines()
+    " Replace multiple consecutive empty lines with just one
+    %s/\n\{3,\}/\r\r/
+endfunction
index 036aef83fe4ada4861833f8c6ba1d4388104b9b3..d2681e8c7b2ed1d18757187d00acc4107dd8ee79 100644 (file)
@@ -1,71 +1,81 @@
 # From http://slobin.pp.ru/vim/_vimrc.html
 # Adapted to python3 by Oleg Broytman <phd@phdru.name>
 
-import sys, rlcompleter, unicodedata, vim
-from itertools import *
+from itertools import count
+import rlcompleter
+import sys
+import unicodedata
+
+import vim
+
+
 vim_complete = rlcompleter.Completer().complete
 
+
 def vim_comp_list():
-  """Implementation of CompList() function"""
-  arglead = vim.eval("a:ArgLead")
-  fence = int(vim.eval("match(a:ArgLead, '\(\w\|\.\)*$')"))
-  left, right = arglead[:fence], arglead[fence:]
-  try:
-    completions = (vim_complete(right, i) for i in count())
-    candidates = list(takewhile(bool, completions))
-  except NameError:
-    candidates = []
-  suggestions = [left + x for x in candidates]
-  vim.command("return " + repr(suggestions))
+    """Implementation of CompList() function"""
+    arglead = vim.eval("a:ArgLead")
+    fence = int(vim.eval("match(a:ArgLead, '\\(\\w\\|\\.\\)*$')"))
+    left, right = arglead[:fence], arglead[fence:]
+    try:
+        completions = (vim_complete(right, i) for i in count())
+        candidates = list(takewhile(bool, completions))
+    except NameError:
+        candidates = []
+    suggestions = [left + x for x in candidates]
+    vim.command("return " + repr(suggestions))
+
 
 def vim_calc(command):
-  """Implementation of :Calc command"""
-  global _
-  try:
-    result = eval(command)
-  except SyntaxError:
-    if sys.version_info[0] == 2:
-      exec(command in globals(), locals())
+    """Implementation of :Calc command"""
+    global _
+    try:
+        result = eval(command)
+    except SyntaxError:
+        if sys.version_info[0] == 2:
+            exec(command in globals(), locals())
+        else:
+            exec(command, globals(), locals())
     else:
-      exec(command, globals(), locals())
-  else:
-    if result != None:
-      print(result)
-      _ = result
-      xx = ''.join(['\\x%02x' % ord(x) for x in str(_)])
-      vim.command('let @" = "%s"' % xx)
+        if result is not None:
+            print(result)
+            _ = result
+            xx = ''.join(['\\x%02x' % ord(x) for x in str(_)])
+            vim.command('let @" = "%s"' % xx)
+
 
 def vim_pydo(command):
-  """Implementation of :Pydo command"""
-  codeobj = compile(command, "command", "eval")
-  line1 = vim.current.range.start
-  line2 = vim.current.range.end
-  delta = 0
-  for numz in range(line1, line2+1):
-    line = vim.current.buffer[numz-delta]
-    if sys.version_info[0] == 2:
-      uline = unicode(line, vim.eval('&fileencoding'))
-    else:
-      uline = line
-    num = numz + 1
-    words = line.split()
-    result = eval(codeobj, globals(), locals())
-    if result is None or result is False:
-      del vim.current.buffer[numz-delta]
-      delta += 1
-      continue
-    if isinstance(result, list) or isinstance(result, tuple):
-      result = " ".join(map(str, result))
-    else:
-      result = str(result)
-    vim.current.buffer[numz-delta] = result
+    """Implementation of :Pydo command"""
+    codeobj = compile(command, "command", "eval")
+    line1 = vim.current.range.start
+    line2 = vim.current.range.end
+    delta = 0
+    for numz in range(line1, line2+1):
+        line = vim.current.buffer[numz-delta]
+        if sys.version_info[0] == 2:
+            uline = line.decode(vim.eval('&fileencoding'))
+        else:
+            uline = line
+        num = numz + 1
+        words = line.split()
+        result = eval(codeobj, globals(), locals())
+        if result is None or result is False:
+            del vim.current.buffer[numz-delta]
+            delta += 1
+            continue
+        if isinstance(result, list) or isinstance(result, tuple):
+            result = " ".join(map(str, result))
+        else:
+            result = str(result)
+        vim.current.buffer[numz-delta] = result
+
 
 def vim_unicode_name():
-  try:
-    char = vim.eval("matchstr(getline('.'), '.', col('.') - 1)")
-    if sys.version_info[0] == 2:
-        print(unicodedata.name(char.decode(vim.eval("&encoding"))))
-    else:
-        print(unicodedata.name(char))
-  except (AttributeError, ValueError) as target:
-    print("%s: %s" % (target.__class__.__name__, target))
+    try:
+        char = vim.eval("matchstr(getline('.'), '.', col('.') - 1)")
+        if sys.version_info[0] == 2:
+            print(unicodedata.name(char.decode(vim.eval("&encoding"))))
+        else:
+            print(unicodedata.name(char))
+    except (AttributeError, ValueError) as target:
+        print("%s: %s" % (target.__class__.__name__, target))
index 078a0f8c54d226df0b28035a36a4bc140e38f930..ed46739fb6774130b760abc3caef0a0017d711a5 100644 (file)
@@ -1,10 +1,25 @@
-import sys, os
+import sys, os  # noqa: E401 multiple imports on one line
 
 virtualenv_dir = os.environ.get('VIRTUAL_ENV')
 if virtualenv_dir:
-    sys.path.insert(0, virtualenv_dir)
-    activate_this = os.path.join(virtualenv_dir, 'bin', 'activate_this.py')
-    if sys.version_info[0] == 2:
-        execfile(activate_this, dict(__file__=activate_this))
-    else:
-        exec(open(activate_this, 'r').read(), dict(__file__=activate_this))
+    if (
+        (sys.version_info[0] == 2)
+            and os.path.exists(
+                os.path.join(virtualenv_dir, 'lib', 'python2.7'))
+    ) or (
+        not os.path.exists(
+                os.path.join(virtualenv_dir, 'lib', 'python2.7'))
+    ):
+        for activate_this in [
+            os.path.join(virtualenv_dir, 'bin', 'activate_this.py'),
+            os.path.join(virtualenv_dir, 'Scripts', 'activate_this.py')
+        ]:
+            if not os.path.exists(activate_this):
+                continue
+            if sys.version_info[0] == 2:
+                execfile(activate_this,  # noqa: F821 undefined name 'execfile'
+                         dict(__file__=activate_this))
+            else:
+                exec(open(activate_this, 'r').read(),
+                     dict(__file__=activate_this))
+            break
diff --git a/.vimrc b/.vimrc
index 19b63289e72cb20ea35bebd0771015fc71ac503c..dfa434f64368f0e1a38dfcbad764e274ce502aa9 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -523,10 +523,12 @@ endfunction
 nmap \b :call ExtractOpenURL('')<CR>
 nmap \w :call ExtractOpenURL('-n')<CR>
 nmap \t :call ExtractOpenURL('-t')<CR>
+nmap \p :call ExtractOpenURL('-p')<CR>
 " Send visual block to a browser
 vmap \b ""y:call OpenURL('<C-R>"', '')<CR>
 vmap \w ""y:call OpenURL('<C-R>"', '-n')<CR>
 vmap \t ""y:call OpenURL('<C-R>"', '-t')<CR>
+vmap \p ""y:call OpenURL('<C-R>"', '-p')<CR>
 " Encode and send visual block to a browser
 vmap \B ""y:call EncodeOpenURL('<C-R>"', '')<CR>
 vmap \W ""y:call EncodeOpenURL('<C-R>"', '-n')<CR>
@@ -590,13 +592,13 @@ function! W()
          execute 'set fileencoding=' . e
          w
          break
-      catch /E513: write error, conversion failed/
+      catch /E513: [Ww]rite error, conversion failed/
          continue
       endtry
    endfor
 
    if &modified
-      throw '"' . expand('%') . '" E513: write error, conversion failed; tried ' . join(encodings, ',')
+      throw '"' . expand('%') . '" E513: Write error, conversion failed; tried ' . join(encodings, ',')
    elseif has("spell")
       call SetupSpell()
    endif
@@ -856,5 +858,7 @@ if v:version >= 800
    call timer_start(500, 'SetLazyRedraw')
 endif
 
+autocmd VimLeave * call writefile([getcwd()], expand('~/tmp/vim/cwd'))
+
 " This has to go to the very end of ~/.vimrc to allow reading the .vimrc
 set secure        " safer working with script files in the current directory
index eb152c933d7c369d68685166c8c5d26f5cf3da7d..903a58b8bbaefd02d04a141006f268d7619307b7 100644 (file)
@@ -2,10 +2,26 @@ cgmem_which_prompt() {
    local _cgmem_which
    _cgmem_which="`cgmem_which 2>/dev/null`"
    if [ -n "$_cgmem_which" ]; then
-      echo "[$_cgmem_which] "
+      _cgmem_which=" $_cgmem_which"
    fi
+   echo "$_cgmem_which"
 }
 
+last_cmd_status() {
+    local _last_status=$?
+    if [ $_last_status -eq 0 ]; then
+        echo '+'
+    elif [ $_last_status -ge 1 ]; then
+        echo '-'
+    else
+        echo '?'
+    fi
+}
+
+# Cut directories to 20% of the terminal width; add space for 3 dots
+_DIR_LENGTH=`awk "END { print int(0.2 * ${COLUMNS:-80}) }" </dev/null`
+_DIR_LENGTH_DOTS=`expr $_DIR_LENGTH + 3`
+
 short_curdir() {
    if [ "$PWD" = / ]; then
       echo /
@@ -17,8 +33,8 @@ short_curdir() {
    fi
    local _short_curdir
    _short_curdir="${PWD##*/}" # cut all directories, get base name
-   if [ "${#_short_curdir}" -gt 18 ]; then
-      _short_curdir="${_short_curdir::15}..." # cut long string
+   if [ "${#_short_curdir}" -gt $_DIR_LENGTH_DOTS ]; then
+      _short_curdir="${_short_curdir::$_DIR_LENGTH}..." # cut long string
    fi
    echo "${_short_curdir}"
 }
@@ -27,6 +43,16 @@ short_curdir() {
 # https://github.com/necolas/dotfiles/blob/master/shell/bash_prompt and
 # https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
 
+_recurse_submodules() {
+    local command="$@"
+    local output="$($command 2>/dev/null)"
+    if [ -n "$output" ]; then
+        echo -n "$output"
+        return
+    fi
+    git submodule --quiet foreach $command 2>/dev/null
+}
+
 prompt_git() {
     local s=""
     local branchName=""
@@ -41,22 +67,22 @@ prompt_git() {
             #git update-index --really-refresh -q &>/dev/null
 
             # check for unstaged changes
-            if [ -n "$(git ls-files --modified)" ]; then
+            if [ -n "$(_recurse_submodules git ls-files --modified :/)" ]; then
                 s="$s*";
             fi
 
             # check for uncommitted changes in the index
-            if ! $(git diff --quiet --ignore-submodules --cached); then
+            if [ -n "$(_recurse_submodules git diff --ignore-submodules --cached)" ]; then
                 s="$s+";
             fi
 
             # check for stashed files
-            if $(git rev-parse --verify refs/stash &>/dev/null); then
+            if [ -n "$(_recurse_submodules git rev-parse --verify refs/stash)" ]; then
                 s="$s$";
             fi
 
             # check for untracked files
-            if [ -n "$(git ls-files --others --exclude-standard)" ]; then
+            if [ -n "$(_recurse_submodules git ls-files --others --exclude-standard :/)" ]; then
                 s="$s%";
             fi
 
@@ -69,6 +95,20 @@ prompt_git() {
                       git rev-parse --short HEAD 2> /dev/null || \
                       printf "(unknown)")"
 
+        up=`git rev-parse --abbrev-ref @{u} 2>/dev/null`
+        if [ -n "$up" -a "$up" != "@{u}" ]; then
+            local left right
+            set -- `git rev-list --count --left-right @{u}...HEAD`
+            left=$1
+            right=$2
+            if [ "$left" -gt 0 ]; then
+                s="$s-$left"
+            fi
+            if [ "$right" -gt 0 ]; then
+                s="$s+$right"
+            fi
+        fi
+
         [ -n "$s" ] && s=" $s"
         printf " (%s)" "$branchName$s"
     fi
@@ -87,37 +127,37 @@ prompt_git() {
 #   fi
 #fi
 
-set_prompts() {
-      OPS1=''
+set_prompt() {
+      PS1=''
+      local _SHORT_PROMPT='[\A`cgmem_which_prompt`] \u@${HOSTNAME::5}:`short_curdir`'
       # display the user, host and current working directory
       # in the terminal title
       case "$TERM" in
          *rxvt*|screen*|*term*|vt100)
-            OPS1+="\[\033]0;${debian_chroot:+($debian_chroot)}\u@\h:\w\007\]"
+            PS1+="\033]0;${debian_chroot:+($debian_chroot)}\u@\h:\w\007" # Set xterm title/icon
             case "$TERM" in
                screen*)
-                  OPS1+="\[\033k${debian_chroot:+($debian_chroot)}"
-                  OPS1+="\u@\h:\w\033\\\\\]" # Set screen/tmux caption
+                  PS1+="\033P${PS1}\033\\\\" # Set xterm title/icon under screen/tmux
+                  if [ -z "$MC_SID" ]; then
+                     PS1+="\033k${_SHORT_PROMPT}\033\\\\" # Set screen/tmux caption
+                  fi
                ;;
             esac
          ;;
-
-         *)
-            OPS1=""
-         ;;
       esac
 
-   OPS1+="${debian_chroot:+($debian_chroot)}"
-   OPS1+="\`cgmem_which_prompt\`\u@\${HOSTNAME::5}:\`short_curdir\`"
+   # This is for .screenrc: shelltitle "\$ |$SHELL"
+   #PS1+='\033k\033\\'
+
+   PS1="\[$PS1\]"
+   PS1+='${debian_chroot:+($debian_chroot)}'
+   PS1+=${_SHORT_PROMPT}
    if test -x /usr/bin/git >/dev/null 2>&1; then
       #if [ "`type -t __git_ps1`" = function ]; then
-      #   OPS1+="\$(__git_ps1)"
+      #   PS1+='$(__git_ps1)'
       #else
-         OPS1+="\$(prompt_git)"
+         PS1+='$(prompt_git)'
       #fi
    fi
-   # This is for .screenrc: shelltitle "\$ |$SHELL"
-   #OPS1+="\[\033k\033\\\\\]"
-   OPS1+=" \$SHLVL\\$ "
-   export OPS1
+   PS1+=' $SHLVL\$ '
 }
index f7fddbd46599faddd01845f16a686dafe973657b..2f00d89b2975180179c78681d873d7e66db3d663 100755 (executable)
@@ -1,71 +1,68 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
+from urllib.parse import urlsplit, parse_qsl, quote, quote_plus, urlencode
+from urllib.request import urlretrieve
+import os
+import socket
 import sys
-url = sys.argv[1]
-
-import urllib
-urllib._urlopener = urllib.FancyURLopener()
-
-from cgi import parse_qsl
-from m_lib.defenc import default_encoding
+import urllib.request
 
-protocol, request = urllib.splittype(url)
-user, password, port = None, None, None
-host, path = urllib.splithost(request)
-if host:
-   user, host = urllib.splituser(host)
-   if user:
-      user, password = urllib.splitpasswd(user)
-   host, port = urllib.splitport(host)
-   if port: port = int(port)
-path, tag = urllib.splittag(path)
-path, query = urllib.splitquery(path)
-path = urllib.unquote(path)
-if tag: tag = urllib.unquote_plus(tag)
+url = sys.argv[1]
 
-if query:
-   qlist = []
-   for name, value in parse_qsl(query):
-       qlist.append((name, value))
+split_results = urlsplit(url)
+protocol, netloc, path, query, tag = split_results
+user = split_results.username
+password = split_results.password
+host = split_results.hostname
+port = split_results.port
+qlist = parse_qsl(query)
 
 url = protocol + "://"
 if user:
-   url += urllib.quote(user)
-   if password:
-      url += ':' + urllib.quote(password)
-   url += '@'
+    url += quote(user)
+    if password:
+        url += ':' + quote(password)
+    url += '@'
 if host:
-   url += host.decode(default_encoding).encode('idna')
-   if port:
-      url += ':%d' % port
+    host = host.encode('idna').decode('ascii')
+    url += host
+    if port:
+        url += ':%d' % port
 if path:
-   if protocol == "file":
-      url += urllib.quote(path)
-   else:
-      url += urllib.quote(path)
+    if protocol == "file":
+        url += quote(path)
+    else:
+        url += quote(path)
 if query:
-   url += '?' + urllib.urlencode(qlist)
+    url += '?' + urlencode(qlist)
 if tag:
-   url += '#' + urllib.quote_plus(tag)
+    url += '#' + quote_plus(tag)
 
 # I remember seeing some sites that return broken HTML or even HTTP response
 # without "compatible" user agent; I don't know if such sites are still around,
 # but this header doesn't cause any harm so I'd better continue to use it.
 # UPDATE: I saw a number of sites that forbid "Mozilla compatible"
-server_version = "Python-urllib/%s" % urllib.__version__
-urllib._urlopener.addheaders[0] = ('User-agent', server_version)
-urllib._urlopener.addheaders.append(('Accept-Charset', "koi8-r;q=1.0"))
+urllib_version = urllib.request.__version__
+server_version = "Python-urllib/%s" % urllib_version
 
-import os
-dest_file = os.path.basename(url)
 
+class MyURLopener(urllib.request.URLopener):
+    def open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
+        return urllib.request.URLopener.open(self, fullurl, data)
+
+
+_urlopener = urllib.request._opener = MyURLopener()
+_urlopener.addheaders[0] = ('User-agent', server_version)
+_urlopener.addheaders.append(('Accept-Charset', "koi8-r;q=1.0"))
+
+dest_file = os.path.basename(url)
 if not dest_file:
-   dest_file = "_index.html"
+    dest_file = "_index.html"
 
-filename, headers = urllib.urlretrieve(url, dest_file)
+filename, headers = urlretrieve(url, filename=dest_file)
 
-if headers.has_key("last-modified"):
-   from m_lib.net.www.util import parse_time
-   last_modified = parse_time(headers["last-modified"])
-   if last_modified:
-      os.utime(dest_file, (last_modified, last_modified))
+if "last-modified" in headers:
+    from m_lib.net.www.util import parse_time
+    last_modified = parse_time(headers["last-modified"])
+    if last_modified:
+        os.utime(dest_file, (last_modified, last_modified))
index c7b376403f5ded4aff11fedcb2d4916fad29d270..6c0e5f7eb0d3bd30dddf2ad7d64dd8b2608fb5ff 100755 (executable)
@@ -1,61 +1,57 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
+from http.client import HTTPConnection, HTTPSConnection
+from urllib.parse import urlsplit, parse_qsl, urlencode, quote, quote_plus
 import sys
-url = sys.argv[1]
-
-import socket
-socket.setdefaulttimeout(30)
+import urllib.request
 
-from cgi import parse_qsl
-import urllib
-from m_lib.defenc import default_encoding
+url = sys.argv[1]
 
-protocol, request = urllib.splittype(url)
-user, password, port = None, None, None
-host, path = urllib.splithost(request)
+split_results = urlsplit(url)
+protocol, netloc, path, query, tag = split_results
+user = split_results.username
+password = split_results.password
+host = split_results.hostname
+port = split_results.port
+qlist = parse_qsl(query)
+
+url = protocol + "://"
+if user:
+    url += quote(user)
+    if password:
+        url += ':' + quote(password)
+    url += '@'
 if host:
-   user, host = urllib.splituser(host)
-   if user:
-      user, password = urllib.splitpasswd(user)
-   host, port = urllib.splitport(host)
-   if port: port = int(port)
-path, tag = urllib.splittag(path)
-path, query = urllib.splitquery(path)
-path = urllib.unquote(path)
-if tag: tag = urllib.unquote_plus(tag)
-
-if query:
-   qlist = []
-   for name, value in parse_qsl(query):
-       qlist.append((name, value))
-
-url = ''
-host = host.decode(default_encoding).encode('idna')
+    host = host.encode('idna').decode('ascii')
+    url += host
+    if port:
+        url += ':%d' % port
 if path:
-   url += urllib.quote(path)
+    if protocol == "file":
+        url += quote(path)
+    else:
+        url += quote(path)
 if query:
-   url += '?' + urllib.urlencode(qlist)
+    url += '?' + urlencode(qlist)
 if tag:
-   url += '#' + urllib.quote_plus(tag)
+    url += '#' + quote_plus(tag)
 
-import httplib
-server = httplib.HTTP(host, port)
+if protocol == "https":
+    server = HTTPSConnection(host, port)
+else:
+    server = HTTPConnection(host, port)
 server.set_debuglevel(1)
-
 server.putrequest("HEAD", path)
-if port:
-    server.putheader("Host", '%s:%d' % (host, port))
-else:
-   server.putheader("Host", host)
 
 # I remember seeing some sites that return broken HTML or even HTTP response
 # without "compatible" user agent; I don't know if such sites are still around,
 # but this header doesn't cause any harm so I'd better continue to use it.
 # UPDATE: I saw a number of sites that forbid "Mozilla compatible"
-client_version = "Python-urllib/%s" % urllib.__version__
+urllib_version = urllib.request.__version__
+client_version = "Python-urllib/%s" % urllib_version
 server.putheader('User-agent', client_version)
 
 server.putheader('Accept-Charset', "koi8-r;q=1.0")
 server.endheaders()
 
-server.getreply()
+server.getresponse()
index 92dbf74bc7098d59b354466581bba74969b8c0a5..63ae4dc8646df5e1cbfb293e56284694a6588e1f 100755 (executable)
@@ -3,8 +3,9 @@
 # A kind of pkill/killall
 if [ -z "$1" -o -n "$3" ]; then
    echo "Usage: KillAll [-signal] proc_regexp" >&2
-   return 1
+   exit 1
 fi
+
 if [ -z "$2" ]; then
    kill `pidOf "$1"`
 else
diff --git a/bin/PS b/bin/PS
index 67574b554436acdc20ac245993d489be5183fd0c..7fbd8b1cfb3b2b75c1303a2ad543af0f66f56f66 100755 (executable)
--- a/bin/PS
+++ b/bin/PS
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
 import sys, os
 
@@ -13,5 +13,5 @@ if pager == 'less':
     opt = 'S'
     if opt not in less:
         less = opt + less
-    os.environ["LESS"] = less
+        os.environ["LESS"] = less
 os.system("ps %s | %s" % (args, pager))
index 9dbfebe2678c526c5694ed0901ad4a45295378b1..cbda1c82a5aabe17b3ade882ca89264f923e3353 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
 import sys, os
 print(os.path.abspath(sys.argv[1]))
index 0deb3900ccca36acadd3df6ae035062b9420b0b7..7120479aa70acf5486adbcaf0b0bf1756b262d8f 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
 from __future__ import print_function
 import sys, os
index 94e6c607fa8700fb20351b8e794e0c1249667537..7018dc6527e69a4b33676a0e3862c537411c3b64 100644 (file)
@@ -4,7 +4,7 @@ browser_stack = os.path.expanduser('~/.cache/browser-stack')
 
 def get_stack():
     try:
-        with open(browser_stack, 'rU') as stack_file:
+        with open(browser_stack, 'r') as stack_file:
             return stack_file.readlines()
     except IOError: # No such file
         return []
@@ -19,4 +19,5 @@ def save_stack(stack):
 def set_current_browser():
     stack = get_stack()
     if stack:
-        os.environ['BROWSER'] = stack[0].strip()
+        os.environ['BROWSER'] = browser = stack[0].strip()
+        return browser
index 212ec3ca4ec953773f4e1385bd50b9525276a0d9..aa8eecc0e1e20b15cf8e2b1c6c7b1e25d1b920ff 100755 (executable)
@@ -16,7 +16,7 @@ esac
 size="$1" # in megabytes
 shift
 
-CGROUPS=/sys/fs/cgroup
+CGROUPS=/sys/fs/cgroup/memory
 echo $$ > "$CGROUPS"/${size}M/tasks || exit 1
 
 ulimit -d ${size}000
index 81ef03f8331071f4a315658c52f03c843c58e4d9..ed03705eb3ca4af789763c4436e1ccb17e2411f8 100755 (executable)
@@ -1,2 +1,2 @@
 #! /bin/sh
-grep -Flw $$ /sys/fs/cgroup/*/tasks | cut -d/ -f5
+grep -Flw $$ /sys/fs/cgroup/memory/*M/tasks | cut -d/ -f6
diff --git a/bin/cgmn b/bin/cgmn
new file mode 120000 (symlink)
index 0000000..48c5ae3
--- /dev/null
+++ b/bin/cgmn
@@ -0,0 +1 @@
+cgmem_nice
\ No newline at end of file
index c977312b8d06eec9a90b121868c04edfd35fcc3b..a517e966996bc62f95ef7d8111a081252c3e5553 100755 (executable)
@@ -7,7 +7,7 @@ fi
 
 for fname in "$@"; do
 
-   newname=$(echo "$fname" | sed -e "
+    newname=$(echo "$fname" | sed -e "
 s/[‘“’”‘“’”″′«»\`\"]/'/g
 s/ *: */ - /g
 s/[–—]/-/g
@@ -17,10 +17,11 @@ s/\?//g
 s/№/N/g
 ")
 
-   if [ "$fname" \!= "$newname" ]; then
-      echo "$fname"
-      echo "$newname"
-      mv -- "$fname" "$newname"
-      echo
-   fi
+    newname="$(unicode_norm_nfd.py "$newname")"
+    if [ "$fname" \!= "$newname" ]; then
+        echo "$fname"
+        echo "$newname"
+        mv -- "$fname" "$newname"
+        echo
+    fi
 done
index 427cd6db22a3b055827591930c8ea6104f338c02..3f8213d2d92cd638d66f9e583f1c2def14dbbe75 100755 (executable)
@@ -16,7 +16,7 @@ while getopts f:t: opt; do
 done
 shift `expr $OPTIND - 1`
 
-for dir in "$@"; do
+for dir in "${@:-.}"; do
    cleanup-filenames-recursive.sh "$dir" &&
    recode-filenames-recursive.py "$from_enc" "$to_enc" "$dir" || exit 1
 done
index 37cc0ff5bae45afd699b0e37c6ca984a08d5ebab..800e119ab5627f8dd6423cb6cf61001eb81a8205 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 """cmp.py: compare two files. Replace cmp because standard cmp cannot compare
 large files.
 """
@@ -6,11 +6,11 @@ large files.
 import sys, os
 
 if sys.argv[1] in ("-h", "--help"):
-   print "Broytman cmp.py 1.0, Copyright (C) 2003 PhiloSoft Design"
-   print "Usage: cmp.py [-h|--help|-V|--version] [-i] file1 file2"
+   print("Broytman cmp.py 1.0, Copyright (C) 2003-2023 PhiloSoft Design")
+   print("Usage: cmp.py [-h|--help|-V|--version] [-i] file1 file2")
    sys.exit()
 elif sys.argv[1] in ("-V", "--version"):
-   print "Broytman cmp.py 1.0, Copyright (C) 2003 PhiloSoft Design"
+   print("Broytman cmp.py 1.0, Copyright (C) 2003-2023 PhiloSoft Design")
    sys.exit()
 elif sys.argv[1] == "-i":
    show_pbar = False
@@ -31,7 +31,7 @@ if show_pbar:
    try:
       size = os.path.getsize(fname1)
    except:
-      print filename, ": no such file"
+      print(filename, ": no such file")
       sys.exit(1)
 
 if show_pbar:
@@ -62,7 +62,7 @@ while True:
       pbar.display(file1.tell())
 
    if block1 and block2:
-      if len(block1) <> len(block2):
+      if len(block1) != len(block2):
          report()
          break
    elif block1:
@@ -74,7 +74,7 @@ while True:
    else:
       break
 
-   if block1 <> block2:
+   if block1 != block2:
       report()
       break
 
index 4050467e9f4ece9e13bc0aec2eb5eba1e23250d0..da48caf1d99a6e28bba6c015f510303156c8f73f 100755 (executable)
@@ -5,5 +5,5 @@ if [ -z "$1" ]; then
    exit 1
 fi
 
-     python$PY_VER    -m compileall "$@" &&
-exec python$PY_VER -O -m compileall "$@"
+     python$PY_VER    -m compileall -x '\.tox/' -x '\.venv/' -x 'venv/' "$@"
+exec python$PY_VER -O -m compileall -x '\.tox/' -x '\.venv/' -x 'venv/' "$@"
index 88a5705f9b87f1817483c87ef71daf8d28c2b1cb..08f93244ec2735d170a937a6f3ddf98f1390e07d 100755 (executable)
@@ -1,5 +1,4 @@
-#! /usr/bin/env python
-
+#! /usr/bin/env python3
 
 import sys, os
 
index f78f33d0239ad120b0b6050f7e54729886f11d9a..70e95c83e706658fdd7d2f8cdc38378bf1315c67 100755 (executable)
@@ -1,3 +1,4 @@
 #! /bin/sh
-     python$PY_VER    -m compileall . &&
+
+     python$PY_VER    -m compileall .
 exec python$PY_VER -O -m compileall .
diff --git a/bin/cp_recode_fname b/bin/cp_recode_fname
new file mode 100755 (executable)
index 0000000..8cae733
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+set -e
+
+usage() {
+   echo "Usage: $0 [[from_enc] to_enc] filename" >&2
+   exit 1
+}
+
+if [ $# -eq 1 ]; then
+    from_enc="`python3 -c \"from m_lib.defenc import default_encoding; print(default_encoding)"`"
+    if [ "$from_enc" != utf-8 ]; then
+        to_enc=utf-8
+    else
+        usage
+    fi
+    filename="$1"
+elif [ $# -eq 2 ]; then
+    from_enc="`python3 -c \"from m_lib.defenc import default_encoding; print(default_encoding)"`"
+    to_enc="$1"
+    filename="$2"
+elif [ $# -eq 3 ]; then
+    from_enc="$1"
+    to_enc="$2"
+    filename="$3"
+else
+    usage
+fi
+
+cmd="`basename \"$0\"`"
+case "$cmd" in
+    cp_*) cmd="cp -p" ;;
+    mv_*) cmd=mv ;;
+    *)
+        echo "Uncnown command $0, aborting" >&2
+        exit 2
+    ;;
+esac
+
+filename_recoded=`echo "$filename" | iconv -f "$from_enc" -t "$to_enc"`
+exec $cmd "$filename" "$filename_recoded"
index 4d581938b9139df977b8bc2b7e0cae0b7fb4ecf0..ef04664342a87b7a5d5dc1c65045aa3399aee77d 100755 (executable)
@@ -1,12 +1,16 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
-import sys, urllib
+try:
+    from urllib.parse import unquote
+except ImportError:
+    from urllib import unquote
+import sys
 
 while True:
    url = sys.stdin.readline()
    if not url:
       break
-   unqoted = urllib.unquote(url.strip())
+   unqoted = unquote(url.strip())
    if unqoted.startswith('file://'):
        unqoted = unqoted[len('file://'):]
    print(unqoted)
index 4ffb44998588cfc87549c99c295eb103d8701725..381be9c10b19ea8fcbe78b05bc1f311ee28d1390 100755 (executable)
@@ -1,18 +1,13 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
-
-from HTMLParser import HTMLParseError
 from m_lib.net.www.html import HTMLParser as _HTMLParser
 
-
 class HTMLHeadDone(Exception): pass
 
-
 class HTMLParser(_HTMLParser):
    def end_head(self):
       raise HTMLHeadDone()
 
-
    def do_meta(self, attrs):
       http_equiv = ""
       content = ""
@@ -41,14 +36,14 @@ def parse_html(filename):
    for line in infile:
       try:
          parser.feed(line)
-      except (HTMLParseError, HTMLHeadDone):
+      except HTMLHeadDone:
          break
 
    infile.close()
 
    try:
       parser.close()
-   except (HTMLParseError, HTMLHeadDone):
+   except HTMLHeadDone:
       pass
 
    if hasattr(parser, "charset"):
index ec79c1a010d03cb827e5a3ac964d2e6a78b84b44..cdd9b6b585e01ee7ddde67f654c645ea43bc326d 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
 charset = None
 def xml_decl_handler(version, encoding, standalone):
@@ -12,7 +12,7 @@ if __name__ == '__main__':
       import xml.parsers.expat
       parser = xml.parsers.expat.ParserCreate()
       parser.XmlDeclHandler = xml_decl_handler
-      parser.ParseFile(open(sys.argv[1], 'r'))
+      parser.ParseFile(open(sys.argv[1], 'rb'))
    except:
       pass
    if charset: print(charset)
index b25e8d9905de15a638a76c50e6160abdf161dfbe..4cf59467c6de536417a0875dfe016c3201614b67 100755 (executable)
@@ -1,7 +1,12 @@
 #! /bin/sh
 
+if [ "x$1" = x-p ]; then
+    private="-p"
+    shift
+fi
+
 if [ $# -ne 1 ]; then
-   echo "Usage: git open url_key" >&2
+   echo "Usage: git open [-p] url_key" >&2
    exit 1
 fi
 
@@ -13,7 +18,9 @@ fi
 
 browser_section="`git config --get web.browser`"
 browser_cmd="`git config --get browser.\"$browser_section\".cmd`"
-if [ -z "$browser_cmd" ]; then
+if [ x"$private" = x-p ]; then
+   browser_cmd="webbrowser -p"
+elif [ -z "$browser_cmd" ]; then
    browser_cmd="webbrowser -n"
 fi
 
index 45c3a7ea8136d6ed137889cc71fa76de12921c74..9aa6a849f6e56d1b2182b478f60ec8eff37bbebd 100755 (executable)
@@ -1,5 +1,10 @@
 #! /bin/sh
 
+if [ "x$1" = x-p ]; then
+    private="-p"
+    shift
+fi
+
 if [ -z "$1" ]; then
    branch="`git rev-parse --abbrev-ref HEAD`"
    remote="`git config --get branch.$branch.remote`"
@@ -16,4 +21,4 @@ if [ -z "$remote" ]; then
    exit 1
 fi
 
-exec git-open remote.$remote.url
+exec git-open $private remote.$remote.url
index 83de413dc373ac5093e3cedfd971870676dbe6d9..9cb164fef0aa72bc6a2399d1ab4a988dd27d4c59 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 "Recode to default charset"
 
 import sys
@@ -10,19 +10,23 @@ to_charset = default_encoding
 
 options, arguments = getopt(sys.argv[1:], 'f:t:')
 for option, value in options:
-   if option == '-f':
-      from_charset = value
-   elif option == '-t':
-      to_charset = value
+    if option == '-f':
+        from_charset = value
+    elif option == '-t':
+        to_charset = value
+
+output = getattr(sys.stdout, 'buffer', sys.stdout)
+
 
 if arguments:
-   for file in arguments:
-      infile = open(file)
-      try:
-         for line in infile:
-            sys.stdout.write(line.decode(from_charset, "replace").encode(to_charset, "replace"))
-      except:
-         infile.close()
+    for file in arguments:
+        with open(file, 'rb') as infile:
+            for line in infile:
+                output.write(
+                    line.decode(from_charset, "replace").
+                    encode(to_charset, "replace"))
 else:
-   for line in sys.stdin:
-      sys.stdout.write(line.decode(from_charset, "replace").encode(to_charset, "replace"))
+    input = getattr(sys.stdin, 'buffer', sys.stdin)
+    for line in input:
+        output.write(
+            line.decode(from_charset, "replace").encode(to_charset, "replace"))
index d3c20d10ecff2ee0e5ceaec72e2943cc8ee5b782..b4c990e1aeee6e1c93dd4339ec52cbb5e035b14c 100755 (executable)
@@ -1,37 +1,38 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 "iconv wrapper"
 
-import sys
 from getopt import getopt
+import os, shutil, sys, tempfile
 
 options, arguments = getopt(sys.argv[1:], 'f:t:')
 
 from_charset = to_charset = None
 
 for option, value in options:
-   if option == '-f':
-      from_charset = value
-   elif option == '-t':
-      to_charset = value
+    if option == '-f':
+        from_charset = value
+    elif option == '-t':
+        to_charset = value
 
 
 if from_charset is None:
-   raise ValueError("you must use -f param to name source charset")
+    raise ValueError("you must use -f param to name source charset")
 
 if to_charset is None:
-   raise ValueError("you must use -t param to name destination charset")
+    raise ValueError("you must use -t param to name destination charset")
 
 
-import tempfile, os, shutil
 tempfname = "_iconvx" + tempfile.gettempprefix() + "tmp"
 
 if arguments:
-   try:
-         for file in arguments:
-            os.system("iconv.py -f '%s' -t '%s' '%s' > '%s'" % (from_charset, to_charset, file, tempfname))
+    try:
+        for file in arguments:
+            os.system(
+                "iconv.py -f '%s' -t '%s' '%s' > '%s'" % (
+                    from_charset, to_charset, file, tempfname))
             shutil.copy2(tempfname, file)
-   finally:
-      os.unlink(tempfname)
+    finally:
+        os.unlink(tempfname)
 
-else: # filter stdin => stdout
-   os.system("iconv.py -f '%s' -t '%s'" % (from_charset, to_charset))
+else:  # filter stdin => stdout
+    os.system("iconv.py -f '%s' -t '%s'" % (from_charset, to_charset))
diff --git a/bin/iconvxml.py b/bin/iconvxml.py
deleted file mode 100755 (executable)
index 2892a91..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#! /usr/bin/env python
-"Recode using XML char references"
-
-import sys
-from getopt import getopt
-from m_lib.defenc import default_encoding
-
-from_charset = "utf-8"
-to_charset = default_encoding
-
-options, arguments = getopt(sys.argv[1:], 'f:t:')
-for option, value in options:
-   if option == '-f':
-      from_charset = value
-   elif option == '-t':
-      to_charset = value
-
-if arguments:
-   for file in arguments:
-      infile = open(file)
-      try:
-         for line in infile:
-            sys.stdout.write(line.decode(from_charset, "replace").encode(to_charset, "xmlcharrefreplace"))
-      except:
-         infile.close()
-else:
-   for line in sys.stdin:
-      sys.stdout.write(line.decode(from_charset, "replace").encode(to_charset, "xmlcharrefreplace"))
index fd2c8e5984d2783554863a93a646f5efe8079241..44843ac223fa4932ba872d64b6eea889fbb2b352 100755 (executable)
@@ -1,6 +1,8 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
 import sys
+from m_lib.defenc import default_encoding
+
 l = len(sys.argv)
 
 if (l == 2) and (sys.argv[1] != '-r'):
@@ -12,9 +14,11 @@ elif (l == 3) and (sys.argv[1] == '-r'):
 else:
     sys.exit('Usage: %s [-r] name.domain' % sys.argv[0])
 
-from m_lib.defenc import default_encoding
-
 if reverse:
-    print(address.decode("idna").encode(default_encoding))
+    if not isinstance(address, bytes):
+        address = address.encode('ascii')
+    print(address.decode("idna"))
 else:
-    print(address.decode(default_encoding).encode("idna"))
+    if isinstance(address, bytes):
+        address = address.decode(default_encoding)
+    print(address.encode("idna").decode('ascii'))
index e5cd63bea5308b20bce229b7e7fe3f5654d2773a..46871001968ed74b285dc673090466340121dab0 100755 (executable)
@@ -1,10 +1,8 @@
-#! /usr/bin/env python
-
+#! /usr/bin/env python3
 
 import sys
 from m_lib.rus import rus2lat
 
-
 for line in sys.stdin:
-   if line[-1] == '\n': line = line[:-1]
-   print rus2lat.rus2lat(line)
+    if line[-1] == '\n': line = line[:-1]
+    print(rus2lat.rus2lat(line))
diff --git a/bin/l b/bin/l
index 73a04584a95cbb51493e8ba1048c4eb29c2a99a1..193d6b4ffef00627667e8964599ae7f847e22d7c 100755 (executable)
--- a/bin/l
+++ b/bin/l
@@ -1,14 +1,14 @@
 #! /bin/sh
 
 case "$TERM" in
-   *rxvt*|screen*|*term*|vt100)
-      TERM=xterm
-      export TERM
+    *rxvt*|screen*|*term*|vt100)
 
-      xtitle "links@${HOSTNAME}"
-      exec links2 "$@"
-   ;;
+        xtitle "links@${HOSTNAME}"
+             tput smcup
+             TERM=xterm links2 "$@"
+        exec tput rmcup
+    ;;
 
-   *)echo "Wrong TERM" >&2
-   ;;
+    *)echo "Wrong TERM" >&2
+    ;;
 esac
index c4ed1317e85884f424afecf25065a3b6d88611e6..9c43755353d7d3f6deb52e5f202d4ef867b19ba9 100755 (executable)
@@ -1,10 +1,8 @@
-#! /usr/bin/env python
-
+#! /usr/bin/env python3
 
 import sys
 from m_lib.rus import lat2rus
 
-
 for line in sys.stdin:
-   if line[-1] == '\n': line = line[:-1]
-   print lat2rus.lat2rus(line)
+    if line[-1] == '\n': line = line[:-1]
+    print(lat2rus.lat2rus(line))
diff --git a/bin/latin1_to_ascii.py b/bin/latin1_to_ascii.py
deleted file mode 100755 (executable)
index a2f2145..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-#! /usr/bin/env python
-
-# See http://code.activestate.com/recipes/251871/
-
-import sys, os
-
-xlate = {
-    u'\N{ACUTE ACCENT}': "'",
-    u'\N{BROKEN BAR}': '|',
-    u'\N{CEDILLA}': '{cedilla}',
-    u'\N{CENT SIGN}': '{cent}',
-    u'\N{COPYRIGHT SIGN}': '{C}',
-    u'\N{CURRENCY SIGN}': '{currency}',
-    u'\N{DEGREE SIGN}': '{degrees}',
-    u'\N{DIAERESIS}': '{umlaut}',
-    u'\N{DIVISION SIGN}': '/',
-    u'\N{FEMININE ORDINAL INDICATOR}': '{^a}',
-    u'\N{INVERTED EXCLAMATION MARK}': '!',
-    u'\N{INVERTED QUESTION MARK}': '?',
-    u'\N{LATIN CAPITAL LETTER A WITH ACUTE}': 'A',
-    u'\N{LATIN CAPITAL LETTER A WITH CIRCUMFLEX}': 'A',
-    u'\N{LATIN CAPITAL LETTER A WITH DIAERESIS}': 'A',
-    u'\N{LATIN CAPITAL LETTER A WITH GRAVE}': 'A',
-    u'\N{LATIN CAPITAL LETTER A WITH RING ABOVE}': 'A',
-    u'\N{LATIN CAPITAL LETTER A WITH TILDE}': 'A',
-    u'\N{LATIN CAPITAL LETTER AE}': 'Ae',
-    u'\N{LATIN CAPITAL LETTER C WITH CEDILLA}': 'C',
-    u'\N{LATIN CAPITAL LETTER E WITH ACUTE}': 'E',
-    u'\N{LATIN CAPITAL LETTER E WITH CIRCUMFLEX}': 'E',
-    u'\N{LATIN CAPITAL LETTER E WITH DIAERESIS}': 'E',
-    u'\N{LATIN CAPITAL LETTER E WITH GRAVE}': 'E',
-    u'\N{LATIN CAPITAL LETTER ETH}': 'Th',
-    u'\N{LATIN CAPITAL LETTER I WITH ACUTE}': 'I',
-    u'\N{LATIN CAPITAL LETTER I WITH CIRCUMFLEX}': 'I',
-    u'\N{LATIN CAPITAL LETTER I WITH DIAERESIS}': 'I',
-    u'\N{LATIN CAPITAL LETTER I WITH GRAVE}': 'I',
-    u'\N{LATIN CAPITAL LETTER N WITH TILDE}': 'N',
-    u'\N{LATIN CAPITAL LETTER O WITH ACUTE}': 'O',
-    u'\N{LATIN CAPITAL LETTER O WITH CIRCUMFLEX}': 'O',
-    u'\N{LATIN CAPITAL LETTER O WITH DIAERESIS}': 'O',
-    u'\N{LATIN CAPITAL LETTER O WITH GRAVE}': 'O',
-    u'\N{LATIN CAPITAL LETTER O WITH STROKE}': 'O',
-    u'\N{LATIN CAPITAL LETTER O WITH TILDE}': 'O',
-    u'\N{LATIN CAPITAL LETTER THORN}': 'th',
-    u'\N{LATIN CAPITAL LETTER U WITH ACUTE}': 'U',
-    u'\N{LATIN CAPITAL LETTER U WITH CIRCUMFLEX}': 'U',
-    u'\N{LATIN CAPITAL LETTER U WITH DIAERESIS}': 'U',
-    u'\N{LATIN CAPITAL LETTER U WITH GRAVE}': 'U',
-    u'\N{LATIN CAPITAL LETTER Y WITH ACUTE}': 'Y',
-    u'\N{LATIN SMALL LETTER A WITH ACUTE}': 'a',
-    u'\N{LATIN SMALL LETTER A WITH CIRCUMFLEX}': 'a',
-    u'\N{LATIN SMALL LETTER A WITH DIAERESIS}': 'a',
-    u'\N{LATIN SMALL LETTER A WITH GRAVE}': 'a',
-    u'\N{LATIN SMALL LETTER A WITH RING ABOVE}': 'a',
-    u'\N{LATIN SMALL LETTER A WITH TILDE}': 'a',
-    u'\N{LATIN SMALL LETTER AE}': 'ae',
-    u'\N{LATIN SMALL LETTER C WITH CEDILLA}': 'c',
-    u'\N{LATIN SMALL LETTER E WITH ACUTE}': 'e',
-    u'\N{LATIN SMALL LETTER E WITH CIRCUMFLEX}': 'e',
-    u'\N{LATIN SMALL LETTER E WITH DIAERESIS}': 'e',
-    u'\N{LATIN SMALL LETTER E WITH GRAVE}': 'e',
-    u'\N{LATIN SMALL LETTER ETH}': 'th',
-    u'\N{LATIN SMALL LETTER I WITH ACUTE}': 'i',
-    u'\N{LATIN SMALL LETTER I WITH CIRCUMFLEX}': 'i',
-    u'\N{LATIN SMALL LETTER I WITH DIAERESIS}': 'i',
-    u'\N{LATIN SMALL LETTER I WITH GRAVE}': 'i',
-    u'\N{LATIN SMALL LETTER N WITH TILDE}': 'n',
-    u'\N{LATIN SMALL LETTER O WITH ACUTE}': 'o',
-    u'\N{LATIN SMALL LETTER O WITH CIRCUMFLEX}': 'o',
-    u'\N{LATIN SMALL LETTER O WITH DIAERESIS}': 'o',
-    u'\N{LATIN SMALL LETTER O WITH GRAVE}': 'o',
-    u'\N{LATIN SMALL LETTER O WITH STROKE}': 'o',
-    u'\N{LATIN SMALL LETTER O WITH TILDE}': 'o',
-    u'\N{LATIN SMALL LETTER SHARP S}': 'ss',
-    u'\N{LATIN SMALL LETTER THORN}': 'th',
-    u'\N{LATIN SMALL LETTER U WITH ACUTE}': 'u',
-    u'\N{LATIN SMALL LETTER U WITH CIRCUMFLEX}': 'u',
-    u'\N{LATIN SMALL LETTER U WITH DIAERESIS}': 'u',
-    u'\N{LATIN SMALL LETTER U WITH GRAVE}': 'u',
-    u'\N{LATIN SMALL LETTER Y WITH ACUTE}': 'y',
-    u'\N{LATIN SMALL LETTER Y WITH DIAERESIS}': 'y',
-    u'\N{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}': '&lt;&lt;',
-    u'\N{MACRON}': '_',
-    u'\N{MASCULINE ORDINAL INDICATOR}': '{^o}',
-    u'\N{MICRO SIGN}': '{micro}',
-    u'\N{MIDDLE DOT}': '*',
-    u'\N{MULTIPLICATION SIGN}': '*',
-    u'\N{NOT SIGN}': '{not}',
-    u'\N{PILCROW SIGN}': '{paragraph}',
-    u'\N{PLUS-MINUS SIGN}': '{+/-}',
-    u'\N{POUND SIGN}': '{pound}',
-    u'\N{REGISTERED SIGN}': '{R}',
-    u'\N{RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK}': '&gt;&gt;',
-    u'\N{SECTION SIGN}': '{section}',
-    u'\N{SOFT HYPHEN}': '-',
-    u'\N{SUPERSCRIPT ONE}': '{^1}',
-    u'\N{SUPERSCRIPT THREE}': '{^3}',
-    u'\N{SUPERSCRIPT TWO}': '{^2}',
-    u'\N{VULGAR FRACTION ONE HALF}': '{1/2}',
-    u'\N{VULGAR FRACTION ONE QUARTER}': '{1/4}',
-    u'\N{VULGAR FRACTION THREE QUARTERS}': '{3/4}',
-    u'\N{YEN SIGN}': '{yen}'
-}
-
-def latin1_to_ascii(uinput):
-    if isinstance(uinput, bytes):
-        uinput = uinput.decode(sys.getfilesystemencoding())
-    out = []
-    for c in uinput:
-        i = ord(c)
-        if i in xlate:
-            out.append(xlate[i])
-        elif i >= 0x80:
-            pass
-        else:
-            out.append(str(c))
-    return ''.join(out)
-
-if __name__ == '__main__':
-    if len(sys.argv) == 1:
-        sys.exit('Usage: %s filename\n' % sys.argv[0])
-    for name in sys.argv[1:]:
-        plain_ascii = latin1_to_ascii(name)
-        if plain_ascii != name:
-            os.rename(name, plain_ascii)
index 70dcc2b6a56f062086fc4bd0471aeb2cd7361a53..d2e98843390068e52df3e42f8c9ae01a12eff465 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
 import sys, subprocess
 
@@ -7,19 +7,23 @@ assert mc in ['/usr/local/bin/mc', '/usr/bin/mc']
 
 mc = subprocess.Popen([mc, '--version'],
                       stdout=subprocess.PIPE,
-                      stderr=subprocess.STDOUT)
-mc.wait()
-mc_version = mc.stdout.readline()
-mc.stdout.read()
-mc.stdout.close()
+                      stderr=subprocess.PIPE,
+                      close_fds=True, env={})
+stdout, stderr = mc.communicate()
+if mc.returncode or stderr:
+    sys.exit('Error reading mc version: (%d) %s' % (mc.returncode, stderr))
 
+if not isinstance(stdout, type('')):
+    stdout = stdout.decode()
+mc_version = stdout.split('\n')[0]
 if mc_version.startswith('Midnight Commander'):
     mc_version = mc_version.split()[2]
 elif mc_version.startswith('GNU Midnight Commander') or \
      mc_version.startswith('The Midnight Commander'):
     mc_version = mc_version.split()[3]
 else:
-    raise ValueError('Unknown mc version')
+    sys.exit('Unknown mc version')
+
 if '.' in mc_version:
     major, minor = [int(v) for v in mc_version.split('.')[:2]]
     if major < 4:
diff --git a/bin/mv_recode_fname b/bin/mv_recode_fname
new file mode 120000 (symlink)
index 0000000..16052c7
--- /dev/null
@@ -0,0 +1 @@
+cp_recode_fname
\ No newline at end of file
diff --git a/bin/r b/bin/r
index 6656358e8619484a75cdbce86a770c1fe2caaa59..a0488dedfad36329dda943a785c397602fb37c66 100755 (executable)
--- a/bin/r
+++ b/bin/r
@@ -1,2 +1,2 @@
 #! /bin/sh
-exec rsync -ahP4 "$@"
+exec rsync -ahPv "$@"
index 186d5001370155bc46a9778e835ab368f1112cfe..54085636506bf1f642663a8fc5697541a762935b 100755 (executable)
@@ -1,39 +1,57 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
 import sys, os
 
-if len(sys.argv) == 3:
-   start_dir = '.'
+from m_lib.defenc import default_encoding
+
+if len(sys.argv) == 1:
+    src_encoding = default_encoding
+    if src_encoding == 'utf-8':
+        sys.exit("Usage: %s [[src_enc] dst_enc [start_dir]]" % sys.argv[0])
+    else:
+        dst_encoding = 'utf-8'
+    start_dir = '.'
+elif len(sys.argv) == 2:
+    src_encoding = default_encoding
+    dst_encoding = sys.argv[1]
+    start_dir = '.'
+elif len(sys.argv) == 3:
+    src_encoding = default_encoding
+    dst_encoding = sys.argv[1]
+    start_dir = sys.argv[2]
 elif len(sys.argv) == 4:
-   start_dir = sys.argv[3]
+    src_encoding = sys.argv[1]
+    dst_encoding = sys.argv[2]
+    start_dir = sys.argv[3]
 else:
-   sys.exit("Usage: %s src_enc dst_enc [start_dir]" % sys.argv[0])
+    sys.exit("Usage: %s [[src_enc] dst_enc [start_dir]]" % sys.argv[0])
 
-
-def _p(plist, dirname, names):
-   plist.append((dirname, names))
+# Fake for recode_filenames.py
+sys.argv = ['', src_encoding, dst_encoding]
+from recode_filenames import _recode
 
 
-plist = []
-os.path.walk(start_dir, _p, plist)
-plist.reverse()
+def _onerror(exc):
+    raise exc
 
+plist = list(os.walk(start_dir, topdown=False, onerror=_onerror))
 
-from recode_filenames import _recode
 
 save_dir = os.getcwd()
-for dirname, names in plist:
-   os.chdir(dirname)
-   for filename in names:
-      # if not exists - it was renamed already
-      if os.path.exists(filename) and \
-            os.path.isfile(filename):
-         newname = _recode(filename)
-         if newname != filename:
-            os.rename(filename, newname)
-   os.chdir('..')
-   dirname = os.path.basename(dirname)
-   newname = _recode(dirname)
-   if newname != dirname:
-      os.rename(dirname, newname)
-   os.chdir(save_dir)
+for dirname, _subdirs, fnames in plist:
+    if dirname == '.':
+        continue
+    os.chdir(dirname)
+    for filename in fnames:
+        # if not exists - it was renamed already
+        if os.path.exists(filename) and \
+                os.path.isfile(filename):
+            newname = _recode(filename)
+            if newname != filename:
+                os.rename(filename, newname)
+    os.chdir('..')
+    dirname = os.path.basename(dirname)
+    newname = _recode(dirname)
+    if newname != dirname:
+        os.rename(dirname, newname)
+    os.chdir(save_dir)
index cb8e4e2c07a9a726fcec3d917d6c27041df3713c..77ff3063f46ce5dc62fb0191706959ec4e592a19 100755 (executable)
@@ -1,15 +1,14 @@
 #! /bin/sh
 
 fromenc="$1"
-shift
-
-toenc="$1"
-shift
+toenc="$2"
+shift 2
 
 tmpfile="`mktemp`" &&
 
 for file in "$@"; do
-   iconv -f "$fromenc" -t "$toenc" "$file" >"$tmpfile" && cp "$tmpfile" "$file"
+   iconv -f "$fromenc" -t "$toenc" "$file" >"$tmpfile" &&
+   cp "$tmpfile" "$file"
 done
 
 exec rm "$tmpfile"
index 7e25a1637f77e6ea266116aec67ede5ae62069f4..b8d3fa04daca8794a10479951126cb9e3a7932ac 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 # -*- coding: koi8-r -*-
 
 import sys
@@ -7,61 +7,63 @@ src_encoding = sys.argv[1]
 dst_encoding = sys.argv[2]
 
 if src_encoding == "translit":
-   if dst_encoding == "koi8-r":
-      from m_lib.rus.lat2rus import lat2koi as _recode
-   elif dst_encoding == "cp1251":
-      from m_lib.rus.lat2rus import lat2win as _recode
-   else:
-      raise NotImplementedError("destination encoding must be koi8-r or cp1251, not `%s'" % dst_encoding)
+    if dst_encoding == "koi8-r":
+        from m_lib.rus.lat2rus import lat2koi as _recode
+    elif dst_encoding == "cp1251":
+        from m_lib.rus.lat2rus import lat2win as _recode
+    else:
+        raise NotImplementedError("destination encoding must be koi8-r or cp1251, not `%s'" % dst_encoding)
 
 elif dst_encoding == "translit":
-   if src_encoding == "koi8-r":
-      from m_lib.rus.rus2lat import koi2lat as _recode
-   elif src_encoding == "cp1251":
-      from m_lib.rus.rus2lat import win2lat as _recode
-   else:
-      raise NotImplementedError("source encoding must be koi8-r or cp1251, not `%s'" % src_encoding)
+    if src_encoding == "koi8-r":
+        from m_lib.rus.rus2lat import koi2lat as _recode
+    elif src_encoding == "cp1251":
+        from m_lib.rus.rus2lat import win2lat as _recode
+    else:
+        raise NotImplementedError("source encoding must be koi8-r or cp1251, not `%s'" % src_encoding)
 
-   from m_lib.rus.rus2lat import koi2lat_d
-   koi2lat_d["Ъ"] = '' # remove apostrophs -
-   koi2lat_d["Ь"] = '' # they are not very good characters in filenames
-   koi2lat_d["ъ"] = '' # especially on Windoze
-   koi2lat_d["ь"] = '' # :-)
+    from m_lib.rus.rus2lat import koi2lat_d
+    koi2lat_d["Ъ"] = '' # remove apostrophs -
+    koi2lat_d["Ь"] = '' # they are not very good characters in filenames
+    koi2lat_d["ъ"] = '' # especially on Windoze
+    koi2lat_d["ь"] = '' # :-)
 
 elif src_encoding == "url":
-   try:
-      src_encoding, dst_encoding = dst_encoding.split('/')
-   except ValueError:
-      src_encoding = dst_encoding
-   from m_lib.opstring import recode
-   import urllib
-   def _recode(s):
-      s = urllib.unquote(s)
-      if src_encoding != dst_encoding:
-         s = recode(s, src_encoding, dst_encoding, "replace")
-      return s
+    try:
+        src_encoding, dst_encoding = dst_encoding.split('/')
+    except ValueError:
+        src_encoding = dst_encoding
+    from m_lib.opstring import recode
+    import urllib
+    def _recode(s):
+        s = urllib.unquote(s)
+        if src_encoding != dst_encoding:
+            s = recode(s, src_encoding, dst_encoding, "replace")
+        return s
 
 elif dst_encoding == "url":
-   try:
-      src_encoding, dst_encoding = src_encoding.split('/')
-   except ValueError:
-      dst_encoding = src_encoding
-   from m_lib.opstring import recode
-   import urllib
-   def _recode(s):
-      if src_encoding != dst_encoding:
-         s = recode(s, src_encoding, dst_encoding, "replace")
-      return urllib.quote(s, safe=";/?:@&=+$,()'") # wget treats them as safe
+    try:
+        src_encoding, dst_encoding = src_encoding.split('/')
+    except ValueError:
+        dst_encoding = src_encoding
+    from m_lib.opstring import recode
+    import urllib
+    def _recode(s):
+        if src_encoding != dst_encoding:
+            s = recode(s, src_encoding, dst_encoding, "replace")
+        return urllib.quote(s, safe=";/?:@&=+$,()'") # wget treats them as safe
 
 else:
-   from m_lib.opstring import recode
-   def _recode(s):
-      return recode(s, src_encoding, dst_encoding, "replace")
+    from m_lib.opstring import recode
+    def _recode(s):
+        return recode(s, src_encoding, dst_encoding, "replace")
 
 
 if __name__ == "__main__":
-   import os
-   for filename in sys.argv[3:]:
-      new_name = _recode(filename)
-      if new_name != filename:
-         os.rename(filename, new_name)
+    import os
+    for filename in sys.argv[3:]:
+        new_name = _recode(filename)
+        if type(filename) is not type(new_name):
+            new_name = new_name.decode()
+        if new_name != filename:
+            os.rename(filename, new_name)
index 1f9d7ce4d4e5c312e894ca76808a65de1d5351b5..8f51b3c868854b43dea8c2c7610f6a8b45384f11 100755 (executable)
@@ -1,2 +1,4 @@
 #! /bin/sh
-exec find . -name '*.py[co]' -delete
+
+find . -name '*.py[co]' -delete &&
+exec find . -name __pycache__ -type d -empty -delete
diff --git a/bin/rucal b/bin/rucal
new file mode 100755 (executable)
index 0000000..9269dde
--- /dev/null
+++ b/bin/rucal
@@ -0,0 +1,2 @@
+#! /bin/sh
+LC_TIME=$LC_CTYPE exec ncal "$@"
diff --git a/bin/s b/bin/s
index 4f8570d55fae3fa4f0c9c6817e508d0bb2973f96..09649ca0befe4620ff0960648ad285f70025e5bc 100755 (executable)
--- a/bin/s
+++ b/bin/s
@@ -1,2 +1,4 @@
 #! /bin/sh
-exec ssh -4 "$@"
+
+ssh "$@"; rc=$?
+xtitle && exit $rc
diff --git a/bin/smplay b/bin/smplay
deleted file mode 100755 (executable)
index 8561299..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#! /bin/sh
-
-(xscreensaver-command -exit
-xset -dpms s off) &
-
-b="`basename $0`"
-
-if [ "$b" = smplay ]; then
-   GUI="-minigui"
-elif [ "$b" = smplay-gui ]; then
-   GUI="-defaultgui"
-else
-   echo "Bad script name, aborted" 1>&2
-   exit 1
-fi
-
-cgmem_nice 500 smplayer "$GUI" "$@"
-"$HOME"/admin/prog/audio-cdr-video/audio/pa-volume
-
-cd "$HOME"
-xset +dpms s on
-xscreensaver &
diff --git a/bin/smplay-gui b/bin/smplay-gui
deleted file mode 120000 (symlink)
index 8c13708..0000000
+++ /dev/null
@@ -1 +0,0 @@
-smplay
\ No newline at end of file
index a8e4871206954c8defad2b11dbf028e3afb169f0..ecfafa8f0d9d70b9ab41eca855f27962508e8419 100755 (executable)
@@ -1,71 +1,73 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
+from __future__ import print_function
 
 import sys
 
 
 def usage(code=0):
-   sys.stderr.write("Usage: %s [-0|--null] [-n|--no-newline] [-s|--space] [-w|--width] [width]\n" % sys.argv[0])
-   sys.exit(code)
+    sys.stderr.write("Usage: %s [-0|--null] [-n|--no-newline] [-s|--space] [-w|--width] [width]\n" % sys.argv[0])
+    sys.exit(code)
 
 
 def get_args():
-   from getopt import getopt, GetoptError
-
-   try:
-      options, arguments = getopt(sys.argv[1:], "0nsw:",
-         ["null", "no-newline", "space", "width="])
-   except GetoptError:
-      usage(1)
-
-   print0 = False
-   newline = True
-   space = ''
-   width = None
-
-   for option, value in options:
-      if option in ("-h", "--help"):
-         usage()
-      elif option in ("-0", "--null"):
-         print0 = True
-      elif option in ("-n", "--no-newline"):
-         newline = False
-      elif option in ("-s", "--space"):
-         space = u' '
-      elif option in ("-w", "--width"):
-         width = int(value)
-      else:
-         usage(2)
-
-   if arguments:
-      if width is not None:
-         usage(3)
-      elif len(arguments) > 1:
-         usage(4)
-      else:
-         width = int(arguments[0])
-
-   return print0, newline, space, width
+    from getopt import getopt, GetoptError
+
+    try:
+        options, arguments = getopt(
+            sys.argv[1:], "0nsw:",
+            ["null", "no-newline", "space", "width="])
+    except GetoptError:
+        usage(1)
+
+    print0 = False
+    newline = True
+    space = ''
+    width = None
+
+    for option, value in options:
+        if option in ("-h", "--help"):
+            usage()
+        elif option in ("-0", "--null"):
+            print0 = True
+        elif option in ("-n", "--no-newline"):
+            newline = False
+        elif option in ("-s", "--space"):
+            space = u' '
+        elif option in ("-w", "--width"):
+            width = int(value)
+        else:
+            usage(2)
+
+    if arguments:
+        if width is not None:
+            usage(3)
+        elif len(arguments) > 1:
+            usage(4)
+        else:
+            width = int(arguments[0])
+
+    return print0, newline, space, width
 
 print0, newline, space, width = get_args()
 
 
-from m_lib.defenc import default_encoding
-text = sys.stdin.read().decode(default_encoding)
+text = sys.stdin.read()
 if not newline:
-   text = text.rstrip()
+    text = text.rstrip()
 
 if width:
-   import textwrap
-   text = textwrap.fill(text, width - 2*len(space),
-      initial_indent=space, subsequent_indent=space)
-   if space:
-       text = u'\n'.join([line+space for line in text.split(u'\n')])
+    import textwrap
+    text = textwrap.fill(
+        text, width - 2*len(space),
+        initial_indent=space, subsequent_indent=space)
+    if space:
+        text = u'\n'.join([line+space for line in text.split(u'\n')])
 else:
-   text = u"%s%s%s" % (space, text, space)
+    text = u"%s%s%s" % (space, text, space)
 
-sys.stdout.write(text.encode(default_encoding))
+sys.stdout.write(text)
 
 if print0:
-   sys.stdout.write('\0')
+    sys.stdout.write('\0')
 elif newline:
-   print
+    print()
diff --git a/bin/unicode_norm_nfd.py b/bin/unicode_norm_nfd.py
new file mode 100755 (executable)
index 0000000..2cca0d9
--- /dev/null
@@ -0,0 +1,23 @@
+#! /usr/bin/env python3
+# https://stackoverflow.com/a/518232/7976758
+
+import sys
+import unicodedata
+
+
+def strip_accents(s):
+    return ''.join(c for c in unicodedata.normalize('NFD', s)
+                   if unicodedata.category(c) != 'Mn')
+
+
+def latin1_to_ascii(uinput):
+    if isinstance(uinput, bytes):
+        uinput = uinput.decode(sys.getfilesystemencoding())
+    return strip_accents(uinput)
+
+
+if __name__ == '__main__':
+    if len(sys.argv) == 1:
+        sys.exit('Usage: %s name\n' % sys.argv[0])
+    for name in sys.argv[1:]:
+        print(latin1_to_ascii(name))
index 8fd74266b4980068adb4028afd45d2dd8f38fbdd..57af7b1d5a277eec95eb5b9e1e6265c57c98750d 100755 (executable)
@@ -1,7 +1,7 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 """Unzip with encoded filenames
 
-   Written by Oleg Broytman. Copyright (C) 2009-2016 PhiloSoft Design.
+   Written by Oleg Broytman. Copyright (C) 2009-2024 PhiloSoft Design.
 """
 
 import sys, os, time
@@ -27,8 +27,9 @@ out = '.'
 for zinfo in zf.infolist():
     path = zinfo.filename
     if isinstance(path, bytes):
-        path = path.decode('cp866')
-    recoded_path = path.encode(default_encoding)
+        recoded_path = path.decode('cp866').encode(default_encoding)
+    else:
+        recoded_path = path
     print(recoded_path)
 
     if path.startswith('./'):
index 0590aa0f4d677d72c14e7eb2c130ad57f9445e9c..a4c20247039990823e979905d90923719477ab0a 100755 (executable)
@@ -1,27 +1,52 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
 import sys, os
 
 # This must be imported and called before webbrowser
 # because webbrowser reads BROWSER environment variable at the import time
 from browser_stack import set_current_browser
-set_current_browser()
+browser = set_current_browser()
+
+if sys.argv[1] in ("-p", "--private", "--incognito"):
+    try:
+        url = sys.argv[2]
+    except IndexError:
+        url = ''
+    if browser == 'firefox':
+        if url:
+            os.system('firefox --private-window "%s"' % url)
+        else:
+            os.system('firefox --private-window')
+        sys.exit()
+    elif browser in ("google-chrome", "chrome", "chromium", "chromium-browser"):
+        os.system('%s --incognito "%s"' % (browser, url))
+        sys.exit()
+    sys.exit("Unsupported browser")
 
 import webbrowser
 
 if sys.argv[1] in ("-t", "--tab"):
-   new = 2
-   url = sys.argv[2]
+    new = 2
+    try:
+        url = sys.argv[2]
+    except IndexError:
+        url = ''
 
 elif sys.argv[1] in ("-n", "--new"):
-   new = 1
-   url = sys.argv[2]
+    new = 1
+    try:
+        url = sys.argv[2]
+    except IndexError:
+        url = ''
 
 else:
-   new = 0
-   url = sys.argv[1]
+    new = 0
+    try:
+        url = sys.argv[1]
+    except IndexError:
+        url = ''
 
-if '://' not in url: # Make an URL from a local file name
+if url and '://' not in url: # Make an URL from a local file name
     url = 'file://' + os.path.abspath(url)
 
 webbrowser.open(url, new)
index 2dc183fb597678f1581faedde4b2c2e03cceb3e0..e30b6ff26d496d86ac49d8d627653216be927a92 100755 (executable)
@@ -1,8 +1,9 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
-from cgi import parse_qsl
 from getopt import getopt, GetoptError
-import sys, urllib
+from urllib.parse import urlsplit, parse_qsl, quote, quote_plus, urlencode
+import sys
+
 from m_lib.defenc import default_encoding
 
 # This must be imported and called before webbrowser
@@ -10,17 +11,21 @@ from m_lib.defenc import default_encoding
 from browser_stack import set_current_browser
 set_current_browser()
 
-import webbrowser
+import webbrowser  # noqa: E402 module level import not at top of file
+
 
 def usage():
-    sys.exit('Usage: %s [-e|--encoding=encoding] [-n|--newwin|-t|--tab] URL' % sys.argv[0])
+    sys.exit('Usage: %s [-e|--encoding=encoding] [-n|--newwin|-t|--tab] URL'
+             % sys.argv[0])
+
 
 try:
-    options, arguments = getopt(sys.argv[1:], 'e:nt', ['encoding=', 'newwin', 'tab'])
+    options, arguments = getopt(
+        sys.argv[1:], 'e:nt', ['encoding=', 'newwin', 'tab'])
 except GetoptError:
     usage()
 
-if len(arguments) <> 1:
+if len(arguments) != 1:
     usage()
 
 encoding = None
@@ -38,45 +43,52 @@ if not encoding:
     encoding = default_encoding
 
 url = arguments[0]
-protocol, request = urllib.splittype(url)
-user, password, port = None, None, None
-host, path = urllib.splithost(request)
-if host:
-   user, host = urllib.splituser(host)
-   if user:
-      user, password = urllib.splitpasswd(user)
-   host, port = urllib.splitport(host)
-   if port: port = int(port)
-path, tag = urllib.splittag(path)
-path, query = urllib.splitquery(path)
-path = urllib.unquote(path)
-if tag: tag = urllib.unquote_plus(tag)
+
+split_results = urlsplit(url)
+protocol, netloc, path, query, tag = split_results
+user = split_results.username
+password = split_results.password
+host = split_results.hostname
+port = split_results.port
 
 if query:
-   qlist = []
-   for name, value in parse_qsl(query):
-      name = unicode(name, default_encoding).encode(encoding)
-      value = unicode(value, default_encoding).encode(encoding)
-      qlist.append((name, value))
+    qlist = []
+    for name, value in parse_qsl(query):
+        if isinstance(name, bytes):
+            name = name.decode(default_encoding)
+            value = value.decode(default_encoding)
+        name = name.encode(encoding)
+        value = value.encode(encoding)
+        qlist.append((name, value))
 
 url = protocol + "://"
 if user:
-   url += urllib.quote(unicode(user, default_encoding).encode(encoding))
-   if password:
-      url += ':' + urllib.quote(unicode(password, default_encoding).encode(encoding))
-   url += '@'
+    if isinstance(user, bytes):
+        user = user.decode(default_encoding)
+    url += quote(user.encode(encoding))
+    if password:
+        if isinstance(password, bytes):
+            password = password.decode(default_encoding)
+        url += ':' + quote(password.encode(encoding))
+    url += '@'
 if host:
-   url += host.decode(encoding).encode('idna')
-   if port:
-      url += ':%d' % port
+    if isinstance(host, bytes):
+        host = host.decode(encoding)
+    url += host.encode('idna').decode('ascii')
+    if port:
+        url += ':%d' % port
 if path:
-   if protocol == "file":
-      url += urllib.quote(path)
-   else:
-      url += urllib.quote(unicode(path, default_encoding).encode(encoding))
+    if protocol == "file":
+        url += quote(path)
+    else:
+        if isinstance(path, bytes):
+            path = path.decode(default_encoding)
+        url += quote(path.encode(encoding))
 if query:
-   url += '?' + urllib.urlencode(qlist)
+    url += '?' + urlencode(qlist)
 if tag:
-   url += '#' + urllib.quote_plus(unicode(tag, default_encoding).encode(encoding))
+    if isinstance(tag, bytes):
+        tag = tag.decode(default_encoding)
+    url += '#' + quote_plus(tag.encode(encoding))
 
 webbrowser.open(url, new)
index da7ea395a36077f75e16201eb4825532f3e377e9..a851395a6b36aa8d610c146663beea21712ba78c 100755 (executable)
@@ -1,13 +1,17 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
-from cgi import parse_qsl
 from getopt import getopt, GetoptError
-import os, posixpath
-import sys, urllib
+from urllib.parse import urlsplit, parse_qsl, quote, quote_plus, urlencode
+import os
+import posixpath
+import sys
 from m_lib.defenc import default_encoding
 
+
 def usage():
-    sys.exit('Usage: %s [-e|--encoding=encoding] [-n|--newwin|-t|--tab] URL' % sys.argv[0])
+    sys.exit('Usage: %s [-e|--encoding=encoding] [-n|--newwin|-t|--tab] URL'
+             % sys.argv[0])
+
 
 try:
     options, arguments = getopt(sys.argv[1:], 'e:', ['encoding='])
@@ -27,43 +31,53 @@ if not encoding:
     encoding = default_encoding
 
 url = arguments[0]
-protocol, request = urllib.splittype(url)
-user, password, port = None, None, None
-host, path = urllib.splithost(request)
-if host:
-   user, host = urllib.splituser(host)
-   if user:
-      user, password = urllib.splitpasswd(user)
-   host, port = urllib.splitport(host)
-   if port: port = int(port)
-path, tag = urllib.splittag(path)
-path, query = urllib.splitquery(path)
-path = urllib.unquote(path)
+
+split_results = urlsplit(url)
+protocol, netloc, path, query, tag = split_results
+user = split_results.username
+password = split_results.password
+host = split_results.hostname
+port = split_results.port
 
 if query:
-   qlist = []
-   for name, value in parse_qsl(query):
-      name = unicode(name, default_encoding).encode(encoding)
-      value = unicode(value, default_encoding).encode(encoding)
-      qlist.append((name, value))
+    qlist = []
+    for name, value in parse_qsl(query):
+        if isinstance(name, bytes):
+            name = name.decode(default_encoding)
+            value = value.decode(default_encoding)
+        name = name.encode(encoding)
+        value = value.encode(encoding)
+        qlist.append((name, value))
 
 url = protocol + "://"
 if user:
-   url += urllib.quote(unicode(user, default_encoding).encode(encoding))
-   if password:
-      url += ':' + urllib.quote(unicode(password, default_encoding).encode(encoding))
-   url += '@'
+    if isinstance(user, bytes):
+        user = user.decode(default_encoding)
+    url += quote(user.encode(encoding))
+    if password:
+        if isinstance(password, bytes):
+            password = password.decode(default_encoding)
+        url += ':' + quote(password.encode(encoding))
+    url += '@'
 if host:
-   url += host.decode(encoding).encode('idna')
-   if port:
-      url += ':%d' % port
+    if isinstance(host, bytes):
+        host = host.decode(encoding)
+    url += host.encode('idna').decode('ascii')
+    if port:
+        url += ':%d' % port
 if path:
-   if protocol == "file":
-      url += urllib.quote(path)
-   else:
-      url += urllib.quote(unicode(path, default_encoding).encode(encoding))
-#if query:
-#   url += '?' + urllib.urlencode(qlist)
+    if protocol == "file":
+        url += quote(path)
+    else:
+        if isinstance(path, bytes):
+            path = path.decode(default_encoding)
+        url += quote(path.encode(encoding))
+if query:
+    url += '?' + urlencode(qlist)
+if tag:
+    if isinstance(tag, bytes):
+        tag = tag.decode(default_encoding)
+    url += '#' + quote_plus(tag.encode(encoding))
 
 name = posixpath.basename(path)
 os.system('exec wget-wrapper -O "%s" "%s"' % (name, url))
deleted file mode 100755 (executable)
index 441ea40fe5146476bbecb135b39d64d9ebbb7d06..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#! /bin/sh
-
-. "$HOME"/lib/config/wget
-
-exec wget -4 --continue -e robots=off --limit-rate="$wget_speed" \
-   --mirror -nH --no-parent --page-requisites --progress=bar:noscroll \
-   --proxy=off --trust-server-names --random-wait --wait=15 "$@"
-
-# Other useful flags are: -b (--background) --cut-dirs -E (--html-extension)
-# -k (--convert-links)
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..2583cb083f5eeec6bd35ff3d56ccf34d32876f54
--- /dev/null
@@ -0,0 +1 @@
+wget-mirror
\ No newline at end of file
diff --git a/bin/wget-mirror b/bin/wget-mirror
new file mode 100755 (executable)
index 0000000..8626c31
--- /dev/null
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+. "$HOME"/lib/config/wget
+
+exec wget -4 --continue -e robots=off --limit-rate="$wget_speed" \
+   --mirror -nH --no-parent --page-requisites --progress=bar:noscroll \
+   --proxy=off --trust-server-names --random-wait --wait=2 "$@"
+
+# Other useful flags are: -b (--background) --cut-dirs -E (--html-extension)
+# -k (--convert-links)
index f734659d5a4a9ea7d7f7f5e03b7adeeb4cb7068c..9fc678e5b25e8f62ebb8096e0e0bd30028010179 100755 (executable)
@@ -3,15 +3,17 @@
 case "$TERM" in
    *rxvt*|screen*|*term*|vt100)
       if [ -z "$1" ]; then
-         TITLE="${USER}@${HOSTNAME}:$(echo ${PWD} | sed -e "s|^${HOME}|~|")"
+         TITLE="${USER}@`hostname`:$(echo ${PWD} | sed -e "s|^${HOME}|~|")"
       else
          TITLE="$@"
       fi
-      echo -n "\033]0;${TITLE}\007" # Set xterm title
+      XTITLE="\033]0;${TITLE}\007" # Set xterm title/icon
       case "$TERM" in
          screen*)
-            echo -n "\033k${TITLE}\033\\" # Set screen/tmux caption
+            XTITLE="\033P${XTITLE}\033\\\\" # Set xterm title/icon under screen/tmux 
+            XTITLE="${XTITLE}\033k${TITLE}\033\\\\" # Set screen/tmux caption
          ;;
       esac
+      echo -n "$XTITLE"
    ;;
 esac
index e99c9a8283ed6829e824388994eee5a043a51652..35bf0e69f00da71c92c80ef55c09767c904e0120 100755 (executable)
@@ -1,7 +1,7 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 """Zip (zip -r9) with encoded filenames
 
-   Written by Oleg Broytman. Copyright (C) 2009, 2010 PhiloSoft Design.
+   Written by Oleg Broytman. Copyright (C) 2009-2023 PhiloSoft Design.
 """
 
 import sys, os
@@ -23,7 +23,10 @@ if len(arguments) < 2:
 def addToZip(zf, path):
     if os.path.isfile(path):
         print(path)
-        recoded_path = path.decode(default_encoding).encode('cp866')
+        if isinstance(path, bytes):
+            recoded_path = path.decode(default_encoding).encode('cp866')
+        else:
+            recoded_path = path
         zf.write(path, recoded_path, ZIP_DEFLATED)
     elif os.path.isdir(path):
         for nm in os.listdir(path):
index eb832c1b77f640d8899815d3633754bc1ebcf1d2..1d365c62f9214c649be8f4dc65268a619865457c 100644 (file)
@@ -309,7 +309,7 @@ def init():
             return "Usage: cat('filename')"
 
         def __call__(self, filename):
-            fp = open(filename, 'rU')
+            fp = open(filename, 'r')
             text = fp.read()
             fp.close()
             print(text)