From e247588a515c630e62aaa74641b977147d026c0a Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Sat, 21 May 2022 01:59:56 +0800 Subject: [PATCH] Dev (#4) * .vimrc2; tmux disable mouse default * use vundle; vundle and tpm autoinstall&config * move tpm&vundle install to install.sh * minor color fixes in install.sh --- .tmux.conf2 | 4 +++- .vimrc2 | 33 +++++++++++++++++++++++++++++++++ .zshrc2 | 9 --------- install.sh | 35 +++++++++++++++++++++++++++++++++-- 4 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 .vimrc2 diff --git a/.tmux.conf2 b/.tmux.conf2 index d78fc6d..2b788d3 100644 --- a/.tmux.conf2 +++ b/.tmux.conf2 @@ -1,5 +1,7 @@ set -g prefix ^a +set -g mouse off set -g default-terminal "xterm-256color" +set -g history-limit 10000 # plugins set -g @plugin 'https://hub.fastgit.xyz/thewtex/tmux-mem-cpu-load' @@ -45,4 +47,4 @@ set -g window-status-bell-style fg=colour237,bg=colour214 # panes and windows set -g pane-active-border-style fg=brightblue set -g window-style fg=colour248 -set -g window-active-style fg=white \ No newline at end of file +set -g window-active-style fg=white diff --git a/.vimrc2 b/.vimrc2 new file mode 100644 index 0000000..7890204 --- /dev/null +++ b/.vimrc2 @@ -0,0 +1,33 @@ +" vundle +set nocompatible +filetype off +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() +Plugin 'https://hub.fastgit.xyz/VundleVim/Vundle.vim' +Plugin 'https://hub.fastgit.xyz/joshdick/onedark.vim' +call vundle#end() +filetype plugin indent on +" end vundle +colorscheme onedark + +set cursorline +set syntax=on +set autoindent +set smartindent +set tabstop=4 +set expandtab "spaces instead of tabs +set number "line numbers +set history=1000 +set ignorecase "when searching +set smartcase "but not when containing upper case chars +set linebreak +"set termguicolors "true color +set completeopt=preview,menu "auto complete +set laststatus=2 "always show statusline +hi User1 ctermfg=14 ctermbg=236 +hi User2 ctermfg=237 ctermbg=214 +hi User3 ctermfg=15 ctermbg=2 +au InsertEnter * hi User3 ctermfg=15 ctermbg=5 +au InsertLeave * hi User3 ctermfg=15 ctermbg=2 +set statusline=%3*\ %{mode()}\ %*[%n][%F](%{\"\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\"+\":\"\").\"\"},%{&ff},%Y)%2*%r%1*%m%*%<%=\'0x%B\'\ [Line:%l/%L,Col:%c][%p%%] + diff --git a/.zshrc2 b/.zshrc2 index cf9da01..5870919 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -61,15 +61,6 @@ antigen theme ${ZSH_THEME:-ys} antigen apply # end of antigen config -# install tmux tpm -TMUX_TPM="$HOME/.tmux/plugins/tpm" -command -v tmux > /dev/null 2>&1 -if [[ $? == 0 && ! -d "$TMUX_TPM" ]]; then - git clone https://hub.fastgit.xyz/tmux-plugins/tpm "$TMUX_TPM" -fi -# end of tpm - - # functions export DOTFILES=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) dfs() diff --git a/install.sh b/install.sh index c64457d..810f4bd 100755 --- a/install.sh +++ b/install.sh @@ -173,7 +173,6 @@ delete_link_if_match() fi } - install_crontab(){ fmt_note "installing \"$crontab_job\" to crontab ..." ( crontab -l | grep -vxF "${crontab_job}" | grep -v "no crontab for"; echo "$crontab_job" ) | crontab - @@ -184,11 +183,42 @@ uninstall_crontab(){ ( crontab -l | grep -vxF "$crontab_job" ) | crontab - } +install_tmux_tpm(){ + TMUX_TPM="$HOME/.tmux/plugins/tpm" + command -v tmux > /dev/null 2>&1 + if [[ $? == 0 && ! -d "$TMUX_TPM" ]]; then + fmt_note "installing tmux tpm ..." + git clone https://hub.fastgit.xyz/tmux-plugins/tpm "$TMUX_TPM" + command -v g++ > /dev/null 2>&1 + if [[ $? == 0 ]]; then + fmt_note "initializing tmux plugins ..." + ~/.tmux/plugins/tpm/bin/install_plugins + else + fmt_warning "pls install g++ and init tmux plugins by " + fi + fi +} + +install_vim_vundle(){ + VIM_VUNDLE="$HOME/.vim/bundle/Vundle.vim" + command -v vim > /dev/null 2>&1 + if [[ $? == 0 && ! -d "$VIM_VUNDLE" ]]; then + fmt_note "installing vim vundle ..." + git clone https://hub.fastgit.xyz/gmarik/Vundle.vim.git "$VIM_VUNDLE" + fmt_note "initializing vim plugins ..." + vim +PluginInstall +qall + fi +} + install(){ install_crontab insert_if_not_exist "${HOME}/.zshrc" "source ${dotfile_home_path}/.zshrc2" insert_if_not_exist "${HOME}/.tmux.conf" "source-file ${dotfile_home_path}/.tmux.conf2" + insert_if_not_exist "${HOME}/.vimrc" "source ${dotfile_home_path}/.vimrc2" create_symlink "${dotfile_path}/.ssh/authorized_keys2" "${HOME}/.ssh/authorized_keys2" + # those that won't be uninstalled in the future + install_tmux_tpm + install_vim_vundle fmt_note "done installing!" } @@ -198,6 +228,7 @@ uninstall(){ uninstall_crontab delete_if_exist "${HOME}/.zshrc" "source ${dotfile_home_path}/.zshrc2" delete_if_exist "${HOME}/.tmux.conf" "source-file ${dotfile_home_path}/.tmux.conf2" + delete_if_exist "${HOME}/.vimrc" "source ${dotfile_home_path}/.vimrc2" delete_link_if_match "${dotfile_path}/.ssh/authorized_keys2" "${HOME}/.ssh/authorized_keys2" fmt_note "done uninstalling!" fi @@ -207,5 +238,5 @@ setup_color case $1 in ""|-i ) install ;; -r ) uninstall ;; - * ) echo "unknown command \"$1\". available: -i, -r" ;; + * ) fmt_warning "unknown command \"$1\". available: -i, -r" ;; esac