diff --git a/.bashrc b/.bashrc index cee9edc..7657dba 100644 --- a/.bashrc +++ b/.bashrc @@ -171,7 +171,7 @@ if [ -e ~/.ssh/config.d ]; then #if find ~/.ssh/config.d -mindepth 1 -print -quit | grep -q .; then # Do we have config files in that directory? if find ~/.ssh/config.d -print -quit | grep -q .; then - newestconfig=$(find ~/.ssh/config.d/* -printf '%T+ %p\n' | sort -r | head -n1 | awk '{print $2}') + newestconfig=$(find ~/.ssh/config.d/* -printf '@T+ %p\n' | sort -r | head -n1 | awk '{print $2}') if [ "$newestconfig" -nt ~/.ssh/config ]; then # We found a config that's newer than the generated config file, re-generate [ -e ~/.ssh/config ] && mv ~/.ssh/config ~/.ssh/config.bak.$(date -Ins) diff --git a/.config/fish/fishfile b/.config/fish/fishfile index 6c68a89..13c6386 100644 --- a/.config/fish/fishfile +++ b/.config/fish/fishfile @@ -4,3 +4,4 @@ fisherman/getopts oh-my-fish/plugin-grc fisherman/nvm fisherman/shark +fisherman/z diff --git a/.gitconfig b/.gitconfig index e371364..a7e8025 100644 --- a/.gitconfig +++ b/.gitconfig @@ -17,6 +17,7 @@ ci = commit br = branch c = commit -am + shame = blame [push] default = simple diff --git a/.vimrc b/.vimrc index e155441..14eb6f2 100644 --- a/.vimrc +++ b/.vimrc @@ -6,6 +6,9 @@ set shell=/bin/bash +" change the key from \ to , +let mapleader="," + " Vundle manages the plugins " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim @@ -156,7 +159,7 @@ Plugin 'Valloric/YouCompleteMe' " Code checker. For python, install flake8 or pylint, preferably in the " virtualenv. For Django support, install pylint-django -Plugin 'vim-syntastic/syntastic' +"Plugin 'vim-syntastic/syntastic' set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* @@ -187,6 +190,25 @@ let g:syntastic_python_pylint_post_args="--max-line-length=120 -d C0103,C0111" "let g:syntastic_python_pylint_exe = 'python $(which pylint)' +" Code checker. For python, install flake8 or pylint, preferably in the +" virtualenv. For Django support, install pylint-django +Plugin 'w0rp/ale' +nmap = (ale_fix) +" Quickly open the loclist to see syntax errors +nmap ; :lopen +let g:ale_maximum_file_size = 500000 " Don't lint large files (> 500KB), it can slow things down +let g:ale_fixers = {} +" Python specific settings +let g:ale_fixers.python = ['isort'] +" No silly 80-char line limit. Sorry pep-8. Also, Django support. Disable 'invalid name', 'missing docstring' +let g:ale_python_pylint_options="--max-line-length=120 -d C0103,C0111" +" Show errors or warnings in the statusline +let g:airline#extensions#ale#enabled = 1 +" UI +let g:ale_sign_error = '✗' +let g:ale_sign_warning = '⚠' + + " Handy Markdown stuff "Plugin 'tpope/vim-markdown' Plugin 'godlygeek/tabular' @@ -262,8 +284,6 @@ set list set dictionary+=/usr/share/dict/words " use ctrl-n ctrl-n instead of ctrl-x ctrl-k set complete-=k complete+=k -" change the key from \ to , -let mapleader="," " Quickly edit/reload the vimrc file nmap ev :e $MYVIMRC nmap sv :so $MYVIMRC diff --git a/bin/sorter b/bin/sorter index cbe6c71..0885f80 100755 --- a/bin/sorter +++ b/bin/sorter @@ -4,18 +4,71 @@ # E.g., log_1.txt log_2.txt have a common prefix 'log' with length 3, so # `sorter 3` will create dir 'log' and move both files there -LIMIT=6 -if [ ! -z "$1" ]; then - LIMIT=$1 +if [ ! -z "$2" ] && [ ! -z "$1" ]; then + LIMIT=$2 +elif [ -z "$2" ] && [ ! -z "$1" ]; then + echo "Provide a length for the prefix or strip-from-behind" + exit fi -for PATTERN in $(ls -1|cut -c 1-$LIMIT|sort|uniq); do - echo $PATTERN - mkdir -p "$PATTERN" - # mv does not work :) - #mv "${PATTERN}*.*" "$PATTERN/" - for FILE in $(find . -type f | grep "$PATTERN"); do - echo $FILE - mv "$FILE" "${PATTERN}/" +if [ "$1" == "f" ]; then + # From the front + for PATTERN in $(find . -maxdepth 1 -type f|cut -c 3-$((LIMIT + 2))|sort|uniq); do + # Offset LIMIT by two to skip the './' in front of every filename + echo $PATTERN + mkdir -p "$PATTERN" + # mv does not work :) + #mv "${PATTERN}*.*" "$PATTERN/" + for FILE in $(find . -maxdepth 1 -type f | grep "$PATTERN"); do + #echo $FILE + mv "$FILE" "${PATTERN}/" + done done -done +elif [ "$1" == "fe" ]; then + # From the front + for PATTERN in $(find . -maxdepth 1 -type f|cut -c 3-$((LIMIT + 2))|sort|uniq); do + echo $PATTERN + #for FILE in $(find . -maxdepth 1 -type f | grep "$PATTERN"); do + # echo $FILE + #done + done +elif [ "$1" == "b" ]; then + # From the back + for PATTERN in $(find . -maxdepth 1 -type f|rev|cut -c $LIMIT-|rev|sort|uniq); do + echo $PATTERN + mkdir -p "$PATTERN" + + for FILE in $(find . -maxdepth 1 -type f | grep "$PATTERN"); do + #echo $FILE + mv "$FILE" "${PATTERN}/" + done + done +elif [ "$1" == "be" ]; then + # From the back + for PATTERN in $(find . -maxdepth 1 -type f|rev|cut -c $LIMIT-|rev|sort|uniq); do + echo $PATTERN + #for FILE in $(find . -maxdepth 1 -type f | grep "$PATTERN"); do + # echo $FILE + #done + done +else + echo "sorter - Files-into-structured-directories sorter" + echo + echo "Sort files with a prefix of LIMIT length into dirs with the same name" + echo "as the prefix" + echo "E.g., log_1.txt log_2.txt have a common prefix 'log' with length 3," + echo "so 'sorter 3' will create dir 'log' and move both files there" + echo + echo "usage: sorter OPTION LIMIT" + echo + echo "OPTION:" + echo " f create directories based on the prefix from the front LIMIT" + echo " characters" + echo " fe emulate the above, print would-be results" + echo " b create directories based on the prefix that's left when stripping" + echo " LIMIT characters from the back" + echo " be emulate the above, print would-be results" + echo + echo "LIMIT: length of prefix or strip-from-behind" + echo +fi