From 9049a3c071cc0efa4d715d0c09e71437ceba9cae Mon Sep 17 00:00:00 2001 From: Morgan Wattiez Date: Sun, 4 Aug 2019 22:44:51 +0200 Subject: [PATCH] improve vim config + aliases behavior * disable mouse option in vim (not working well with C/C on mac) * improve function for getting article publication dates --- dot_vimrc | 3 +-- dot_zsh_aliases | 1 + dot_zsh_functions | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dot_vimrc b/dot_vimrc index dbdbee2..83ea6a4 100644 --- a/dot_vimrc +++ b/dot_vimrc @@ -30,8 +30,7 @@ set incsearch set hlsearch " Disable error bells set noerrorbells -" Enable mouse in all modes -set mouse=a + " Don’t show the intro message when starting Vim set shortmess=atI " Show the filename in the window titlebar diff --git a/dot_zsh_aliases b/dot_zsh_aliases index 0ce28a5..9f17697 100644 --- a/dot_zsh_aliases +++ b/dot_zsh_aliases @@ -65,6 +65,7 @@ alias ls='lsd' alias pip='pip3' alias c='cat' alias x='extract' +alias current_year='`echo date +"%Y"`' # Show/hide hidden files in Finder alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" diff --git a/dot_zsh_functions b/dot_zsh_functions index b75829c..650b771 100644 --- a/dot_zsh_functions +++ b/dot_zsh_functions @@ -78,5 +78,11 @@ function istherenewissues() { echo "$LASTISSUE" > .newjiraissue } function greppagedate() { - curl -sSL "$*" | \grep datetime | \grep -Eo '[[:digit:]]{4}' | head -n1 + year=$(curl -sSL "$*" | tr '<' '\r' | \egrep -i "date|datetime" -A 1 | \grep -Eo '\b[[:digit:]]{4}\b' | head -n1) + yearint=$(($year + 0)) + currentyear=$(echo `date +"%Y"`) + if [[ $yearint -ge 1970 && $yearint -le $currentyear ]] + then + echo "$yearint" + fi }