diff options
| author | bozo.kopic <bozo@kopic.xyz> | 2022-03-29 14:44:43 +0200 |
|---|---|---|
| committer | bozo.kopic <bozo@kopic.xyz> | 2022-03-29 14:44:43 +0200 |
| commit | 38da1893e95fa4438f01a67c5ebb180b21548bc1 (patch) | |
| tree | 93e88b6d9089614e9ab016663cc56595fe78b7c7 | |
| parent | 1d6736e0c354451fd6f072bb7c145c3d5f7aba9f (diff) | |
.
| -rwxr-xr-x | install.sh | 70 | ||||
| -rw-r--r-- | shell/zsh/.zshrc | 1 | ||||
| -rw-r--r-- | shell/zsh/tabcompletion/_doit | 256 | ||||
| -rw-r--r-- | sublime-text/LSP.sublime-settings | 2 | ||||
| -rw-r--r-- | sublime-text/Package Control.sublime-settings | 1 | ||||
| -rw-r--r-- | sway/config | 1 | ||||
| -rwxr-xr-x | sway/init.sh | 5 | ||||
| -rw-r--r-- | vim/.vimrc | 7 | ||||
| -rw-r--r-- | vim/plug.vim | 7 | ||||
| -rwxr-xr-x | xorg/.xinitrc | 2 |
10 files changed, 314 insertions, 38 deletions
@@ -7,34 +7,40 @@ symlink () { } install_python_venv() { - LONG=$1 - SHORT=${LONG//\./} - - PYTHON_BIN=$(command -v "python$LONG" || true) - if [ -n "$PYTHON_BIN" ]; then - - PYTHON_DIR=~/opt/python$SHORT - PIP_BIN=$PYTHON_DIR/bin/pip$LONG - REQUIREMENTS=~/.dotfiles/python/requirements.pip$SHORT.txt - LOCAL_PYTHON_BIN=~/bin/python$LONG - LOCAL_PIP_BIN=~/bin/pip$LONG - LOCAL_DOIT_BIN=~/bin/doit$LONG - - [ ! -d $PYTHON_DIR ] && \ - $PYTHON_BIN -m venv --system-site-packages $PYTHON_DIR - - $PIP_BIN -q install -U -r $REQUIREMENTS - - echo "#!/bin/sh" > $LOCAL_PYTHON_BIN - echo "exec $(cd $PYTHON_DIR; pwd)/bin/python$LONG \"\$@\"" >> $LOCAL_PYTHON_BIN - chmod +x $LOCAL_PYTHON_BIN - - symlink $PIP_BIN $LOCAL_PIP_BIN - symlink $PYTHON_DIR/bin/doit $LOCAL_DOIT_BIN - - symlink ~/bin/python$LONG ~/bin/python3 - - fi + PYTHON_CMD=$(command -v "$1" || true) + [ -z "$PYTHON_CMD" ] && return 0; + + PYTHON=$PYTHON_CMD + PYTHON=${PYTHON%%[0-9]*} + PYTHON=${PYTHON##*/} + MAJOR=$($PYTHON_CMD -c "import sys; print(sys.version_info.major)") + MINOR=$($PYTHON_CMD -c "import sys; print(sys.version_info.minor)") + REQUIREMENTS=~/.dotfiles/python/requirements.pip$MAJOR$MINOR.txt + + VENV_DIR=$(cd ~/opt; pwd)/$PYTHON$MAJOR$MINOR + VENV_PYTHON=$VENV_DIR/bin/$PYTHON + VENV_PIP=$VENV_DIR/bin/pip + VENV_DOIT=$VENV_DIR/bin/doit + + BIN_DIR=$(cd ~/bin; pwd) + BIN_PYTHON=$BIN_DIR/$PYTHON$MAJOR.$MINOR + BIN_PIP=$BIN_DIR/pip-$PYTHON$MAJOR.$MINOR + BIN_DOIT=$BIN_DIR/doit-$PYTHON$MAJOR.$MINOR + + $PYTHON_CMD -m venv --system-site-packages $VENV_DIR + $VENV_PIP -q install -U -r $REQUIREMENTS + + echo -e "#!/bin/sh\\nexec $VENV_PYTHON \"\$@\"" > $BIN_PYTHON + chmod +x $BIN_PYTHON + symlink $BIN_PYTHON $BIN_DIR/$PYTHON$MAJOR + symlink $BIN_DIR/$PYTHON$MAJOR $BIN_DIR/$PYTHON + + symlink $VENV_PIP $BIN_PIP + symlink $BIN_PIP $BIN_DIR/pip$MAJOR + symlink $BIN_DIR/pip$MAJOR $BIN_DIR/pip + + symlink $VENV_DOIT $BIN_DOIT + symlink $BIN_DOIT $BIN_DIR/doit } mkdir -p ~/bin @@ -100,10 +106,10 @@ symlink ~/.dotfiles/pictures ~/.pictures symlink ~/.dotfiles/polybar ~/.config/polybar # python -install_python_venv 3.8 -install_python_venv 3.9 -install_python_venv 3.10 -symlink ~/bin/python3 ~/bin/python +install_python_venv pypy3 +install_python_venv python3.8 +install_python_venv python3.9 +install_python_venv python3.10 # qutebrowser mkdir -p ~/.config/qutebrowser diff --git a/shell/zsh/.zshrc b/shell/zsh/.zshrc index 25c8552..1ecf9a2 100644 --- a/shell/zsh/.zshrc +++ b/shell/zsh/.zshrc @@ -6,6 +6,7 @@ export GPG_TTY=$(tty) bindkey -v +fpath=(~/.dotfiles/shell/zsh/tabcompletion $fpath) autoload -Uz compinit compinit diff --git a/shell/zsh/tabcompletion/_doit b/shell/zsh/tabcompletion/_doit new file mode 100644 index 0000000..9b83a64 --- /dev/null +++ b/shell/zsh/tabcompletion/_doit @@ -0,0 +1,256 @@ +#compdef doit + +_doit() { + local -a commands tasks + # format is 'completion:description' + commands=( + 'auto: automatically execute tasks when a dependency changes' + 'clean: clean action / remove targets' + 'dumpdb: dump dependency DB' + 'forget: clear successful run status from internal DB' + 'help: show help' + 'ignore: ignore task (skip) on subsequent runs' + 'info: show info about a task' + 'list: list tasks from dodo file' + 'reset-dep: recompute and save the state of file dependencies without executing actions' + 'run: run tasks' + 'strace: use strace to list file_deps and targets' + 'tabcompletion: generate script for tab-completion' + ) + + # split output by lines to create an array + tasks=("${(f)$(doit list --template '{name}: {doc}')}") + + # complete command or task name + if (( CURRENT == 2 )); then + _arguments -A : '::cmd:(($commands))' '::task:(($tasks))' + return + fi + + # revome program name from $words and decrement CURRENT + local curcontext context state state_desc line + _arguments -C '*:: :->' + + # complete sub-command or task options + local -a _command_args + case "$words[1]" in + + (auto) + _command_args=( + "--db-file[file used to save successful runs [default: %(default)s\]]" \ + "--backend[Select dependency file backend. [default: %(default)s\]]" \ + + "--check_file_uptodate[Choose how to check if files have been modified. Available options [default: %(default)s\]: 'md5': use the md5sum 'timestamp': use the timestamp ]" \ + "(-f|--file)"{-f,--file}"[load task from dodo FILE [default: %(default)s\]]" \ + "(-d|--dir)"{-d,--dir}"[set path to be used as cwd directory (file paths on dodo file are relative to dodo.py location).]" \ + "(-k|--seek-file)"{-k,--seek-file}"[seek dodo file on parent folders [default: %(default)s\]]" \ + "(-v|--verbosity)"{-v,--verbosity}"[0 capture (do not print) stdout/stderr from task. 1 capture stdout only. 2 do not capture anything (print everything immediately). [default: 1\]]" \ + + "--success[]" \ + "--failure[]" \ + '*::task:(($tasks))' + '' + ) + ;; + + + (clean) + _command_args=( + "--db-file[file used to save successful runs [default: %(default)s\]]" \ + "--backend[Select dependency file backend. [default: %(default)s\]]" \ + + "--check_file_uptodate[Choose how to check if files have been modified. Available options [default: %(default)s\]: 'md5': use the md5sum 'timestamp': use the timestamp ]" \ + "(-f|--file)"{-f,--file}"[load task from dodo FILE [default: %(default)s\]]" \ + "(-d|--dir)"{-d,--dir}"[set path to be used as cwd directory (file paths on dodo file are relative to dodo.py location).]" \ + "(-k|--seek-file)"{-k,--seek-file}"[seek dodo file on parent folders [default: %(default)s\]]" \ + "(-c|--clean-dep)"{-c,--clean-dep}"[clean task dependencies too]" \ + "(-a|--clean-all)"{-a,--clean-all}"[clean all task]" \ + "(-n|--dry-run)"{-n,--dry-run}"[print actions without really executing them]" \ + "--forget[also forget tasks after cleaning]" \ + '*::task:(($tasks))' + '' + ) + ;; + + + (dumpdb) + _command_args=( + "--db-file[file used to save successful runs [default: %(default)s\]]" \ + '' + ) + ;; + + + (forget) + _command_args=( + "--db-file[file used to save successful runs [default: %(default)s\]]" \ + "--backend[Select dependency file backend. [default: %(default)s\]]" \ + + "--check_file_uptodate[Choose how to check if files have been modified. Available options [default: %(default)s\]: 'md5': use the md5sum 'timestamp': use the timestamp ]" \ + "(-f|--file)"{-f,--file}"[load task from dodo FILE [default: %(default)s\]]" \ + "(-d|--dir)"{-d,--dir}"[set path to be used as cwd directory (file paths on dodo file are relative to dodo.py location).]" \ + "(-k|--seek-file)"{-k,--seek-file}"[seek dodo file on parent folders [default: %(default)s\]]" \ + "(-s|--follow-sub)"{-s,--follow-sub}"[forget task dependencies too]" \ + "--disable-default[disable forgetting default tasks (when no arguments are passed)]" \ + "(-a|--all)"{-a,--all}"[forget all tasks]" \ + '*::task:(($tasks))' + '' + ) + ;; + + + (help) + _command_args=( + "--db-file[file used to save successful runs [default: %(default)s\]]" \ + "--backend[Select dependency file backend. [default: %(default)s\]]" \ + + "--check_file_uptodate[Choose how to check if files have been modified. Available options [default: %(default)s\]: 'md5': use the md5sum 'timestamp': use the timestamp ]" \ + "(-f|--file)"{-f,--file}"[load task from dodo FILE [default: %(default)s\]]" \ + "(-d|--dir)"{-d,--dir}"[set path to be used as cwd directory (file paths on dodo file are relative to dodo.py location).]" \ + "(-k|--seek-file)"{-k,--seek-file}"[seek dodo file on parent folders [default: %(default)s\]]" \ + '*::task:(($tasks))' + '::cmd:(($commands))' + '' + ) + ;; + + + (ignore) + _command_args=( + "--db-file[file used to save successful runs [default: %(default)s\]]" \ + "--backend[Select dependency file backend. [default: %(default)s\]]" \ + + "--check_file_uptodate[Choose how to check if files have been modified. Available options [default: %(default)s\]: 'md5': use the md5sum 'timestamp': use the timestamp ]" \ + "(-f|--file)"{-f,--file}"[load task from dodo FILE [default: %(default)s\]]" \ + "(-d|--dir)"{-d,--dir}"[set path to be used as cwd directory (file paths on dodo file are relative to dodo.py location).]" \ + "(-k|--seek-file)"{-k,--seek-file}"[seek dodo file on parent folders [default: %(default)s\]]" \ + '*::task:(($tasks))' + '' + ) + ;; + + + (info) + _command_args=( + "--db-file[file used to save successful runs [default: %(default)s\]]" \ + "--backend[Select dependency file backend. [default: %(default)s\]]" \ + + "--check_file_uptodate[Choose how to check if files have been modified. Available options [default: %(default)s\]: 'md5': use the md5sum 'timestamp': use the timestamp ]" \ + "(-f|--file)"{-f,--file}"[load task from dodo FILE [default: %(default)s\]]" \ + "(-d|--dir)"{-d,--dir}"[set path to be used as cwd directory (file paths on dodo file are relative to dodo.py location).]" \ + "(-k|--seek-file)"{-k,--seek-file}"[seek dodo file on parent folders [default: %(default)s\]]" \ + "--no-status[Hides reasons why this task would be executed. [default: %(default)s\]]" \ + '*::task:(($tasks))' + '' + ) + ;; + + + (list) + _command_args=( + "--db-file[file used to save successful runs [default: %(default)s\]]" \ + "--backend[Select dependency file backend. [default: %(default)s\]]" \ + + "--check_file_uptodate[Choose how to check if files have been modified. Available options [default: %(default)s\]: 'md5': use the md5sum 'timestamp': use the timestamp ]" \ + "(-f|--file)"{-f,--file}"[load task from dodo FILE [default: %(default)s\]]" \ + "(-d|--dir)"{-d,--dir}"[set path to be used as cwd directory (file paths on dodo file are relative to dodo.py location).]" \ + "(-k|--seek-file)"{-k,--seek-file}"[seek dodo file on parent folders [default: %(default)s\]]" \ + "--all[list include all sub-tasks from dodo file]" \ + "(-q|--quiet)"{-q,--quiet}"[print just task name (less verbose than default)]" \ + "(-s|--status)"{-s,--status}"[print task status (R)un, (U)p-to-date, (I)gnored]" \ + "(-p|--private)"{-p,--private}"[print private tasks (start with '_')]" \ + "--deps[print list of dependencies (file dependencies only)]" \ + "--template[display entries with template]" \ + "--sort[choose the manner in which the task list is sorted. [default: %(default)s\]]" \ + '*::task:(($tasks))' + '' + ) + ;; + + + (reset-dep) + _command_args=( + "--db-file[file used to save successful runs [default: %(default)s\]]" \ + "--backend[Select dependency file backend. [default: %(default)s\]]" \ + + "--check_file_uptodate[Choose how to check if files have been modified. Available options [default: %(default)s\]: 'md5': use the md5sum 'timestamp': use the timestamp ]" \ + "(-f|--file)"{-f,--file}"[load task from dodo FILE [default: %(default)s\]]" \ + "(-d|--dir)"{-d,--dir}"[set path to be used as cwd directory (file paths on dodo file are relative to dodo.py location).]" \ + "(-k|--seek-file)"{-k,--seek-file}"[seek dodo file on parent folders [default: %(default)s\]]" \ + '*::task:(($tasks))' + '' + ) + ;; + + + (run) + _command_args=( + "--db-file[file used to save successful runs [default: %(default)s\]]" \ + "--backend[Select dependency file backend. [default: %(default)s\]]" \ + + "--check_file_uptodate[Choose how to check if files have been modified. Available options [default: %(default)s\]: 'md5': use the md5sum 'timestamp': use the timestamp ]" \ + "(-f|--file)"{-f,--file}"[load task from dodo FILE [default: %(default)s\]]" \ + "(-d|--dir)"{-d,--dir}"[set path to be used as cwd directory (file paths on dodo file are relative to dodo.py location).]" \ + "(-k|--seek-file)"{-k,--seek-file}"[seek dodo file on parent folders [default: %(default)s\]]" \ + "(-a|--always-execute)"{-a,--always-execute}"[always execute tasks even if up-to-date [default: %(default)s\]]" \ + "(-c|--continue)"{-c,--continue}"[continue executing tasks even after a failure [default: %(default)s\]]" \ + "(-v|--verbosity)"{-v,--verbosity}"[0 capture (do not print) stdout/stderr from task. 1 capture stdout only. 2 do not capture anything (print everything immediately). [default: 1\]]" \ + "(-r|--reporter)"{-r,--reporter}"[Choose output reporter. [default: %(default)s\]]" \ + "(-o|--output-file)"{-o,--output-file}"[write output into file [default: stdout\]]" \ + "(-n|--process)"{-n,--process}"[number of subprocesses [default: %(default)s\]]" \ + "(-P|--parallel-type)"{-P,--parallel-type}"[Tasks can be executed in parallel in different ways: 'process': uses python multiprocessing module 'thread': uses threads [default: %(default)s\] ]" \ + "--pdb[get into PDB (python debugger) post-mortem in case of unhandled exception]" \ + "(-s|--single)"{-s,--single}"[Execute only specified tasks ignoring their task_dep [default: %(default)s\]]" \ + "--auto-delayed-regex[Uses the default regex \".*\" for every delayed task loader for which no regex was explicitly defined]" \ + "--failure-verbosity[Control re-display stdout/stderr for failed tasks on report summary. 0 do not show re-display 1 re-display stderr only 2 re-display both stderr/stdout [default: 0\] ]" \ + '*::task:(($tasks))' + '' + ) + ;; + + + (strace) + _command_args=( + "--db-file[file used to save successful runs [default: %(default)s\]]" \ + "--backend[Select dependency file backend. [default: %(default)s\]]" \ + + "--check_file_uptodate[Choose how to check if files have been modified. Available options [default: %(default)s\]: 'md5': use the md5sum 'timestamp': use the timestamp ]" \ + "(-f|--file)"{-f,--file}"[load task from dodo FILE [default: %(default)s\]]" \ + "(-d|--dir)"{-d,--dir}"[set path to be used as cwd directory (file paths on dodo file are relative to dodo.py location).]" \ + "(-k|--seek-file)"{-k,--seek-file}"[seek dodo file on parent folders [default: %(default)s\]]" \ + "(-a|--all)"{-a,--all}"[display all files (not only from within CWD path)]" \ + "--keep[save strace command output into strace.txt]" \ + '*::task:(($tasks))' + '' + ) + ;; + + + (tabcompletion) + _command_args=( + "--db-file[file used to save successful runs [default: %(default)s\]]" \ + "--backend[Select dependency file backend. [default: %(default)s\]]" \ + + "--check_file_uptodate[Choose how to check if files have been modified. Available options [default: %(default)s\]: 'md5': use the md5sum 'timestamp': use the timestamp ]" \ + "(-f|--file)"{-f,--file}"[load task from dodo FILE [default: %(default)s\]]" \ + "(-d|--dir)"{-d,--dir}"[set path to be used as cwd directory (file paths on dodo file are relative to dodo.py location).]" \ + "(-k|--seek-file)"{-k,--seek-file}"[seek dodo file on parent folders [default: %(default)s\]]" \ + "(-s|--shell)"{-s,--shell}"[Completion code for SHELL. [default: %(default)s\]]" \ + "--hardcode-tasks[Hardcode tasks from current task list.]" \ + '' + ) + ;; + + + # default completes task names + (*) + _command_args='*::task:(($tasks))' + ;; + esac + + # -A no options will be completed after the first non-option argument + _arguments -A : $_command_args + return 0 +} + +_doit diff --git a/sublime-text/LSP.sublime-settings b/sublime-text/LSP.sublime-settings index 751bfb9..79f8bc1 100644 --- a/sublime-text/LSP.sublime-settings +++ b/sublime-text/LSP.sublime-settings @@ -4,7 +4,7 @@ "jedi": { "command": ["jedi-language-server"], "selector": "source.python", - "enabled": true, + "enabled": false, }, "bash-language-server": { "command": ["bash-language-server", "start"], diff --git a/sublime-text/Package Control.sublime-settings b/sublime-text/Package Control.sublime-settings index 22f3ad0..2d87d10 100644 --- a/sublime-text/Package Control.sublime-settings +++ b/sublime-text/Package Control.sublime-settings @@ -8,6 +8,7 @@ "A File Icon", "AutoWrap", "Compare Side-By-Side", + "Git", "LSP", "MagicPython", "Material Theme", diff --git a/sway/config b/sway/config index 2a18165..a8e2ddc 100644 --- a/sway/config +++ b/sway/config @@ -2,6 +2,7 @@ set $mod Mod4 xwayland disable bar swaybar_command waybar +seat seat0 xcursor_theme default 32 exec_always ~/.config/sway/init.sh diff --git a/sway/init.sh b/sway/init.sh index 95d2952..e61a7bb 100755 --- a/sway/init.sh +++ b/sway/init.sh @@ -27,12 +27,15 @@ swaymsg assign "[app_id=\"^tmux_term\$\"]" 9:term # export GDK_DPI_SCALE=0.95 gsettings set org.gnome.desktop.interface scaling-factor 1 gsettings set org.gnome.desktop.interface text-scaling-factor 1 +gsettings set org.gnome.desktop.interface cursor-size 32 export QT_QPA_PLATFORM=wayland systemctl --user import-environment \ QT_QPA_PLATFORM \ SWAYSOCK \ WAYLAND_DISPLAY \ - XDG_SESSION_TYPE + XDG_SESSION_TYPE \ + XDG_CURRENT_DESKTOP +dbus-update-activation-environment --systemd --all systemctl --user restart plasma-kactivitymanagerd.service @@ -56,7 +56,7 @@ let g:indent_guides_guide_size = 1 " show line numbers set number -set relativenumber +"set relativenumber " 80 character line length highlight set colorcolumn=80 @@ -77,7 +77,10 @@ autocmd FileType make set tabstop=4 shiftwidth=8 softtabstop=0 noexpandtab " gui settings set linespace=4 -set guifont=Droid\ Sans\ Mono:h14 +set guifont=Droid\ Sans\ Mono:h12 +let g:neovide_cursor_animation_length = 0.01 +let g:neovide_cursor_trail_length = 0.01 +let g:neovide_cursor_vfx_mode = "sonicboom" "if exists('g:GuiLoaded') "GuiTabline 0 "endif diff --git a/vim/plug.vim b/vim/plug.vim index 6a958cb..8a195d3 100644 --- a/vim/plug.vim +++ b/vim/plug.vim @@ -242,6 +242,8 @@ function! plug#begin(...) let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p')) elseif exists('g:plug_home') let home = s:path(g:plug_home) + elseif has('nvim') + let home = stdpath('data') . '/plugged' elseif !empty(&rtp) let home = s:path(split(&rtp, ',')[0]) . '/plugged' else @@ -405,7 +407,7 @@ function! plug#end() for [map, names] in items(lod.map) for [mode, map_prefix, key_prefix] in - \ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] + \ [['i', '<C-\><C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] execute printf( \ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>', \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix) @@ -1208,7 +1210,8 @@ function! s:update_impl(pull, force, args) abort normal! 2G silent! redraw - let s:clone_opt = [] + " Set remote name, overriding a possible user git config's clone.defaultRemoteName + let s:clone_opt = ['--origin', 'origin'] if get(g:, 'plug_shallow', 1) call extend(s:clone_opt, ['--depth', '1']) if s:git_version_requirement(1, 7, 10) diff --git a/xorg/.xinitrc b/xorg/.xinitrc index dd22703..96952c3 100755 --- a/xorg/.xinitrc +++ b/xorg/.xinitrc @@ -9,6 +9,8 @@ setwallpaper #/usr/lib/kactivitymanagerd & +dbus-update-activation-environment --systemd --all + picom -I 1 -O 1 -D 0 -m 1 & dunst & exec bspwm |
