aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--alias9
-rwxr-xr-xbin/init/check_upstream2
-rwxr-xr-xbin/install.sh12
-rw-r--r--bin/osm/osm2
-rwxr-xr-xbin/wakeup.sh2
-rw-r--r--profile13
-rw-r--r--vim/.netrwhist3
-rw-r--r--vim/init/basic.vim3
-rw-r--r--vim/init/keymaps.vim8
-rw-r--r--vim/init/plugins.vim3
-rw-r--r--vim/vimrc7
-rw-r--r--zsh/zshrc8
12 files changed, 39 insertions, 33 deletions
diff --git a/alias b/alias
index fa9c566..500faea 100644
--- a/alias
+++ b/alias
@@ -1,6 +1,6 @@
1# My alias for bash and zsh 1# My alias for bash and zsh
2 2
3alias al="$EDITOR $SETTING_DIR/alias && source $SETTING_DIR/alias" 3alias 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
28cdh() { IFS=/; cd ~/helper/"$*"; IFS=' '; } 28cdh() { IFS=/; cd ~/helper/"$*"; IFS=' '; }
29alias chh="tig -C $SETTING_DIR status" 29alias chh="tig -C $HELPER_DIR status"
30alias profile='$EDITOR ~/helper/profile' 30alias profile='$EDITOR ~/helper/profile'
31 31
32# }}} 32# }}}
@@ -243,8 +243,8 @@ alias cdmail='cd ~/Maildir'
243alias m='mutt' 243alias m='mutt'
244alias mutt{.,''}rc="$EDITOR ~/.config/mutt/muttrc" 244alias mutt{.,''}rc="$EDITOR ~/.config/mutt/muttrc"
245alias h='himalaya' 245alias h='himalaya'
246alias gmail="mutt -F $SETTING_DIR/mutt/muttrc.gmail" 246alias gmail="mutt -F $HELPER_DIR/mutt/muttrc.gmail"
247alias ntu="mutt -F $SETTING_DIR/mutt/muttrc.b97602041" 247alias ntu="mutt -F $HELPER_DIR/mutt/muttrc.b97602041"
248imap.save() { 248imap.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() {
359alias editor='select-editor' 359alias editor='select-editor'
360alias vim{.,''}rc='vim ~/.config/vim/vimrc' 360alias vim{.,''}rc='vim ~/.config/vim/vimrc'
361if which nvim &>/dev/null; then 361if 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'
365else 364else
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"
22fi 22fi
23 23
24echo "$(date)" check "$1" >> "$SETTING_DIR/log" || echo error happens when check upstream at $1 24echo "$(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 @@
3set -e 3set -e
4 4
5# Default settings 5# Default settings
6SETTING_DIR=${SETTING_DIR:-~/helper} 6HELPER_DIR=${HELPER_DIR:-~/helper}
7REPO=${REPO:-typebrook/helper} 7REPO=${REPO:-typebrook/helper}
8REMOTE=${REMOTE:-https://github.com/${REPO}.git} 8REMOTE=${REMOTE:-https://github.com/${REPO}.git}
9BRANCH=${BRANCH:-dev} 9BRANCH=${BRANCH:-dev}
@@ -20,8 +20,8 @@ case "$(basename $SHELL)" in
20esac 20esac
21 21
22# If ~/helper doesn't exist, do git clone 22# If ~/helper doesn't exist, do git clone
23if [ ! -d $SETTING_DIR ]; then 23if [ ! -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
32cat >>$RCFILE <<EOF 32cat >>$RCFILE <<EOF
33 33
34$COMMENT_IN_RCFILE 34$COMMENT_IN_RCFILE
35export SETTING_DIR=$SETTING_DIR 35export HELPER_DIR=$HELPER_DIR
36source \$SETTING_DIR/$PROFILE 36source \$HELPER_DIR/$PROFILE
37 37
38EOF 38EOF
39 39
40echo Add profile into $RCFILE 40echo Add profile into $RCFILE
41cd "$SETTING_DIR" || exit 1 41cd "$HELPER_DIR" || exit 1
42make 42make
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
5export OSM_TES_SERVER=https://api.openstreetmap.org 5export OSM_TES_SERVER=https://api.openstreetmap.org
6 6
7export OSM_API=$OSM_SERVER/api/0.6 7export OSM_API=$OSM_SERVER/api/0.6
8export OSM_USER_PASSWD=$(cat $SETTING_DIR/tokens/osm 2>/dev/null) 8export OSM_USER_PASSWD=$(cat $HELPER_DIR/tokens/osm 2>/dev/null)
9 9
10FILENAME=$0 10FILENAME=$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
3date +%s >~/.wakeup 3date +%s >~/.wakeup
4 4
5find $SETTING_DIR/bin -executable | while read file; do ln -sf $file ~/bin/; done 5find $HELPER_DIR/bin -executable | while read file; do ln -sf $file ~/bin/; done
diff --git a/profile b/profile
index 03b8f9b..b5f2969 100644
--- a/profile
+++ b/profile
@@ -1,8 +1,7 @@
1# trap 'exit.sh' EXIT 1# trap 'exit.sh' EXIT
2 2
3export PATH=~/.local/bin:$PATH 3export PATH=~/.local/bin:$PATH
4export PATH=~/go/bin:$PATH 4export HELPER_DIR=${HELPER_DIR:=$HOME/helper}
5export SETTING_DIR=${SETTING_DIR:=$HOME/helper}
6export TERM=xterm-256color 5export TERM=xterm-256color
7export XDG_CONFIG_HOME=~/.config 6export XDG_CONFIG_HOME=~/.config
8export XDG_STATE_HOME=~/.local/share/ 7export XDG_STATE_HOME=~/.local/share/
@@ -34,12 +33,12 @@ shell=$(</proc/$$/cmdline sed -E 's/(.)-.+$/\1/' | tr -d '[\0\-]')
34export shell=${shell##*/} 33export shell=${shell##*/}
35 34
36# load custom aliases 35# load custom aliases
37source $SETTING_DIR/alias 36source $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
41find $SETTING_DIR/bin -not -executable -name '*rc' | while read rcfile; do source $rcfile; done 40find $HELPER_DIR/bin -not -executable -name '*rc' | while read rcfile; do source $rcfile; done
42find $SETTING_DIR/bin -mindepth 1 -type d | while read dir; do PATH+=:${dir}; done 41find $HELPER_DIR/bin -mindepth 1 -type d | while read dir; do PATH+=:${dir}; done
43 42
44# fzf 43# fzf
45if which fzf &>/dev/null; then 44if which fzf &>/dev/null; then
@@ -54,7 +53,7 @@ fi
54if [[ $- =~ i ]]; then 53if [[ $- =~ 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 @@
1let g:netrw_dirhistmax =10
2let g:netrw_dirhistcnt =1
3let 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
21augroup filetype_vim 20augroup 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
54set mouse= " Disable mouse selection 53set mouse= " Disable mouse selection
55set winaltkeys=no " Allow alt key for mapping 54set winaltkeys=no " Allow alt key for mapping
56set modelineexpr 55set modelineexpr
56set 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
64else 64else
65 silent! call mkdir(expand('~/.vim/.undodir/vim'), "p", 0755)
65 set undodir=~/.vim/.undodir/vim 66 set undodir=~/.vim/.undodir/vim
66endif 67endif
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>
613nnoremap <leader>tm :tabmove<SPACE> 613nnoremap <leader>tm :tabmove<SPACE>
614nnoremap <leader>to :tabonly<CR> 614nnoremap <leader>to :tabonly<CR>
615 615
616nnoremap <silent><m-h> :call Tab_MoveLeft()<CR>
617nnoremap <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
620let g:lasttab = 1 617let g:lasttab = 1
621nnoremap <Leader>tl :exe "tabn ".g:lasttab<CR> 618nnoremap <Leader>tl :exe "tabn ".g:lasttab<CR>
@@ -626,7 +623,7 @@ autocmd TabLeave * let g:lasttab = tabpagenr()
626nnoremap <leader>te :tabedit <C-r>=expand("%:p:h")<CR> 623nnoremap <leader>te :tabedit <C-r>=expand("%:p:h")<CR>
627 624
628" Tab move functions 625" Tab move functions
629function! Tvab_MoveLeft() 626function! 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
640endfunc 637endfunc
638
639nnoremap <silent><m-h> :call Tab_MoveLeft()<CR>
640nnoremap <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')
13Plug 'junegunn/fzf.vim' 13Plug 'junegunn/fzf.vim'
14nnoremap <leader>sf :Files<CR> 14nnoremap <leader>sf :Files<CR>
15nnoremap <leader>sg :GFiles<CR> 15nnoremap <leader>sg :GFiles<CR>
16nnoremap <leader>co :Colors<CR>
17nnoremap <leader><leader>ft :Filetypes<CR>
18nnoremap <leader>b :Buffers<CR>
16 19
17call plug#end() 20call plug#end()
diff --git a/vim/vimrc b/vim/vimrc
index 6af19d9..5fa374a 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -20,13 +20,14 @@ LoadScript init/basic.vim " Basic configuration
20LoadScript init/keymaps.vim " Key mappings 20LoadScript init/keymaps.vim " Key mappings
21LoadScript init/config.vim " Extra config for different contexts 21LoadScript init/config.vim " Extra config for different contexts
22 22
23" Color Scheme
24colorscheme gruvbox
25set background=dark
26
23if $fullrc == 'false' 27if $fullrc == 'false'
24 finish 28 finish
25endif 29endif
26 30
27colorscheme gruvbox
28set background=dark
29
30" Different scripts for nvim and vim 31" Different scripts for nvim and vim
31if has('nvim') 32if has('nvim')
32 LoadScript mini.lua 33 LoadScript mini.lua
diff --git a/zsh/zshrc b/zsh/zshrc
index 7380d8e..c5b2196 100644
--- a/zsh/zshrc
+++ b/zsh/zshrc
@@ -8,9 +8,9 @@ set -o emacs
8echo -n '\e[1 q' 8echo -n '\e[1 q'
9 9
10# helper repo 10# helper repo
11export SETTING_DIR=$HOME/helper 11export HELPER_DIR=$HOME/helper
12fpath=($SETTING_DIR/zsh $fpath) 12fpath=($HELPER_DIR/zsh $fpath)
13source $SETTING_DIR/zsh/completion.zsh 13source $HELPER_DIR/zsh/completion.zsh
14 14
15# Reload zshrc 15# Reload zshrc
16function .() { 16function .() {
@@ -108,7 +108,7 @@ bindkey '^[,' insert-first-word
108 108
109 109
110# Quick jump to parent folders 110# Quick jump to parent folders
111source $SETTING_DIR/zsh/bd.zsh 111source $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.