From a2212c8b1a5ed65f55838b72dd8f00e183cbe33c Mon Sep 17 00:00:00 2001 From: Ein Verne Date: Wed, 8 Jul 2020 18:38:44 +0800 Subject: [PATCH] Update dotfiles --- .gitmodules | 3 --- .vim/bundle/Vundle.vim | 1 - .vim/startup/easymotion_vimrc | 18 ++++++++++++++++++ .vim/startup/vundle_vimrc | 1 + .vimrc | 1 + clone-all-gitlab.py | 23 +++++++++++++++++++++++ conf/zsh/alias.zsh | 5 +++++ conf/zsh/common.zsh | 4 +++- wp-completion.bash | 23 +++++++++++++++++++++++ 9 files changed, 74 insertions(+), 5 deletions(-) delete mode 160000 .vim/bundle/Vundle.vim create mode 100644 .vim/startup/easymotion_vimrc create mode 100644 clone-all-gitlab.py create mode 100644 wp-completion.bash diff --git a/.gitmodules b/.gitmodules index 9eb7fea..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule ".vim/bundle/Vundle.vim"] - path = .vim/bundle/Vundle.vim - url = https://github.com/VundleVim/Vundle.vim.git diff --git a/.vim/bundle/Vundle.vim b/.vim/bundle/Vundle.vim deleted file mode 160000 index 9a38216..0000000 --- a/.vim/bundle/Vundle.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9a38216a1c0c597f978d73547d37681fc689c90d diff --git a/.vim/startup/easymotion_vimrc b/.vim/startup/easymotion_vimrc new file mode 100644 index 0000000..632dd4d --- /dev/null +++ b/.vim/startup/easymotion_vimrc @@ -0,0 +1,18 @@ + +"Turn on case insensitive feature +let g:EasyMotion_smartcase = 1 +"Use upper target labels and type as a lower case +let g:EasyMotion_use_upper = 1 + +" move to character +nmap f (easymotion-s2) +xmap f (easymotion-s2) +omap f (easymotion-s2) +" move to word +nmap F (easymotion-bd-w) +xmap F (easymotion-bd-w) +omap F (easymotion-bd-w) +" move to line +nmap gl (easymotion-bd-jk) +xmap gl (easymotion-bd-jk) +omap gl (easymotion-bd-jk) diff --git a/.vim/startup/vundle_vimrc b/.vim/startup/vundle_vimrc index 4e5c40d..ce9b664 100644 --- a/.vim/startup/vundle_vimrc +++ b/.vim/startup/vundle_vimrc @@ -22,6 +22,7 @@ endif " If you need Vim help for vim-plug itself (e.g. :help plug-options), register " vim-plug as a plugin. Plug 'junegunn/vim-plug' +Plug 'easymotion/vim-easymotion' "Plug 'tpope/vim-fugitive' Plug 'tpope/vim-repeat' Plug 'tpope/vim-surround' diff --git a/.vimrc b/.vimrc index 1ad8365..b0c691a 100644 --- a/.vimrc +++ b/.vimrc @@ -333,6 +333,7 @@ else source $HOME/.vim/startup/vundle_vimrc source $HOME/.vim/startup/python_vimrc source $HOME/.vim/startup/map_vimrc + source $HOME/.vim/startup/easymotion_vimrc endif " source $VIMRUNTIME/vimrc_example.vim diff --git a/clone-all-gitlab.py b/clone-all-gitlab.py new file mode 100644 index 0000000..627338d --- /dev/null +++ b/clone-all-gitlab.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +# https://stackoverflow.com/a/57412415/1820217 +# pip install python-gitlab +# python clone-all-gitlab.py GITLAB_HOST GROUP_ID PERSONAL_ACCESS_TOKEN +import os +import sys +import gitlab +import subprocess + +glab = gitlab.Gitlab(f'https://{sys.argv[1]}', f'{sys.argv[3]}') +groups = glab.groups.list() +groupname = sys.argv[2] +for group in groups: + if group.name == groupname: + projects = group.projects.list(all=True) + +for repo in projects: + command = f'git clone {repo.ssh_url_to_repo}' + process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) + output, _ = process.communicate() + process.wait() diff --git a/conf/zsh/alias.zsh b/conf/zsh/alias.zsh index 6ce8b4d..bf069ae 100644 --- a/conf/zsh/alias.zsh +++ b/conf/zsh/alias.zsh @@ -11,3 +11,8 @@ alias ag="ag -i" alias mkdir="mkdir -p" alias e=$EDITOR +alias mci="mvn -e -U clean install" + +# https://stackoverflow.com/a/15503178/1820217 +alias gitlog="git ls-files -z | xargs -0n1 git blame -w --show-email | perl -n -e '/^.*?\((.*?)\s+[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n" + diff --git a/conf/zsh/common.zsh b/conf/zsh/common.zsh index cc4dbd1..2d508c4 100644 --- a/conf/zsh/common.zsh +++ b/conf/zsh/common.zsh @@ -4,6 +4,8 @@ setopt histignorealldups sharehistory # Keep history within the shell and save it to ~/.zsh_history: HISTSIZE=10000 -SAVEHIST=10000 +SAVEHIST=$HISTSIZE HISTFILE=~/.zsh_history +setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again. + diff --git a/wp-completion.bash b/wp-completion.bash new file mode 100644 index 0000000..9df572b --- /dev/null +++ b/wp-completion.bash @@ -0,0 +1,23 @@ +# bash completion for the `wp` command + +_wp_complete() { + local OLD_IFS="$IFS" + local cur=${COMP_WORDS[COMP_CWORD]} + + IFS=$'\n'; # want to preserve spaces at the end + local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")" + + if [[ "$opts" =~ \\s* ]] + then + COMPREPLY=( $(compgen -f -- $cur) ) + elif [[ $opts = "" ]] + then + COMPREPLY=( $(compgen -f -- $cur) ) + else + COMPREPLY=( ${opts[*]} ) + fi + + IFS="$OLD_IFS" + return 0 +} +complete -o nospace -F _wp_complete wp