truncate history

This commit is contained in:
2020-06-11 21:16:05 +02:00
commit e974a4b480
29 changed files with 3544 additions and 0 deletions

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
vim/.vim/plugged/*
vim/.vim/.netrwhist
wiki
*.old
__*
*.pyc
*.pyo
timers.target.wants

13
README.md Normal file
View File

@@ -0,0 +1,13 @@
# Dotfiles
For managing the configs GNU Stow is used. Every directory represents a
configuration path relative to $HOME.
To install a single configuration(e.g. zsh; stow needs to be installed) just do
```
$ cd Dotfiles
$ stow zsh
...
```
For further reading see `man stow`.

6
borg/.bin/borg_backup Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
source $HOME/.bin/borg_common
info "Starting backup"
borg create --list --verbose --filter AME --stats --show-rc --compression zstd,3 ::'{hostname}-{now}' $BACKUP_PATHS

46
borg/.bin/borg_common Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
read_config() {
# variables
#BACKUP_PATHS="/etc /home/docker/volumes /root"
#KEEP_HOURS=96
#KEEP_DAYS=31
#KEEP_WEEKS=8
#KEEP_MONTHS=12
#KEEP_YEARS=3
#BORG_REPO=ssh://foo@bar:23/dir
#BORG_PASSPHRASE=""
if [[ ! -f "/etc/borg/env" && ! -f "$HOME/.config/borg/env" && ! -f "./env" ]]; then
echo "no config provided"
exit 1
fi
source ./env 2> /dev/null || source $HOME/.config/borg/env 2> /dev/null || source /etc/borg/env 2> /dev/null
}
info() { printf "\n\e[1m%s\e[0m\n" "$*" >&2; }
info "Testing if borg is already running..."
if pgrep -x "borg" &> /dev/null; then
echo "borg is already runnning"
exit 1
fi
echo "Done"
info "Testing connection..."
ping -c 3 192.168.178.100 &> /dev/null
if [[ $? > 0 ]]; then
ping -c 3 1.1.1.1 &> /dev/null
if [[ $? > 0 ]]; then
info "Not connected."
exit 1
fi
fi
echo "Done"
read_config

6
borg/.bin/borg_prune Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
source $HOME/.bin/borg_common
info "Pruning snapshots"
borg prune --list --prefix '{hostname}-' --show-rc --keep-hourly $KEEP_HOURS --keep-daily $KEEP_DAYS --keep-weekly $KEEP_WEEKS --keep-monthly $KEEP_MONTHS --keep-yearly $KEEP_YEARS

View File

@@ -0,0 +1,10 @@
[Unit]
Description=borg backup
Before=borg-prune.service
[Service]
Type=oneshot
ExecStart=%h/.bin/borg_backup
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,10 @@
[Unit]
Description=borg backup
[Timer]
Persistent=true
OnCalendar=hourly
Unit=borg-backup.service
[Install]
WantedBy=timers.target

View File

@@ -0,0 +1,10 @@
[Unit]
Description=prune borg snapshots
After=borg-backup.service
[Service]
Type=oneshot
ExecStart=%h/.bin/borg_prune
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,10 @@
[Unit]
Description=prune borg snapshots
[Timer]
Persistent=true
OnCalendar=daily
Unit=borg-prune.service
[Install]
WantedBy=timers.target

14
git/.config/git/config Normal file
View File

@@ -0,0 +1,14 @@
[user]
name = Marco Kundt
email = mrckndt@riseup.net
[core]
compression = 9
excludesfile = ~/.config/git/ignore
[color]
ui = auto
[diff]
tool = vimdiff
[push]
default = current
[help]
autocorrect = 1

12
git/.config/git/ignore Normal file
View File

@@ -0,0 +1,12 @@
*.error*
*.bak
*.log
*.o
*.old
*.pdf
*.tmp
*.sw[nop]
.*~
Session.vim
tags
.DS_Store

View File

@@ -0,0 +1,185 @@
# This file is part of ranger, the console file manager.
# License: GNU GPL version 3, see the file "AUTHORS" for details.
from __future__ import (absolute_import, division, print_function)
from ranger.gui.colorscheme import ColorScheme
from ranger.gui.color import (
black, blue, cyan, green, magenta, red, white, yellow, default,
normal, bold, reverse, dim, BRIGHT,
default_colors,
)
class Default(ColorScheme):
progress_bar_color = blue
def use(self, context): # pylint: disable=too-many-branches,too-many-statements
fg, bg, attr = default_colors
if context.reset:
return default_colors
elif context.in_browser:
if context.selected:
attr = reverse
else:
attr = normal
if context.empty or context.error:
bg = red
if context.border:
fg = default
if context.media:
if context.image:
fg = yellow
else:
fg = magenta
if context.container:
fg = red
if context.directory:
attr |= bold
fg = blue
fg += BRIGHT
elif context.executable and not \
any((context.media, context.container,
context.fifo, context.socket)):
attr |= bold
fg = green
fg += BRIGHT
if context.socket:
attr |= bold
fg = magenta
fg += BRIGHT
if context.fifo or context.device:
fg = yellow
if context.device:
attr |= bold
fg += BRIGHT
if context.link:
fg = cyan if context.good else magenta
if context.tag_marker and not context.selected:
attr |= bold
if fg in (red, magenta):
fg = white
else:
fg = red
fg += BRIGHT
if not context.selected and (context.cut or context.copied):
attr |= bold
fg = black
fg += BRIGHT
# If the terminal doesn't support bright colors, use dim white
# instead of black.
if BRIGHT == 0:
attr |= dim
fg = white
if context.main_column:
# Doubling up with BRIGHT here causes issues because it's
# additive not idempotent.
if context.selected:
attr |= bold
if context.marked:
attr |= bold
fg = yellow
if context.badinfo:
if attr & reverse:
bg = magenta
else:
fg = magenta
if context.inactive_pane:
fg = cyan
elif context.in_titlebar:
if context.hostname:
fg = red if context.bad else green
elif context.directory:
fg = blue
elif context.tab:
if context.good:
fg = white
bg = green
elif context.link:
fg = cyan
attr |= bold
fg |= BRIGHT
elif context.in_statusbar:
if context.permissions:
if context.good:
fg = cyan
elif context.bad:
fg = magenta
if context.marked:
attr |= bold | reverse
fg = yellow
fg += BRIGHT
if context.frozen:
attr |= bold | reverse
fg = cyan
fg += BRIGHT
if context.message:
if context.bad:
attr |= bold
fg = red
fg += BRIGHT
if context.loaded:
bg = self.progress_bar_color
if context.vcsinfo:
fg = blue
attr &= ~bold
if context.vcscommit:
fg = yellow
attr &= ~bold
if context.vcsdate:
fg = cyan
attr &= ~bold
if context.text:
if context.highlight:
attr |= reverse
if context.in_taskview:
if context.title:
fg = blue
if context.selected:
attr |= reverse
if context.loaded:
if context.selected:
fg = self.progress_bar_color
else:
bg = self.progress_bar_color
if context.vcsfile and not context.selected:
attr &= ~bold
if context.vcsconflict:
fg = magenta
elif context.vcsuntracked:
fg = cyan
elif context.vcschanged:
fg = red
elif context.vcsunknown:
fg = red
elif context.vcsstaged:
fg = green
elif context.vcssync:
fg = green
elif context.vcsignored:
fg = default
elif context.vcsremote and not context.selected:
attr &= ~bold
if context.vcssync or context.vcsnone:
fg = green
elif context.vcsbehind:
fg = red
elif context.vcsahead:
fg = blue
elif context.vcsdiverged:
fg = magenta
elif context.vcsunknown:
fg = red
return fg, bg, attr

View File

@@ -0,0 +1,5 @@
set preview_max_size 10485760
set update_title true
set dirname_in_tabs true
set vcs_aware true
set preview_script ~/.config/ranger/scope.sh

216
ranger/.config/ranger/scope.sh Executable file
View File

@@ -0,0 +1,216 @@
#!/usr/bin/env bash
set -o noclobber -o noglob -o nounset -o pipefail
IFS=$'\n'
# If the option `use_preview_script` is set to `true`,
# then this script will be called and its output will be displayed in ranger.
# ANSI color codes are supported.
# STDIN is disabled, so interactive scripts won't work properly
# This script is considered a configuration file and must be updated manually.
# It will be left untouched if you upgrade ranger.
# Meanings of exit codes:
# code | meaning | action of ranger
# -----+------------+-------------------------------------------
# 0 | success | Display stdout as preview
# 1 | no preview | Display no preview at all
# 2 | plain text | Display the plain content of the file
# 3 | fix width | Don't reload when width changes
# 4 | fix height | Don't reload when height changes
# 5 | fix both | Don't ever reload
# 6 | image | Display the image `$IMAGE_CACHE_PATH` points to as an image preview
# 7 | image | Display the file directly as an image
# Script arguments
FILE_PATH="${1}" # Full path of the highlighted file
PV_WIDTH="${2}" # Width of the preview pane (number of fitting characters)
PV_HEIGHT="${3}" # Height of the preview pane (number of fitting characters)
IMAGE_CACHE_PATH="${4}" # Full path that should be used to cache image preview
PV_IMAGE_ENABLED="${5}" # 'True' if image previews are enabled, 'False' otherwise.
FILE_EXTENSION="${FILE_PATH##*.}"
FILE_EXTENSION_LOWER=$(echo ${FILE_EXTENSION} | tr '[:upper:]' '[:lower:]')
# Settings
HIGHLIGHT_SIZE_MAX=262143 # 256KiB
HIGHLIGHT_TABWIDTH=8
HIGHLIGHT_STYLE='pablo'
PYGMENTIZE_STYLE='autumn'
handle_extension() {
case "${FILE_EXTENSION_LOWER}" in
# Archive
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
atool --list -- "${FILE_PATH}" && exit 5
bsdtar --list --file "${FILE_PATH}" && exit 5
exit 1;;
rar)
# Avoid password prompt by providing empty password
unrar lt -p- -- "${FILE_PATH}" && exit 5
exit 1;;
7z)
# Avoid password prompt by providing empty password
7z l -p -- "${FILE_PATH}" && exit 5
exit 1;;
# PDF
pdf)
# Preview as text conversion
pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - | fmt -w ${PV_WIDTH} && exit 5
mutool draw -F txt -i -- "${FILE_PATH}" 1-10 | fmt -w ${PV_WIDTH} && exit 5
exiftool "${FILE_PATH}" && exit 5
exit 1;;
# BitTorrent
torrent)
transmission-show -- "${FILE_PATH}" && exit 5
exit 1;;
# OpenDocument
odt|ods|odp|sxw)
# Preview as text conversion
odt2txt "${FILE_PATH}" && exit 5
exit 1;;
# HTML
htm|html|xhtml)
# Preview as text conversion
w3m -dump "${FILE_PATH}" && exit 5
lynx -dump -- "${FILE_PATH}" && exit 5
elinks -dump "${FILE_PATH}" && exit 5
;; # Continue with next handler on failure
esac
}
handle_image() {
local mimetype="${1}"
case "${mimetype}" in
# SVG
# image/svg+xml)
# convert "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6
# exit 1;;
# Image
image/*)
local orientation
orientation="$( identify -format '%[EXIF:Orientation]\n' -- "${FILE_PATH}" )"
# If orientation data is present and the image actually
# needs rotating ("1" means no rotation)...
if [[ -n "$orientation" && "$orientation" != 1 ]]; then
# ...auto-rotate the image according to the EXIF data.
convert -- "${FILE_PATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6
fi
# `w3mimgdisplay` will be called for all images (unless overriden as above),
# but might fail for unsupported types.
exit 7;;
# Video
# video/*)
# # Thumbnail
# ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6
# exit 1;;
# PDF
# application/pdf)
# pdftoppm -f 1 -l 1 \
# -scale-to-x 1920 \
# -scale-to-y -1 \
# -singlefile \
# -jpeg -tiffcompression jpeg \
# -- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \
# && exit 6 || exit 1;;
# Preview archives using the first image inside.
# (Very useful for comic book collections for example.)
# application/zip|application/x-rar|application/x-7z-compressed|\
# application/x-xz|application/x-bzip2|application/x-gzip|application/x-tar)
# local fn=""; local fe=""
# local zip=""; local rar=""; local tar=""; local bsd=""
# case "${mimetype}" in
# application/zip) zip=1 ;;
# application/x-rar) rar=1 ;;
# application/x-7z-compressed) ;;
# *) tar=1 ;;
# esac
# { [ "$tar" ] && fn=$(tar --list --file "${FILE_PATH}"); } || \
# { fn=$(bsdtar --list --file "${FILE_PATH}") && bsd=1 && tar=""; } || \
# { [ "$rar" ] && fn=$(unrar lb -p- -- "${FILE_PATH}"); } || \
# { [ "$zip" ] && fn=$(zipinfo -1 -- "${FILE_PATH}"); } || return
#
# fn=$(echo "$fn" | python -c "import sys; import mimetypes as m; \
# [ print(l, end='') for l in sys.stdin if \
# (m.guess_type(l[:-1])[0] or '').startswith('image/') ]" |\
# sort -V | head -n 1)
# [ "$fn" = "" ] && return
# [ "$bsd" ] && fn=$(printf '%b' "$fn")
#
# [ "$tar" ] && tar --extract --to-stdout \
# --file "${FILE_PATH}" -- "$fn" > "${IMAGE_CACHE_PATH}" && exit 6
# fe=$(echo -n "$fn" | sed 's/[][*?\]/\\\0/g')
# [ "$bsd" ] && bsdtar --extract --to-stdout \
# --file "${FILE_PATH}" -- "$fe" > "${IMAGE_CACHE_PATH}" && exit 6
# [ "$bsd" ] || [ "$tar" ] && rm -- "${IMAGE_CACHE_PATH}"
# [ "$rar" ] && unrar p -p- -inul -- "${FILE_PATH}" "$fn" > \
# "${IMAGE_CACHE_PATH}" && exit 6
# [ "$zip" ] && unzip -pP "" -- "${FILE_PATH}" "$fe" > \
# "${IMAGE_CACHE_PATH}" && exit 6
# [ "$rar" ] || [ "$zip" ] && rm -- "${IMAGE_CACHE_PATH}"
# ;;
esac
}
handle_mime() {
local mimetype="${1}"
case "${mimetype}" in
# Text
text/* | */xml)
# Syntax highlight
if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then
exit 2
fi
if [[ "$( tput colors )" -ge 256 ]]; then
local pygmentize_format='terminal256'
local highlight_format='xterm256'
else
local pygmentize_format='terminal'
local highlight_format='ansi'
fi
# highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \
--style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}" && exit 5
# pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}" -- "${FILE_PATH}" && exit 5
exit 2;;
# Image
image/*)
# Preview as text conversion
# img2txt --gamma=0.6 --width="${PV_WIDTH}" -- "${FILE_PATH}" && exit 4
exiftool "${FILE_PATH}" && exit 5
exit 1;;
# Video and audio
video/* | audio/*)
mediainfo "${FILE_PATH}" && exit 5
exiftool "${FILE_PATH}" && exit 5
exit 1;;
esac
}
handle_fallback() {
echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}" && exit 5
exit 1
}
MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )"
if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then
handle_image "${MIMETYPE}"
fi
handle_extension
handle_mime "${MIMETYPE}"
handle_fallback
exit 1

7
restic/.bin/restic_backup Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
source $HOME/.bin/restic_common
info "Starting backup"
restic -r $RESTIC_REPOSITORY unlock
restic --cache-dir $CACHE_DIR -r $RESTIC_REPOSITORY backup $BACKUP_PATHS $BACKUP_EXCLUDES

50
restic/.bin/restic_common Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/bash
read_config() {
# variables
#CACHE_DIR="$HOME/.cache/restic"
#BACKUP_PATHS="/etc /home/docker/volumes /root"
#BACKUP_EXCLUDES="-e /home/docker/volumes/syncthing"
#KEEP_HOURS=96
#KEEP_DAYS=31
#KEEP_WEEKS=8
#KEEP_MONTHS=12
#KEEP_YEARS=3
#RESTIC_REPOSITORY="b2:backup"
#RESTIC_PASSWORD="PASSWORD"
#B2_ACCOUNT_ID="ID"
#B2_ACCOUNT_KEY="KEY"
if [[ ! -f "/etc/restic/env" && ! -f "$HOME/.config/restic/env" && ! -f "./env" ]]; then
echo "no config provided"
exit 1
fi
source ./env 2> /dev/null || source $HOME/.config/restic/env 2> /dev/null || source /etc/restic/env 2> /dev/null
}
info() { printf "\n\e[1m%s\e[0m\n" "$*" >&2; }
info "Testing if restic is already running..."
if pgrep -x "restic" &> /dev/null; then
echo "Restic is already runnning"
exit 1
fi
echo "Done"
info "Testing connection..."
ping -c 3 192.168.178.100 &> /dev/null
if [[ $? > 0 ]]; then
ping -c 3 1.1.1.1 &> /dev/null
if [[ $? > 0 ]]; then
info "Not connected."
exit 1
fi
fi
echo "Done"
read_config

11
restic/.bin/restic_prune Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
source $HOME/.bin/restic_common
info "Forgetting snapshots"
restic -r $RESTIC_REPOSITORY unlock
restic --cache-dir $CACHE_DIR -r $RESTIC_REPOSITORY forget --keep-hourly $KEEP_HOURS --keep-daily $KEEP_DAYS --keep-weekly $KEEP_WEEKS --keep-monthly $KEEP_WEEKS --keep-yearly $KEEP_YEARS
info "Pruning snapshots"
restic -r $RESTIC_REPOSITORY unlock
restic --cache-dir $CACHE_DIR -r $RESTIC_REPOSITORY prune

View File

@@ -0,0 +1,10 @@
[Unit]
Description=borg backup
Before=restic-prune.service
[Service]
Type=oneshot
ExecStart=%h/.bin/restic_backup
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,10 @@
[Unit]
Description=restic backup
[Timer]
Persistent=true
OnCalendar=hourly
Unit=restic-backup.service
[Install]
WantedBy=timers.target

View File

@@ -0,0 +1,10 @@
[Unit]
Description=prune borg snapshots
After=restic-backup.service
[Service]
Type=oneshot
ExecStart=%h/.bin/restic_prune
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,10 @@
[Unit]
Description=prune restic snapshots
[Timer]
Persistent=true
OnCalendar=daily
Unit=restic-prune.service
[Install]
WantedBy=timers.target

1
ruby/.gemrc Normal file
View File

@@ -0,0 +1 @@
gem: --bindir ~/.gem/bin --user-install --no-rdoc --no-ri

36
tmux/.tmux.conf Normal file
View File

@@ -0,0 +1,36 @@
set -s escape-time 0
set -g base-index 1
set -g default-terminal 'screen-256color'
set -g history-limit 10000
set -g monitor-activity on
set -g mouse on
set -g renumber-windows on
set -g set-titles on
set -g status-interval 10
set-option -g status-style fg=black,bg=cyan
set-option -g pane-border-style fg=black
set-option -g pane-active-border-style fg=cyan
if-shell -b '[ "$(uname)" = "Darwin" ]' \
'set -g status-right "#(whoami)@#(hostname) | #(sysctl -n vm.loadavg | cut -f2 -d \" \") | %H:%M"'
if-shell -b '[ "$(uname)" = "Linux" ]' \
'set -g status-right "#(whoami)@#(hostname) | #(cut -f1 -d \" \" < /proc/loadavg) | %H:%M"'
setw -g aggressive-resize on
setw -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
unbind C-b
set -g prefix C-x
bind C-x send-prefix
bind a set-window-option synchronize-panes
bind-key -T root PPage if-shell -F "#{alternate_on}" "send-keys PPage" "copy-mode -e; send-keys PPage"
bind-key -T root NPage if-shell -F "#{alternate_on}" "send-keys NPage" "copy-mode -e; send-keys NPage"

1
vim/.config/nvim Symbolic link
View File

@@ -0,0 +1 @@
../.vim

2664
vim/.vim/autoload/plug.vim Normal file

File diff suppressed because it is too large Load Diff

1
vim/.vim/init.vim Symbolic link
View File

@@ -0,0 +1 @@
../.vimrc

78
vim/.vimrc Executable file
View File

@@ -0,0 +1,78 @@
if (&t_Co == 256 || &term == "xterm-256color" || &term == "screen-256color")
call plug#begin('~/.vim/plugged')
Plug 'flexo3001/vim-colors-solarized'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'mhinz/vim-signify'
Plug 'tpope/vim-eunuch'
call plug#end()
let $FZF_DEFAULT_COMMAND = 'find .'
let g:signify_realtime = 1
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'fg+': ['fg', 'Normal'],
\ 'bg+': ['bg', 'CursorLine'],
\ 'hl': ['fg', 'Error'],
\ 'hl+': ['fg', 'Error'],
\ 'pointer': ['fg', 'Normal'],
\ 'info': ['fg', 'Comment'],
\ 'prompt': ['fg', 'Normal'],
\ 'spinner': ['fg', 'Normal'],
\ 'border': ['fg', 'StatusLine'],
\ 'header': ['fg', 'Normal']}
if has('nvim')
autocmd! FileType fzf
autocmd FileType fzf set laststatus=0 noshowmode noruler
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
endif
set background=light
colorscheme solarized
endif
filetype plugin indent on
set autowrite
set expandtab
set ignorecase
set incsearch
set laststatus=2
set linebreak
set list listchars=trail,tab:▸\ ,eol
set nojoinspaces
set number
set printoptions=paper:A4,syntax:n,number:y
set shiftwidth=4
set showbreak=↪\
set smartindent
set statusline=%#Visual#[%n]%#Statusline#\ %<%f\ %h%w%m%r%=%{&fileencoding?&fileencoding:&encoding}[%{&fileformat}\]\ %y\ %l,%c%V\ %P
set textwidth=80
set wrapscan
let mapleader=" "
let maplocalleader=" "
nnoremap <silent> <Leader>p :set paste!<CR>
nnoremap <silent> <Leader>h :nohlsearch<CR>
nnoremap <silent> <Leader>s
\ : if exists("syntax_on") <BAR>
\ syntax off <BAR>
\ else <BAR>
\ syntax enable <BAR>
\ endif<CR>
nnoremap <silent> <Leader>f :FZF<CR>
nnoremap <silent> <Leader>b :Buffers<CR>
nnoremap <silent> gB :bp<CR>
nnoremap <silent> gb :bn<CR>
augroup flexo
autocmd!
autocmd BufNewFile,BufRead *.pdc,*.pandoc setlocal filetype=markdown
autocmd FileType puppet setlocal tw=140
autocmd FileType sh,zsh,ruby,vim,yaml setlocal sw=2
autocmd Filetype go setlocal noexpandtab
augroup END

14
zsh/.zshenv Normal file
View File

@@ -0,0 +1,14 @@
export GOPATH="$HOME/.go"
export GOPATH="$GOPATH:$HOME/Development/go"
export PATH="$HOME/.cargo/bin:$HOME/.gem/bin:$HOME/.go/bin:$GOPATH/bin:$HOME/.bin:$HOME/.local/bin:/usr/local/go/bin:$PATH"
if [[ -x /usr/bin/nvim ]]; then
EDITOR="nvim"
else
EDITOR="vim"
fi
export EDITOR=$EDITOR
export VISUAL=$EDITOR
export QT_QPA_PLATFORM=xcb

90
zsh/.zshrc Normal file
View File

@@ -0,0 +1,90 @@
autoload -U +X colors && colors
autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit
autoload -Uz vcs_info
setopt completeinword
setopt extended_glob
setopt noflowcontrol
setopt prompt_subst
unsetopt nomatch
HISTFILE=${HOME}/.zsh_history
HISTSIZE=500000
SAVEHIST=$HISTSIZE
setopt share_history
setopt append_history
setopt extended_history
setopt histignorealldups
setopt histignorespace
bindkey -e
bindkey "^r" history-incremental-search-backward
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init() {
echoti smkx
}
function zle-line-finish() {
echoti rmkx
}
zle -N zle-line-init
zle -N zle-line-finish
fi
if [[ "${terminfo[khome]}" != "" ]]; then
bindkey "${terminfo[khome]}" beginning-of-line
fi
if [[ "${terminfo[kend]}" != "" ]]; then
bindkey "${terminfo[kend]}" end-of-line
fi
if [[ "${terminfo[kcbt]}" != "" ]]; then
bindkey "${terminfo[kcbt]}" reverse-menu-complete
fi
if [[ "${terminfo[kdch1]}" != "" ]]; then
bindkey "${terminfo[kdch1]}" delete-char
else
# fallbacks
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char
fi
zstyle ':completion:*:commands' rehash 1
zstyle ':completion:*' completer _oldlist _expand _complete _files _ignored
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*' use-cache yes
zstyle ':completion:*' menu select=5
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats "[%{$fg_bold[magenta]%}%b%{$reset_color%}]"
zstyle ':vcs_info:*' actionformats "[%{$fg_bold[magenta]%}%b%{$reset_color%}|%a]"
PROMPT="(%M) %~ %{$fg[red]%}%(#~#~$)%{$reset_color%} "
RPROMPT="\$vcs_info_msg_0_"
precmd () {
print -Pn "\e]0;(%M) %~\a"
vcs_info
}
preexec () {
print -Pn "\e]0;(%M) $1\a"
}
alias :q="exit"
alias ..="cd .."
alias open="xdg-open"
wttr() {
curl wttr.in/$1
}
sshn() {
ssh -N -L ${1}:localhost:${2} $3
}