diff options
| -rw-r--r-- | alias | 9 | ||||
| -rwxr-xr-x | bin/init/check_upstream | 2 | ||||
| -rwxr-xr-x | bin/install.sh | 12 | ||||
| -rw-r--r-- | bin/osm/osm | 2 | ||||
| -rwxr-xr-x | bin/wakeup.sh | 2 | ||||
| -rw-r--r-- | profile | 13 | ||||
| -rw-r--r-- | vim/.netrwhist | 3 | ||||
| -rw-r--r-- | vim/init/basic.vim | 3 | ||||
| -rw-r--r-- | vim/init/keymaps.vim | 8 | ||||
| -rw-r--r-- | vim/init/plugins.vim | 3 | ||||
| -rw-r--r-- | vim/vimrc | 7 | ||||
| -rw-r--r-- | zsh/zshrc | 8 |
12 files changed, 39 insertions, 33 deletions
| @@ -1,6 +1,6 @@ | |||
| 1 | # My alias for bash and zsh | 1 | # My alias for bash and zsh |
| 2 | 2 | ||
| 3 | alias al="$EDITOR $SETTING_DIR/alias && source $SETTING_DIR/alias" | 3 | alias al="$EDITOR $HELPER_DIR/alias && source $HELPER_DIR/alias" |
| 4 | 4 | ||
| 5 | # SHELL {{{ | 5 | # SHELL {{{ |
| 6 | 6 | ||
| @@ -26,7 +26,7 @@ alias zsh.sourced='zsh -o SOURCE_TRACE' | |||
| 26 | # CUSTOM HELPER {{{ | 26 | # CUSTOM HELPER {{{ |
| 27 | 27 | ||
| 28 | cdh() { IFS=/; cd ~/helper/"$*"; IFS=' '; } | 28 | cdh() { IFS=/; cd ~/helper/"$*"; IFS=' '; } |
| 29 | alias chh="tig -C $SETTING_DIR status" | 29 | alias chh="tig -C $HELPER_DIR status" |
| 30 | alias profile='$EDITOR ~/helper/profile' | 30 | alias profile='$EDITOR ~/helper/profile' |
| 31 | 31 | ||
| 32 | # }}} | 32 | # }}} |
| @@ -243,8 +243,8 @@ alias cdmail='cd ~/Maildir' | |||
| 243 | alias m='mutt' | 243 | alias m='mutt' |
| 244 | alias mutt{.,''}rc="$EDITOR ~/.config/mutt/muttrc" | 244 | alias mutt{.,''}rc="$EDITOR ~/.config/mutt/muttrc" |
| 245 | alias h='himalaya' | 245 | alias h='himalaya' |
| 246 | alias gmail="mutt -F $SETTING_DIR/mutt/muttrc.gmail" | 246 | alias gmail="mutt -F $HELPER_DIR/mutt/muttrc.gmail" |
| 247 | alias ntu="mutt -F $SETTING_DIR/mutt/muttrc.b97602041" | 247 | alias ntu="mutt -F $HELPER_DIR/mutt/muttrc.b97602041" |
| 248 | imap.save() { | 248 | imap.save() { |
| 249 | curl "imaps://mail.topo.tw/$1" \ | 249 | curl "imaps://mail.topo.tw/$1" \ |
| 250 | --user pham:`pass mail/pham@mail.topo.tw` \ | 250 | --user pham:`pass mail/pham@mail.topo.tw` \ |
| @@ -359,7 +359,6 @@ desktop() { | |||
| 359 | alias editor='select-editor' | 359 | alias editor='select-editor' |
| 360 | alias vim{.,''}rc='vim ~/.config/vim/vimrc' | 360 | alias vim{.,''}rc='vim ~/.config/vim/vimrc' |
| 361 | if which nvim &>/dev/null; then | 361 | if which nvim &>/dev/null; then |
| 362 | alias vim='nvim' | ||
| 363 | alias vv='nvim' | 362 | alias vv='nvim' |
| 364 | alias v='/usr/bin/vim' | 363 | alias v='/usr/bin/vim' |
| 365 | else | 364 | else |
diff --git a/bin/init/check_upstream b/bin/init/check_upstream index fa6d277..529547b 100755 --- a/bin/init/check_upstream +++ b/bin/init/check_upstream | |||
| @@ -21,4 +21,4 @@ if ! git rev-list "$head" | grep "$(git rev-parse origin/master)" > /dev/null; t | |||
| 21 | echo "New commit at" "$1" | 21 | echo "New commit at" "$1" |
| 22 | fi | 22 | fi |
| 23 | 23 | ||
| 24 | echo "$(date)" check "$1" >> "$SETTING_DIR/log" || echo error happens when check upstream at $1 | 24 | echo "$(date)" check "$1" >> "$HELPER_DIR/log" || echo error happens when check upstream at $1 |
diff --git a/bin/install.sh b/bin/install.sh index 94f23e5..3cf79d0 100755 --- a/bin/install.sh +++ b/bin/install.sh | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | set -e | 3 | set -e |
| 4 | 4 | ||
| 5 | # Default settings | 5 | # Default settings |
| 6 | SETTING_DIR=${SETTING_DIR:-~/helper} | 6 | HELPER_DIR=${HELPER_DIR:-~/helper} |
| 7 | REPO=${REPO:-typebrook/helper} | 7 | REPO=${REPO:-typebrook/helper} |
| 8 | REMOTE=${REMOTE:-https://github.com/${REPO}.git} | 8 | REMOTE=${REMOTE:-https://github.com/${REPO}.git} |
| 9 | BRANCH=${BRANCH:-dev} | 9 | BRANCH=${BRANCH:-dev} |
| @@ -20,8 +20,8 @@ case "$(basename $SHELL)" in | |||
| 20 | esac | 20 | esac |
| 21 | 21 | ||
| 22 | # If ~/helper doesn't exist, do git clone | 22 | # If ~/helper doesn't exist, do git clone |
| 23 | if [ ! -d $SETTING_DIR ]; then | 23 | if [ ! -d $HELPER_DIR ]; then |
| 24 | git clone --depth=1 --branch "$BRANCH" "$REMOTE" "$SETTING_DIR" || { | 24 | git clone --depth=1 --branch "$BRANCH" "$REMOTE" "$HELPER_DIR" || { |
| 25 | error "git clone of helper repo failed" | 25 | error "git clone of helper repo failed" |
| 26 | exit 1 | 26 | exit 1 |
| 27 | } | 27 | } |
| @@ -32,11 +32,11 @@ sed -i "\^$COMMENT_IN_RCFILE^, /^$/ d" $RCFILE | |||
| 32 | cat >>$RCFILE <<EOF | 32 | cat >>$RCFILE <<EOF |
| 33 | 33 | ||
| 34 | $COMMENT_IN_RCFILE | 34 | $COMMENT_IN_RCFILE |
| 35 | export SETTING_DIR=$SETTING_DIR | 35 | export HELPER_DIR=$HELPER_DIR |
| 36 | source \$SETTING_DIR/$PROFILE | 36 | source \$HELPER_DIR/$PROFILE |
| 37 | 37 | ||
| 38 | EOF | 38 | EOF |
| 39 | 39 | ||
| 40 | echo Add profile into $RCFILE | 40 | echo Add profile into $RCFILE |
| 41 | cd "$SETTING_DIR" || exit 1 | 41 | cd "$HELPER_DIR" || exit 1 |
| 42 | make | 42 | make |
diff --git a/bin/osm/osm b/bin/osm/osm index 344f906..4111eae 100644 --- a/bin/osm/osm +++ b/bin/osm/osm | |||
| @@ -5,7 +5,7 @@ export OSM_SERVER=https://api.openstreetmap.org | |||
| 5 | export OSM_TES_SERVER=https://api.openstreetmap.org | 5 | export OSM_TES_SERVER=https://api.openstreetmap.org |
| 6 | 6 | ||
| 7 | export OSM_API=$OSM_SERVER/api/0.6 | 7 | export OSM_API=$OSM_SERVER/api/0.6 |
| 8 | export OSM_USER_PASSWD=$(cat $SETTING_DIR/tokens/osm 2>/dev/null) | 8 | export OSM_USER_PASSWD=$(cat $HELPER_DIR/tokens/osm 2>/dev/null) |
| 9 | 9 | ||
| 10 | FILENAME=$0 | 10 | FILENAME=$0 |
| 11 | 11 | ||
diff --git a/bin/wakeup.sh b/bin/wakeup.sh index 545511b..cdcaa51 100755 --- a/bin/wakeup.sh +++ b/bin/wakeup.sh | |||
| @@ -2,4 +2,4 @@ | |||
| 2 | 2 | ||
| 3 | date +%s >~/.wakeup | 3 | date +%s >~/.wakeup |
| 4 | 4 | ||
| 5 | find $SETTING_DIR/bin -executable | while read file; do ln -sf $file ~/bin/; done | 5 | find $HELPER_DIR/bin -executable | while read file; do ln -sf $file ~/bin/; done |
| @@ -1,8 +1,7 @@ | |||
| 1 | # trap 'exit.sh' EXIT | 1 | # trap 'exit.sh' EXIT |
| 2 | 2 | ||
| 3 | export PATH=~/.local/bin:$PATH | 3 | export PATH=~/.local/bin:$PATH |
| 4 | export PATH=~/go/bin:$PATH | 4 | export HELPER_DIR=${HELPER_DIR:=$HOME/helper} |
| 5 | export SETTING_DIR=${SETTING_DIR:=$HOME/helper} | ||
| 6 | export TERM=xterm-256color | 5 | export TERM=xterm-256color |
| 7 | export XDG_CONFIG_HOME=~/.config | 6 | export XDG_CONFIG_HOME=~/.config |
| 8 | export XDG_STATE_HOME=~/.local/share/ | 7 | export XDG_STATE_HOME=~/.local/share/ |
| @@ -34,12 +33,12 @@ shell=$(</proc/$$/cmdline sed -E 's/(.)-.+$/\1/' | tr -d '[\0\-]') | |||
| 34 | export shell=${shell##*/} | 33 | export shell=${shell##*/} |
| 35 | 34 | ||
| 36 | # load custom aliases | 35 | # load custom aliases |
| 37 | source $SETTING_DIR/alias | 36 | source $HELPER_DIR/alias |
| 38 | 37 | ||
| 39 | # sourcr rc files in private/ and bin/ | 38 | # sourcr rc files in private/ and bin/ |
| 40 | [[ -d $SETTING_DIR/private ]] && for f in $SETTING_DIR/private/*; do source $f; done | 39 | [[ -d $HELPER_DIR/private ]] && for f in $HELPER_DIR/private/*; do source $f; done |
| 41 | find $SETTING_DIR/bin -not -executable -name '*rc' | while read rcfile; do source $rcfile; done | 40 | find $HELPER_DIR/bin -not -executable -name '*rc' | while read rcfile; do source $rcfile; done |
| 42 | find $SETTING_DIR/bin -mindepth 1 -type d | while read dir; do PATH+=:${dir}; done | 41 | find $HELPER_DIR/bin -mindepth 1 -type d | while read dir; do PATH+=:${dir}; done |
| 43 | 42 | ||
| 44 | # fzf | 43 | # fzf |
| 45 | if which fzf &>/dev/null; then | 44 | if which fzf &>/dev/null; then |
| @@ -54,7 +53,7 @@ fi | |||
| 54 | if [[ $- =~ i ]]; then | 53 | if [[ $- =~ i ]]; then |
| 55 | if [[ $shell == zsh ]]; then | 54 | if [[ $shell == zsh ]]; then |
| 56 | setopt extended_glob interactive_comments | 55 | setopt extended_glob interactive_comments |
| 57 | fpath=($SETTING_DIR/zsh $fpath) | 56 | fpath=($HELPER_DIR/zsh $fpath) |
| 58 | alias history='history -i' | 57 | alias history='history -i' |
| 59 | autoload compinit; compinit | 58 | autoload compinit; compinit |
| 60 | 59 | ||
diff --git a/vim/.netrwhist b/vim/.netrwhist new file mode 100644 index 0000000..dccb02c --- /dev/null +++ b/vim/.netrwhist | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | let g:netrw_dirhistmax =10 | ||
| 2 | let g:netrw_dirhistcnt =1 | ||
| 3 | let g:netrw_dirhist_1='/home/pham/.vim/tmp' | ||
diff --git a/vim/init/basic.vim b/vim/init/basic.vim index 05cade5..a4433cd 100644 --- a/vim/init/basic.vim +++ b/vim/init/basic.vim | |||
| @@ -17,7 +17,6 @@ augroup END | |||
| 17 | "}}} | 17 | "}}} |
| 18 | " For Vimscript {{{ | 18 | " For Vimscript {{{ |
| 19 | 19 | ||
| 20 | " Usage: type --- for foldmark | ||
| 21 | augroup filetype_vim | 20 | augroup filetype_vim |
| 22 | autocmd! | 21 | autocmd! |
| 23 | autocmd FileType vim setlocal foldmethod=marker foldlevel=0 | 22 | autocmd FileType vim setlocal foldmethod=marker foldlevel=0 |
| @@ -54,6 +53,7 @@ set path=.,** " Allow :find with completion | |||
| 54 | set mouse= " Disable mouse selection | 53 | set mouse= " Disable mouse selection |
| 55 | set winaltkeys=no " Allow alt key for mapping | 54 | set winaltkeys=no " Allow alt key for mapping |
| 56 | set modelineexpr | 55 | set modelineexpr |
| 56 | set hidden " Allow switch buffer without saving | ||
| 57 | 57 | ||
| 58 | " Turn persistent undo on | 58 | " Turn persistent undo on |
| 59 | " means that you can undo even when you close a buffer/VIM | 59 | " means that you can undo even when you close a buffer/VIM |
| @@ -62,6 +62,7 @@ if has('nvim') | |||
| 62 | set undodir=~/.vim/.undodir/nvim | 62 | set undodir=~/.vim/.undodir/nvim |
| 63 | set verbosefile=/tmp/nvim.log | 63 | set verbosefile=/tmp/nvim.log |
| 64 | else | 64 | else |
| 65 | silent! call mkdir(expand('~/.vim/.undodir/vim'), "p", 0755) | ||
| 65 | set undodir=~/.vim/.undodir/vim | 66 | set undodir=~/.vim/.undodir/vim |
| 66 | endif | 67 | endif |
| 67 | 68 | ||
diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim index adbbffd..0e2adcf 100644 --- a/vim/init/keymaps.vim +++ b/vim/init/keymaps.vim | |||
| @@ -613,9 +613,6 @@ nnoremap <leader>tc :tabclose<CR> | |||
| 613 | nnoremap <leader>tm :tabmove<SPACE> | 613 | nnoremap <leader>tm :tabmove<SPACE> |
| 614 | nnoremap <leader>to :tabonly<CR> | 614 | nnoremap <leader>to :tabonly<CR> |
| 615 | 615 | ||
| 616 | nnoremap <silent><m-h> :call Tab_MoveLeft()<CR> | ||
| 617 | nnoremap <silent><m-l> :call Tab_MoveRight()<CR> | ||
| 618 | |||
| 619 | " Let <leader>tl toggle between this and the last accessed tab | 616 | " Let <leader>tl toggle between this and the last accessed tab |
| 620 | let g:lasttab = 1 | 617 | let g:lasttab = 1 |
| 621 | nnoremap <Leader>tl :exe "tabn ".g:lasttab<CR> | 618 | nnoremap <Leader>tl :exe "tabn ".g:lasttab<CR> |
| @@ -626,7 +623,7 @@ autocmd TabLeave * let g:lasttab = tabpagenr() | |||
| 626 | nnoremap <leader>te :tabedit <C-r>=expand("%:p:h")<CR> | 623 | nnoremap <leader>te :tabedit <C-r>=expand("%:p:h")<CR> |
| 627 | 624 | ||
| 628 | " Tab move functions | 625 | " Tab move functions |
| 629 | function! Tvab_MoveLeft() | 626 | function! Tab_MoveLeft() |
| 630 | let l:tabnr = tabpagenr() - 2 | 627 | let l:tabnr = tabpagenr() - 2 |
| 631 | if l:tabnr >= 0 | 628 | if l:tabnr >= 0 |
| 632 | exec 'tabmove '.l:tabnr | 629 | exec 'tabmove '.l:tabnr |
| @@ -638,6 +635,9 @@ function! Tab_MoveRight() | |||
| 638 | exec 'tabmove '.l:tabnr | 635 | exec 'tabmove '.l:tabnr |
| 639 | endif | 636 | endif |
| 640 | endfunc | 637 | endfunc |
| 638 | |||
| 639 | nnoremap <silent><m-h> :call Tab_MoveLeft()<CR> | ||
| 640 | nnoremap <silent><m-l> :call Tab_MoveRight()<CR> | ||
| 641 | " }}} | 641 | " }}} |
| 642 | " TERMINAL {{{ | 642 | " TERMINAL {{{ |
| 643 | 643 | ||
diff --git a/vim/init/plugins.vim b/vim/init/plugins.vim index a96c14d..6d9f6e0 100644 --- a/vim/init/plugins.vim +++ b/vim/init/plugins.vim | |||
| @@ -13,5 +13,8 @@ call plug#begin('~/.vim/plugged') | |||
| 13 | Plug 'junegunn/fzf.vim' | 13 | Plug 'junegunn/fzf.vim' |
| 14 | nnoremap <leader>sf :Files<CR> | 14 | nnoremap <leader>sf :Files<CR> |
| 15 | nnoremap <leader>sg :GFiles<CR> | 15 | nnoremap <leader>sg :GFiles<CR> |
| 16 | nnoremap <leader>co :Colors<CR> | ||
| 17 | nnoremap <leader><leader>ft :Filetypes<CR> | ||
| 18 | nnoremap <leader>b :Buffers<CR> | ||
| 16 | 19 | ||
| 17 | call plug#end() | 20 | call plug#end() |
| @@ -20,13 +20,14 @@ LoadScript init/basic.vim " Basic configuration | |||
| 20 | LoadScript init/keymaps.vim " Key mappings | 20 | LoadScript init/keymaps.vim " Key mappings |
| 21 | LoadScript init/config.vim " Extra config for different contexts | 21 | LoadScript init/config.vim " Extra config for different contexts |
| 22 | 22 | ||
| 23 | " Color Scheme | ||
| 24 | colorscheme gruvbox | ||
| 25 | set background=dark | ||
| 26 | |||
| 23 | if $fullrc == 'false' | 27 | if $fullrc == 'false' |
| 24 | finish | 28 | finish |
| 25 | endif | 29 | endif |
| 26 | 30 | ||
| 27 | colorscheme gruvbox | ||
| 28 | set background=dark | ||
| 29 | |||
| 30 | " Different scripts for nvim and vim | 31 | " Different scripts for nvim and vim |
| 31 | if has('nvim') | 32 | if has('nvim') |
| 32 | LoadScript mini.lua | 33 | LoadScript mini.lua |
| @@ -8,9 +8,9 @@ set -o emacs | |||
| 8 | echo -n '\e[1 q' | 8 | echo -n '\e[1 q' |
| 9 | 9 | ||
| 10 | # helper repo | 10 | # helper repo |
| 11 | export SETTING_DIR=$HOME/helper | 11 | export HELPER_DIR=$HOME/helper |
| 12 | fpath=($SETTING_DIR/zsh $fpath) | 12 | fpath=($HELPER_DIR/zsh $fpath) |
| 13 | source $SETTING_DIR/zsh/completion.zsh | 13 | source $HELPER_DIR/zsh/completion.zsh |
| 14 | 14 | ||
| 15 | # Reload zshrc | 15 | # Reload zshrc |
| 16 | function .() { | 16 | function .() { |
| @@ -108,7 +108,7 @@ bindkey '^[,' insert-first-word | |||
| 108 | 108 | ||
| 109 | 109 | ||
| 110 | # Quick jump to parent folders | 110 | # Quick jump to parent folders |
| 111 | source $SETTING_DIR/zsh/bd.zsh | 111 | source $HELPER_DIR/zsh/bd.zsh |
| 112 | 112 | ||
| 113 | # Finally, make sure the terminal is in application mode, when zle is | 113 | # Finally, make sure the terminal is in application mode, when zle is |
| 114 | # active. Only then are the values from $terminfo valid. | 114 | # active. Only then are the values from $terminfo valid. |