From cda0870089c57d9b3859af0e58de0349da559020 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sun, 27 Jul 2025 21:03:50 +0800 Subject: Update --- alias | 9 ++++----- bin/init/check_upstream | 2 +- bin/install.sh | 12 ++++++------ bin/osm/osm | 2 +- bin/wakeup.sh | 2 +- profile | 13 ++++++------- vim/.netrwhist | 3 +++ vim/init/basic.vim | 3 ++- vim/init/keymaps.vim | 8 ++++---- vim/init/plugins.vim | 3 +++ vim/vimrc | 7 ++++--- zsh/zshrc | 8 ++++---- 12 files changed, 39 insertions(+), 33 deletions(-) create mode 100644 vim/.netrwhist diff --git a/alias b/alias index fa9c566..500faea 100644 --- a/alias +++ b/alias @@ -1,6 +1,6 @@ # My alias for bash and zsh -alias al="$EDITOR $SETTING_DIR/alias && source $SETTING_DIR/alias" +alias al="$EDITOR $HELPER_DIR/alias && source $HELPER_DIR/alias" # SHELL {{{ @@ -26,7 +26,7 @@ alias zsh.sourced='zsh -o SOURCE_TRACE' # CUSTOM HELPER {{{ cdh() { IFS=/; cd ~/helper/"$*"; IFS=' '; } -alias chh="tig -C $SETTING_DIR status" +alias chh="tig -C $HELPER_DIR status" alias profile='$EDITOR ~/helper/profile' # }}} @@ -243,8 +243,8 @@ alias cdmail='cd ~/Maildir' alias m='mutt' alias mutt{.,''}rc="$EDITOR ~/.config/mutt/muttrc" alias h='himalaya' -alias gmail="mutt -F $SETTING_DIR/mutt/muttrc.gmail" -alias ntu="mutt -F $SETTING_DIR/mutt/muttrc.b97602041" +alias gmail="mutt -F $HELPER_DIR/mutt/muttrc.gmail" +alias ntu="mutt -F $HELPER_DIR/mutt/muttrc.b97602041" imap.save() { curl "imaps://mail.topo.tw/$1" \ --user pham:`pass mail/pham@mail.topo.tw` \ @@ -359,7 +359,6 @@ desktop() { alias editor='select-editor' alias vim{.,''}rc='vim ~/.config/vim/vimrc' if which nvim &>/dev/null; then - alias vim='nvim' alias vv='nvim' alias v='/usr/bin/vim' 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 echo "New commit at" "$1" fi -echo "$(date)" check "$1" >> "$SETTING_DIR/log" || echo error happens when check upstream at $1 +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 @@ set -e # Default settings -SETTING_DIR=${SETTING_DIR:-~/helper} +HELPER_DIR=${HELPER_DIR:-~/helper} REPO=${REPO:-typebrook/helper} REMOTE=${REMOTE:-https://github.com/${REPO}.git} BRANCH=${BRANCH:-dev} @@ -20,8 +20,8 @@ case "$(basename $SHELL)" in esac # If ~/helper doesn't exist, do git clone -if [ ! -d $SETTING_DIR ]; then - git clone --depth=1 --branch "$BRANCH" "$REMOTE" "$SETTING_DIR" || { +if [ ! -d $HELPER_DIR ]; then + git clone --depth=1 --branch "$BRANCH" "$REMOTE" "$HELPER_DIR" || { error "git clone of helper repo failed" exit 1 } @@ -32,11 +32,11 @@ sed -i "\^$COMMENT_IN_RCFILE^, /^$/ d" $RCFILE cat >>$RCFILE </dev/null) +export OSM_USER_PASSWD=$(cat $HELPER_DIR/tokens/osm 2>/dev/null) FILENAME=$0 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 @@ date +%s >~/.wakeup -find $SETTING_DIR/bin -executable | while read file; do ln -sf $file ~/bin/; done +find $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 @@ # trap 'exit.sh' EXIT export PATH=~/.local/bin:$PATH -export PATH=~/go/bin:$PATH -export SETTING_DIR=${SETTING_DIR:=$HOME/helper} +export HELPER_DIR=${HELPER_DIR:=$HOME/helper} export TERM=xterm-256color export XDG_CONFIG_HOME=~/.config export XDG_STATE_HOME=~/.local/share/ @@ -34,12 +33,12 @@ shell=$(/dev/null; then @@ -54,7 +53,7 @@ fi if [[ $- =~ i ]]; then if [[ $shell == zsh ]]; then setopt extended_glob interactive_comments - fpath=($SETTING_DIR/zsh $fpath) + fpath=($HELPER_DIR/zsh $fpath) alias history='history -i' autoload compinit; compinit diff --git a/vim/.netrwhist b/vim/.netrwhist new file mode 100644 index 0000000..dccb02c --- /dev/null +++ b/vim/.netrwhist @@ -0,0 +1,3 @@ +let g:netrw_dirhistmax =10 +let g:netrw_dirhistcnt =1 +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 "}}} " For Vimscript {{{ -" Usage: type --- for foldmark augroup filetype_vim autocmd! autocmd FileType vim setlocal foldmethod=marker foldlevel=0 @@ -54,6 +53,7 @@ set path=.,** " Allow :find with completion set mouse= " Disable mouse selection set winaltkeys=no " Allow alt key for mapping set modelineexpr +set hidden " Allow switch buffer without saving " Turn persistent undo on " means that you can undo even when you close a buffer/VIM @@ -62,6 +62,7 @@ if has('nvim') set undodir=~/.vim/.undodir/nvim set verbosefile=/tmp/nvim.log else + silent! call mkdir(expand('~/.vim/.undodir/vim'), "p", 0755) set undodir=~/.vim/.undodir/vim endif 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 tc :tabclose nnoremap tm :tabmove nnoremap to :tabonly -nnoremap :call Tab_MoveLeft() -nnoremap :call Tab_MoveRight() - " Let tl toggle between this and the last accessed tab let g:lasttab = 1 nnoremap tl :exe "tabn ".g:lasttab @@ -626,7 +623,7 @@ autocmd TabLeave * let g:lasttab = tabpagenr() nnoremap te :tabedit =expand("%:p:h") " Tab move functions -function! Tvab_MoveLeft() +function! Tab_MoveLeft() let l:tabnr = tabpagenr() - 2 if l:tabnr >= 0 exec 'tabmove '.l:tabnr @@ -638,6 +635,9 @@ function! Tab_MoveRight() exec 'tabmove '.l:tabnr endif endfunc + +nnoremap :call Tab_MoveLeft() +nnoremap :call Tab_MoveRight() " }}} " TERMINAL {{{ 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') Plug 'junegunn/fzf.vim' nnoremap sf :Files nnoremap sg :GFiles +nnoremap co :Colors +nnoremap ft :Filetypes +nnoremap b :Buffers call 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 LoadScript init/keymaps.vim " Key mappings LoadScript init/config.vim " Extra config for different contexts +" Color Scheme +colorscheme gruvbox +set background=dark + if $fullrc == 'false' finish endif -colorscheme gruvbox -set background=dark - " Different scripts for nvim and vim if has('nvim') 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 echo -n '\e[1 q' # helper repo -export SETTING_DIR=$HOME/helper -fpath=($SETTING_DIR/zsh $fpath) -source $SETTING_DIR/zsh/completion.zsh +export HELPER_DIR=$HOME/helper +fpath=($HELPER_DIR/zsh $fpath) +source $HELPER_DIR/zsh/completion.zsh # Reload zshrc function .() { @@ -108,7 +108,7 @@ bindkey '^[,' insert-first-word # Quick jump to parent folders -source $SETTING_DIR/zsh/bd.zsh +source $HELPER_DIR/zsh/bd.zsh # Finally, make sure the terminal is in application mode, when zle is # active. Only then are the values from $terminfo valid. -- cgit v1.2.3-70-g09d2