From e99c54d85b5b1df5bf44239aacaac8252c336a89 Mon Sep 17 00:00:00 2001 From: Luna Komorebi Date: Sat, 8 Apr 2023 00:49:50 +0200 Subject: [PATCH] Add history file and command configuration, and create script for converting URL to markdown link --- .zshrc | 16 +++++++++++++++- bin/mgv | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 bin/mgv diff --git a/.zshrc b/.zshrc index 5bcc2a8..c103159 100644 --- a/.zshrc +++ b/.zshrc @@ -1,3 +1,6 @@ +iscmd() { + command -v "$1" > /dev/null +} if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi @@ -11,9 +14,19 @@ source $OTHER/powerlevel_settings.sh plugins=(git docker docker-compose virtualenv) +## History file configuration +HISTFILE="$HOME/.zsh_history" +HISTSIZE=50000000 +SAVEHIST=10000000 + +## History command configuration +setopt extended_history # record timestamp of command in HISTFILE +setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE +setopt hist_ignore_dups # ignore duplicated commands history list +setopt hist_ignore_space # ignore commands that start with space +setopt hist_verify # show command with history expansion to user before running it export EDITOR=nvim -#export JAVA_HOME= export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket" for f in $OTHER/*.zsh; do @@ -29,6 +42,7 @@ if [ -d "$HOME/.zsh-custom" ]; then fi done fi + DISABLE_MAGIC_FUNCTIONS=true source $ZSH/oh-my-zsh.sh # autoload -Uz compinit && compinit -i diff --git a/bin/mgv b/bin/mgv new file mode 100644 index 0000000..7450a6c --- /dev/null +++ b/bin/mgv @@ -0,0 +1,2 @@ +#!/bin/sh +xclip -o -t text/plain | sed -E 's|.*/(.*)|[`\1`](\0)|' | xclip -selection clipboard