mirror of
https://github.com/aquatix/dotfiles.git
synced 2025-12-07 02:25:11 +01:00
Merge branch 'master' of github.com:aquatix/dotfiles
This commit is contained in:
2
.bashrc
2
.bashrc
@@ -171,7 +171,7 @@ if [ -e ~/.ssh/config.d ]; then
|
|||||||
#if find ~/.ssh/config.d -mindepth 1 -print -quit | grep -q .; then
|
#if find ~/.ssh/config.d -mindepth 1 -print -quit | grep -q .; then
|
||||||
# Do we have config files in that directory?
|
# Do we have config files in that directory?
|
||||||
if find ~/.ssh/config.d -print -quit | grep -q .; then
|
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
|
if [ "$newestconfig" -nt ~/.ssh/config ]; then
|
||||||
# We found a config that's newer than the generated config file, re-generate
|
# 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)
|
[ -e ~/.ssh/config ] && mv ~/.ssh/config ~/.ssh/config.bak.$(date -Ins)
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ fisherman/getopts
|
|||||||
oh-my-fish/plugin-grc
|
oh-my-fish/plugin-grc
|
||||||
fisherman/nvm
|
fisherman/nvm
|
||||||
fisherman/shark
|
fisherman/shark
|
||||||
|
fisherman/z
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
ci = commit
|
ci = commit
|
||||||
br = branch
|
br = branch
|
||||||
c = commit -am
|
c = commit -am
|
||||||
|
shame = blame
|
||||||
|
|
||||||
[push]
|
[push]
|
||||||
default = simple
|
default = simple
|
||||||
|
|||||||
26
.vimrc
26
.vimrc
@@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
set shell=/bin/bash
|
set shell=/bin/bash
|
||||||
|
|
||||||
|
" change the <Leader> key from \ to ,
|
||||||
|
let mapleader=","
|
||||||
|
|
||||||
" Vundle manages the plugins
|
" Vundle manages the plugins
|
||||||
" set the runtime path to include Vundle and initialize
|
" set the runtime path to include Vundle and initialize
|
||||||
set rtp+=~/.vim/bundle/Vundle.vim
|
set rtp+=~/.vim/bundle/Vundle.vim
|
||||||
@@ -156,7 +159,7 @@ Plugin 'Valloric/YouCompleteMe'
|
|||||||
|
|
||||||
" Code checker. For python, install flake8 or pylint, preferably in the
|
" Code checker. For python, install flake8 or pylint, preferably in the
|
||||||
" virtualenv. For Django support, install pylint-django
|
" virtualenv. For Django support, install pylint-django
|
||||||
Plugin 'vim-syntastic/syntastic'
|
"Plugin 'vim-syntastic/syntastic'
|
||||||
set statusline+=%#warningmsg#
|
set statusline+=%#warningmsg#
|
||||||
set statusline+=%{SyntasticStatuslineFlag()}
|
set statusline+=%{SyntasticStatuslineFlag()}
|
||||||
set statusline+=%*
|
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)'
|
"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 <leader>= <Plug>(ale_fix)
|
||||||
|
" Quickly open the loclist to see syntax errors
|
||||||
|
nmap <leader>; :lopen<CR>
|
||||||
|
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
|
" Handy Markdown stuff
|
||||||
"Plugin 'tpope/vim-markdown'
|
"Plugin 'tpope/vim-markdown'
|
||||||
Plugin 'godlygeek/tabular'
|
Plugin 'godlygeek/tabular'
|
||||||
@@ -262,8 +284,6 @@ set list
|
|||||||
set dictionary+=/usr/share/dict/words
|
set dictionary+=/usr/share/dict/words
|
||||||
" use ctrl-n ctrl-n instead of ctrl-x ctrl-k
|
" use ctrl-n ctrl-n instead of ctrl-x ctrl-k
|
||||||
set complete-=k complete+=k
|
set complete-=k complete+=k
|
||||||
" change the <Leader> key from \ to ,
|
|
||||||
let mapleader=","
|
|
||||||
" Quickly edit/reload the vimrc file
|
" Quickly edit/reload the vimrc file
|
||||||
nmap <silent> <leader>ev :e $MYVIMRC<CR>
|
nmap <silent> <leader>ev :e $MYVIMRC<CR>
|
||||||
nmap <silent> <leader>sv :so $MYVIMRC<CR>
|
nmap <silent> <leader>sv :so $MYVIMRC<CR>
|
||||||
|
|||||||
77
bin/sorter
77
bin/sorter
@@ -4,18 +4,71 @@
|
|||||||
# E.g., log_1.txt log_2.txt have a common prefix 'log' with length 3, so
|
# 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
|
# `sorter 3` will create dir 'log' and move both files there
|
||||||
|
|
||||||
LIMIT=6
|
if [ ! -z "$2" ] && [ ! -z "$1" ]; then
|
||||||
if [ ! -z "$1" ]; then
|
LIMIT=$2
|
||||||
LIMIT=$1
|
elif [ -z "$2" ] && [ ! -z "$1" ]; then
|
||||||
|
echo "Provide a length for the prefix or strip-from-behind"
|
||||||
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for PATTERN in $(ls -1|cut -c 1-$LIMIT|sort|uniq); do
|
if [ "$1" == "f" ]; then
|
||||||
echo $PATTERN
|
# From the front
|
||||||
mkdir -p "$PATTERN"
|
for PATTERN in $(find . -maxdepth 1 -type f|cut -c 3-$((LIMIT + 2))|sort|uniq); do
|
||||||
# mv does not work :)
|
# Offset LIMIT by two to skip the './' in front of every filename
|
||||||
#mv "${PATTERN}*.*" "$PATTERN/"
|
echo $PATTERN
|
||||||
for FILE in $(find . -type f | grep "$PATTERN"); do
|
mkdir -p "$PATTERN"
|
||||||
echo $FILE
|
# mv does not work :)
|
||||||
mv "$FILE" "${PATTERN}/"
|
#mv "${PATTERN}*.*" "$PATTERN/"
|
||||||
|
for FILE in $(find . -maxdepth 1 -type f | grep "$PATTERN"); do
|
||||||
|
#echo $FILE
|
||||||
|
mv "$FILE" "${PATTERN}/"
|
||||||
|
done
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user