From a8478e89a00c78c6c55c37856259946be3a5d0a5 Mon Sep 17 00:00:00 2001 From: ayham Date: Sun, 15 Aug 2021 14:45:16 +0300 Subject: [PATCH] update --- .config/X11/dwm-xinit | 4 +- .config/alacritty.yml | 2 +- .config/env | 4 + .config/nvim/init.vim | 63 +++++----- .config/tmux/plugins/tmux-continuum | 1 + .config/tmux/plugins/tmux-power | 1 + .config/tmux/plugins/tmux-resurrect | 1 + .config/tmux/tmux.conf | 48 +++++++- .config/zsh/.zshrc | 10 +- .config/zsh/shrink-path.plugin.zsh | 182 ++++++++++++++++++++++++++++ .config/zsh/zplug | 1 + 11 files changed, 274 insertions(+), 43 deletions(-) create mode 160000 .config/tmux/plugins/tmux-continuum create mode 160000 .config/tmux/plugins/tmux-power create mode 160000 .config/tmux/plugins/tmux-resurrect create mode 100644 .config/zsh/shrink-path.plugin.zsh create mode 160000 .config/zsh/zplug diff --git a/.config/X11/dwm-xinit b/.config/X11/dwm-xinit index 56c81b8..ba21616 100644 --- a/.config/X11/dwm-xinit +++ b/.config/X11/dwm-xinit @@ -5,9 +5,9 @@ exec xrdb ~/.cache/wal/colors.Xresources & exec slstatus & exec picom -CG --config ~/.config/picom.conf & exec xrandr --auto --output HDMI1 --mode 1024x768 --right-of eDP1 & -exec setxkbmap -model -layout us,us -variant ,workman -option grp:alt_shift_toggle & -sleep 0.5s exec xmodmap ~/.config/Xmodmap & +exec setxkbmap -model -layout us,us -variant ,workman -option grp:lctrl_rshift_toggle & +sleep 0.5s exec mpd & source ~/.config/env & exec xset s 300 5 & diff --git a/.config/alacritty.yml b/.config/alacritty.yml index 456a8da..e1420c2 100644 --- a/.config/alacritty.yml +++ b/.config/alacritty.yml @@ -135,7 +135,7 @@ font: style: Bold Italic # Point size - size: 10.0 + size: 11.0 # Offset is the extra space around each character. `offset.y` can be thought of # as modifying the line spacing, and `offset.x` as modifying the letter spacing. diff --git a/.config/env b/.config/env index 338d888..0073c5e 100644 --- a/.config/env +++ b/.config/env @@ -22,6 +22,7 @@ export TODOTXT_DEFAULT_ACTION=ls export TODOTXT_SORT_COMMAND='env LC_COLLATE=C sort -k 2,2 -k 1,1n' # ~/ clean-up +export ZPLUG_HOME="$XDG_CONFIG_HOME/zsh/zplug" export MPD_HOST="$XDG_RUNTIME_DIR/mpd_socket" export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker export SSH_ASKPASS=ssh-askpass @@ -74,6 +75,9 @@ alias cp="cp -iv" alias mv="mv -iv" alias rm="rm -v" alias g="git" +alias gph="git push" +alias gpl="git pull" +alias gc="git commit" alias f="$FILE" alias e="$EDITOR" alias v="$EDITOR" diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 32af217..54ef4a5 100755 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -18,12 +18,10 @@ Plug 'akinsho/nvim-bufferline.lua' Plug 'L3MON4D3/LuaSnip' Plug 'lewis6991/gitsigns.nvim' Plug 'nekonako/xresources-nvim' +Plug 'tpope/vim-obsession' " Wal theme Plug 'dylanaraps/wal.vim' -Plug 'deviantfero/wpgtk.vim' - -Plug 'chriskempson/base16-vim/' " LSP Plug 'neovim/nvim-lspconfig' @@ -52,29 +50,6 @@ fun! GotoWindow(id) MaximizerToggle endfun -" Debugger remaps -nnoremap m :MaximizerToggle! -nnoremap dd :call vimspector#Launch() -nnoremap dc :call GotoWindow(g:vimspector_session_windows.code) -nnoremap dt :call GotoWindow(g:vimspector_session_windows.tagpage) -nnoremap dv :call GotoWindow(g:vimspector_session_windows.variables) -nnoremap dw :call GotoWindow(g:vimspector_session_windows.watches) -nnoremap ds :call GotoWindow(g:vimspector_session_windows.stack_trace) -nnoremap do :call GotoWindow(g:vimspector_session_windows.output) -nnoremap de :call vimspector#Reset() - -nnoremap dtcb :call vimspector#CleanLineBreakpoint() - -nmap dl VimspectorStepInto -nmap dj VimspectorStepOver -nmap dk VimspectorStepOut -nmap d_ VimspectorRestart -nnoremap d :call vimspector#Continue() - -nmap drc VimspectorRunToCursor -nmap dbp VimspectorToggleBreakpoint -nmap dcbp VimspectorToggleConditionalBreakpoint - " VimspectorStop " VimspectorPause " VimspectorAddFunctionBreakpoint @@ -90,9 +65,9 @@ set nobackup set nomodeline set nocompatible set noequalalways -set nowrap -set textwidth=0 -set wrapmargin=0 +set wrap +set textwidth=80 +set wrapmargin=80 set ttimeoutlen=0 set clipboard+=unnamed set autoread @@ -187,8 +162,9 @@ nnoremap ac :center nnoremap ar :right nnoremap al :left -nnoremap bn :next -nnoremap bp :prev +nnoremap bb :buffers +nnoremap bn :bn +nnoremap bp :bp nnoremap bd :bd nnoremap ws :split @@ -210,7 +186,30 @@ vnoremap vnoremap vnoremap -" Telescope +"" Debugger remaps +nnoremap m :MaximizerToggle! +nnoremap dd :call vimspector#Launch() +nnoremap dc :call GotoWindow(g:vimspector_session_windows.code) +nnoremap dt :call GotoWindow(g:vimspector_session_windows.tagpage) +nnoremap dv :call GotoWindow(g:vimspector_session_windows.variables) +nnoremap dw :call GotoWindow(g:vimspector_session_windows.watches) +nnoremap ds :call GotoWindow(g:vimspector_session_windows.stack_trace) + +nnoremap dtcb :call vimspector#CleanLineBreakpoint() + +nmap dl VimspectorStepInto +nmap dj VimspectorStepOver +nmap dk VimspectorStepOut +nmap d_ VimspectorRestart +nnoremap d :call vimspector#Continue() + +nmap drc VimspectorRunToCursor +nmap dbp VimspectorToggleBreakpoint +nmap dcbp VimspectorToggleConditionalBreakpoint + + + +"" Telescope remaps nnoremap ff :Telescope find_files nnoremap fg :Telescope live_grep nnoremap fb :Telescope buffers diff --git a/.config/tmux/plugins/tmux-continuum b/.config/tmux/plugins/tmux-continuum new file mode 160000 index 0000000..6e58336 --- /dev/null +++ b/.config/tmux/plugins/tmux-continuum @@ -0,0 +1 @@ +Subproject commit 6e58336c288958a3b1ff7773fb945770126db16e diff --git a/.config/tmux/plugins/tmux-power b/.config/tmux/plugins/tmux-power new file mode 160000 index 0000000..3116603 --- /dev/null +++ b/.config/tmux/plugins/tmux-power @@ -0,0 +1 @@ +Subproject commit 3116603e33ed123d61053f3b64299831fc4d534e diff --git a/.config/tmux/plugins/tmux-resurrect b/.config/tmux/plugins/tmux-resurrect new file mode 160000 index 0000000..716b958 --- /dev/null +++ b/.config/tmux/plugins/tmux-resurrect @@ -0,0 +1 @@ +Subproject commit 716b958145e2709e9fd3639ff24e1d1e4f26ff77 diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 4d05dab..f03cd57 100755 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -1,12 +1,14 @@ -# List of plugins -set -g @plugin 'tmux-plugins/tpm' -set -g @plugin 'tmux-plugins/tmux-sensible' - # remap prefix from 'C-b' to 'C-a' unbind C-b set-option -g prefix C-a bind-key C-a send-prefix +# Set up window title support to be the machine and whatever window we're +# using; if using session 1 on machine hostname, and looking at window 3 whose +# name is blog, this looks like "1@hostname 3:blog" +set -g set-titles 'on' +set -g set-titles-string '#S@#T #I:#W' + # split panes using | and - bind | split-window -h bind - split-window -v @@ -28,6 +30,42 @@ set-option -g allow-rename on # rename with r bind-key r command-prompt -I "#W" "rename-window '%%'" -#set -g default-terminal "screen-256color-bce" +# use vim keybindings in copy mode +set-option -g mode-keys vi +# setup 'v' to begin selection like in Vim +#bind-key -t vi-copy v begin-selection +#bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" + +# Start window indices at 1 rather than 0; easier switching (C-b 1, C-b 2, ...) +set -g base-index 1 + +set -g default-terminal "xterm-256color" + +# Highlight windows with activity in the status line. +setw -g monitor-activity 'on' + +# Escape-time makes pressing escape not be an escape key within tmux +set -sg escape-time 0 + +# Allow resizing panes quickly with shift+arrows +bind C-S-h resize-pane -L 10 +bind C-S-l resize-pane -R 10 +bind C-S-k resize-pane -U 10 +bind C-S-j resize-pane -D 10 + +bind-key -n C-S-Left swap-window -t -1 +bind-key -n C-S-Right swap-window -t +1 + +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'tmux-plugins/tmux-continuum' +set -g @plugin 'wfxr/tmux-power' +set -g @tmux_power_theme 'redwine' +# last saved environment is automatically restored when tmux is started. +set -g @continuum-restore 'on' +set -g @resurrect-strategy-nvim 'session' +set -g @resurrect-capture-pane-contents 'on' run '~/.config/tmux/plugins/tpm/tpm' diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index ee6a3e5..93851f6 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -51,11 +51,15 @@ bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n' autoload edit-command-line; zle -N edit-command-line bindkey '^e' edit-command-line -# Load syntax highlighting; should be last. -source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null +# shrink-path +source ~/.config/zsh/shrink-path.plugin.zsh +setopt prompt_subst +local current_dir='$(shrink_path -f)' -PS1="%B%{$fg[red]%}[%~] $fg[blue]$%b %{$reset_color%}" +PS1="%B%{$fg[red]%}[$current_dir] $fg[blue]$%b %{$reset_color%}" . ~/.local/bin/z.sh source ~/.config/env +# Load syntax highlighting; should be last. +source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null diff --git a/.config/zsh/shrink-path.plugin.zsh b/.config/zsh/shrink-path.plugin.zsh new file mode 100644 index 0000000..373fd5b --- /dev/null +++ b/.config/zsh/shrink-path.plugin.zsh @@ -0,0 +1,182 @@ +# Shrink directory paths, e.g. /home/me/foo/bar/quux -> ~/f/b/quux. +# +# For a fish-style working directory in your command prompt, add the following +# to your theme or zshrc: +# +# setopt prompt_subst +# PS1='%n@%m $(shrink_path -f)>' +# +# The following options are available: +# +# -f, --fish fish simulation, equivalent to -l -s -t. +# -g, --glob Add asterisk to allow globbing of shrunk path (equivalent to -e "*") +# -l, --last Print the last directory's full name. +# -s, --short Truncate directory names to the number of characters given by -#. Without +# -s, names are truncated without making them ambiguous. +# -t, --tilde Substitute ~ for the home directory. +# -T, --nameddirs Substitute named directories as well. +# -# Truncate each directly to at least this many characters inclusive of the +# ellipsis character(s) (defaulting to 1). +# -e SYMBOL Postfix symbol(s) to indicate that a directory name had been truncated. +# -q, --quote Quote special characters in the shrunk path +# +# The long options can also be set via zstyle, like +# zstyle :prompt:shrink_path fish yes +# +# Note: Directory names containing two or more consecutive spaces are not yet +# supported. +# +# Keywords: prompt directory truncate shrink collapse fish +# +# Copyright (C) 2008 by Daniel Friesel +# License: WTFPL +# +# Ref: https://www.zsh.org/mla/workers/2009/msg00415.html +# https://www.zsh.org/mla/workers/2009/msg00419.html + +shrink_path () { + setopt localoptions + setopt rc_quotes null_glob + + typeset -i lastfull=0 + typeset -i short=0 + typeset -i tilde=0 + typeset -i named=0 + typeset -i length=1 + typeset ellipsis="" + typeset -i quote=0 + typeset -i expand=0 + + if zstyle -t ':prompt:shrink_path' fish; then + lastfull=1 + short=1 + tilde=1 + fi + if zstyle -t ':prompt:shrink_path' nameddirs; then + tilde=1 + named=1 + fi + zstyle -t ':prompt:shrink_path' last && lastfull=1 + zstyle -t ':prompt:shrink_path' short && short=1 + zstyle -t ':prompt:shrink_path' tilde && tilde=1 + zstyle -t ':prompt:shrink_path' glob && ellipsis='*' + zstyle -t ':prompt:shrink_path' quote && quote=1 + zstyle -t ':prompt:shrink_path' expand && expand=1 + + while [[ $1 == -* ]]; do + case $1 in + --) + shift + break + ;; + -f|--fish) + lastfull=1 + short=1 + tilde=1 + ;; + -h|--help) + print 'Usage: shrink_path [-f -l -s -t] [directory]' + print ' -f, --fish fish-simulation, like -l -s -t' + print ' -g, --glob Add asterisk to allow globbing of shrunk path (equivalent to -e "*")' + print ' -l, --last Print the last directory''s full name' + print ' -s, --short Truncate directory names to the number of characters given by -#. Without' + print ' -s, names are truncated without making them ambiguous.' + print ' -t, --tilde Substitute ~ for the home directory' + print ' -T, --nameddirs Substitute named directories as well' + print ' -# Truncate each directly to at least this many characters inclusive of the' + print ' ellipsis character(s) (defaulting to 1).' + print ' -e SYMBOL Postfix symbol(s) to indicate that a directory name had been truncated.' + print ' -q, --quote Quote special characters in the shrunk path' + print ' -x, --expand Print the full path. This takes precedence over the other options' + print '' + print 'The long options can also be set via zstyle, like' + print ' zstyle :prompt:shrink_path fish yes' + return 0 + ;; + -l|--last) lastfull=1 ;; + -s|--short) short=1 ;; + -t|--tilde) tilde=1 ;; + -T|--nameddirs) + tilde=1 + named=1 + ;; + -[0-9]|-[0-9][0-9]) + length=${1/-/} + ;; + -e) + shift + ellipsis="$1" + ;; + -g|--glob) + ellipsis='*' + ;; + -q|--quote) + quote=1 + ;; + -x|--expand) + expand=1 + ;; + esac + shift + done + + typeset -i elllen=${#ellipsis} + typeset -a tree expn + typeset result part dir=${1-$PWD} + typeset -i i + + [[ -d $dir ]] || return 0 + + if (( expand )) { + echo "$dir" + return 0 + } + + if (( named )) { + for part in ${(k)nameddirs}; { + [[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/#${nameddirs[$part]}/\~$part} + } + } + (( tilde )) && dir=${dir/#$HOME/\~} + tree=(${(s:/:)dir}) + ( + if [[ $tree[1] == \~* ]] { + cd -q ${~tree[1]} + result=$tree[1] + shift tree + } else { + cd -q / + } + for dir in $tree; { + if (( lastfull && $#tree == 1 )) { + result+="/$tree" + break + } + expn=(a b) + part='' + i=0 + until [[ $i -gt 99 || ( $i -ge $((length - ellen)) || $dir == $part ) && ( (( ${#expn} == 1 )) || $dir = $expn ) ]]; do + (( i++ )) + part+=$dir[$i] + expn=($(echo ${part}*(-/))) + (( short )) && [[ $i -ge $((length - ellen)) ]] && break + done + + typeset -i dif=$(( ${#dir} - ${#part} - ellen )) + if [[ $dif -gt 0 ]] + then + (( quote )) && part=${(q)part} + part+="$ellipsis" + else + part="$dir" + (( quote )) && part=${(q)part} + fi + result+="/$part" + cd -q $dir + shift tree + } + echo ${result:-/} + ) +} + +## vim:ft=zsh diff --git a/.config/zsh/zplug b/.config/zsh/zplug new file mode 160000 index 0000000..c4dea76 --- /dev/null +++ b/.config/zsh/zplug @@ -0,0 +1 @@ +Subproject commit c4dea766566b168a32dbfa8d10335e525ce39fcc