From 218ed007aac809810968689448e8e3b03cd03fbb Mon Sep 17 00:00:00 2001 From: prozhou Date: Fri, 27 Sep 2019 16:13:09 +0800 Subject: [PATCH 01/21] bug fix --- tools/neovim/ubuntu_init.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index 583b21b..e54f70c 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -220,7 +220,7 @@ cat >> ~/.config/nvim/init.vim <rn (coc-rename) END -if [ "Y$OPT_NO_DEFX_ICON" == "Yyes" ];then ! (grep -F 'kristijanhusak/defx-icons' ~/.config/nvim/init.vim &>/dev/null ) && \ sed -i "/plug#begin/aPlug 'kristijanhusak/defx-icons'" ~/.config/nvim/init.vim && \ sed -i "/plug#begin/aPlug 'kristijanhusak/defx-git'" ~/.config/nvim/init.vim @@ -373,5 +372,4 @@ cat >> ~/.config/nvim/init.vim < Date: Fri, 27 Sep 2019 16:15:35 +0800 Subject: [PATCH 02/21] bug fix --- tools/neovim/ubuntu_init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index e54f70c..7aafe8b 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -342,7 +342,7 @@ END sed -i "/plug#begin/aPlug 'kristijanhusak/defx-icons'" ~/.config/nvim/init.vim && \ sed -i "/plug#begin/aPlug 'kristijanhusak/defx-git'" ~/.config/nvim/init.vim -! (grep -F 'Defx_mappings' ~/.config/nvim/init.vim &>/dev/null ) && \ +! (grep -F 'call s:setup_defx' ~/.config/nvim/init.vim &>/dev/null ) && \ sed -i "/Defx_mappings/a autocmd VimEnter * call s:setup_defx()" ~/.config/nvim/init.vim From c156f5323ee56927000992d32cdf790e14eb1a1e Mon Sep 17 00:00:00 2001 From: prozhou Date: Sun, 6 Oct 2019 01:38:45 +0000 Subject: [PATCH 03/21] add vims --- helper/option.sh | 2 ++ tools/dep/ubuntu_init.sh | 3 +++ tools/neovim/ubuntu_init.sh | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/helper/option.sh b/helper/option.sh index 9967029..f4afc65 100644 --- a/helper/option.sh +++ b/helper/option.sh @@ -8,6 +8,7 @@ OPT_LEETCODE= OPT_MAN= OPT_DICT= OPT_BASH= +OPT_VIM= OPT_FE= OPT_NO_DEFX_ICON= @@ -26,5 +27,6 @@ do --with_bash) OPT_BASH=yes ;; --with_fe) OPT_FE=yes ;; --without_defx_icon) OPT_NO_DEFX_ICON=yes ;; + --with_vim) OPT_VIM=yes ;; esac done diff --git a/tools/dep/ubuntu_init.sh b/tools/dep/ubuntu_init.sh index aa7cdbd..600a4d2 100644 --- a/tools/dep/ubuntu_init.sh +++ b/tools/dep/ubuntu_init.sh @@ -62,6 +62,9 @@ fi if [ "Y$OPT_PYTHON" == "Yyes" ];then sudo pip3 install jedi fi +if [ "Y$OPT_VIM" == "Yyes" ];then + yarn global add vim-language-server +fi if [ "Y$OPT_LUA" == "Yyes" ];then apt install -y lua5.3-dev luarocks lua5.3 diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index 7aafe8b..165e991 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -48,7 +48,7 @@ function lua_ins(){ function bash_ins(){ ! ( grep -F "languageserver" ~/.config/nvim/coc-settings.json ) && \ - sed -i '/suggest.timeout/i "languageserver": {\n"bash": {\n"command": "bash-language-server",\n"args": ["start"],\n"filetypes": ["sh"]",ignoredRootPaths": ["~"]\n}\n},' ~/.config/nvim/coc-settings.json + sed -i '/suggest.timeout/i "languageserver": {\n"bash": {\n"command": "bash-language-server",\n"args": ["start"],\n"filetypes": ["sh"],"ignoredRootPaths": ["~"]\n}\n},' ~/.config/nvim/coc-settings.json } function fe_ins(){ @@ -195,6 +195,10 @@ if [ "Y$OPT_PYTHON" == "Yyes" ];then nvim "+CocInstall -sync coc-python" +qall fi +if [ "Y$OPT_VIM" == "Yyes" ];then + nvim "+CocInstall -sync coc-vimlsp" +qall +fi + ! which ctags >/dev/null && \ git clone https://github.com/universal-ctags/ctags.git &&\ cd ctags && ./autogen.sh && ./configure && make && make install &&\ From dcf749b0e6b19fc66b73569e95714e898a709a4b Mon Sep 17 00:00:00 2001 From: prozhou Date: Thu, 24 Oct 2019 23:31:07 +0800 Subject: [PATCH 04/21] vim-go --- tools/neovim/ubuntu_init.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index 165e991..8cfadbe 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -58,10 +58,7 @@ function fe_ins(){ function go_ins(){ ! (grep -F 'sebdah/vim-delve' ~/.config/nvim/init.vim &>/dev/null ) && \ sed -i "/plug#begin/aPlug 'sebdah/vim-delve'" ~/.config/nvim/init.vim - if which go;then - pxy go get -u github.com/derekparker/delve/cmd/dlv - pxy go get -u golang.org/x/tools/cmd/gopls - fi + sed -i "/plug#begin/aPlug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }" ~/.config/nvim/init.vim ! ( grep -F "languageserver" ~/.config/nvim/coc-settings.json ) && \ sed -i '/suggest.timeout/i "languageserver": {\n"golang": {\n"command": "gopls",\n"filetypes": ["go"]\n}\n},' ~/.config/nvim/coc-settings.json @@ -330,7 +327,15 @@ nmap gi (coc-implementation) nmap gr (coc-references) " Use K to show documentation in preview window -nnoremap K :call show_documentation() +nnoremap U :call show_documentation() + +" Use to trigger completion. +inoremap coc#refresh() + +" disable vim-go :GoDef short cut (gd) +" this is handled by LanguageClient [LC] + +let g:go_def_mapping_enabled = 0 function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) From d897e0cfd2335be84062a9d206744e0d0c57a1ed Mon Sep 17 00:00:00 2001 From: prozhou Date: Fri, 25 Oct 2019 13:02:25 +0800 Subject: [PATCH 05/21] inc timeout --- tools/neovim/coc-settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/neovim/coc-settings.json b/tools/neovim/coc-settings.json index cbe8c23..36c2a27 100644 --- a/tools/neovim/coc-settings.json +++ b/tools/neovim/coc-settings.json @@ -1,7 +1,7 @@ { "suggest.triggerAfterInsertEnter": true, "suggest.noselect": false, - "suggest.timeout": 500, + "suggest.timeout": 3500, "suggest.minTriggerInputLength": 2, "suggest.echodocSupport": true, "suggest.enablePreview": false From bbb610145c5c7c135059e89e7c832c9165c6a92e Mon Sep 17 00:00:00 2001 From: prozhou Date: Mon, 28 Oct 2019 01:26:35 +0000 Subject: [PATCH 06/21] pxy goinstall --- tools/neovim/ubuntu_init.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index 8cfadbe..848c12f 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -58,8 +58,9 @@ function fe_ins(){ function go_ins(){ ! (grep -F 'sebdah/vim-delve' ~/.config/nvim/init.vim &>/dev/null ) && \ sed -i "/plug#begin/aPlug 'sebdah/vim-delve'" ~/.config/nvim/init.vim - sed -i "/plug#begin/aPlug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }" ~/.config/nvim/init.vim + sed -i "/plug#begin/aPlug 'fatih/vim-go'" ~/.config/nvim/init.vim + pxy nvim +'GoInstallBinaries' +qall ! ( grep -F "languageserver" ~/.config/nvim/coc-settings.json ) && \ sed -i '/suggest.timeout/i "languageserver": {\n"golang": {\n"command": "gopls",\n"filetypes": ["go"]\n}\n},' ~/.config/nvim/coc-settings.json ! ( grep -F "leetcode_solution_filetype" ~/.config/nvim/init.vim ) && \ From 3e0fc9a18b5ab582a9f1a477a5a339d3bb77ec4f Mon Sep 17 00:00:00 2001 From: prozhou Date: Sun, 3 Nov 2019 14:47:48 +0800 Subject: [PATCH 07/21] python --- tools/neovim/ubuntu_init.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index 8cfadbe..912b365 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -32,6 +32,7 @@ END function python_ins(){ ! ( grep -F "python.linting.enabled" ~/.config/nvim/coc-settings.json ) && \ sed -i '/suggest.timeout/i "python.linting.enabled": false,' ~/.config/nvim/coc-settings.json + sed -i '/suggest.timeout/i "python.jediEnabled": false,' ~/.config/nvim/coc-settings.json } function java_ins(){ From be4289176d0cfe260bfe3c643da4e70809ae31b2 Mon Sep 17 00:00:00 2001 From: prozhou Date: Fri, 20 Dec 2019 17:08:46 +0800 Subject: [PATCH 08/21] leetcode change --- tools/dep/ubuntu_init.sh | 2 +- tools/neovim/ubuntu_init.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/dep/ubuntu_init.sh b/tools/dep/ubuntu_init.sh index 600a4d2..05ca0f6 100644 --- a/tools/dep/ubuntu_init.sh +++ b/tools/dep/ubuntu_init.sh @@ -4,7 +4,7 @@ apt-get install -y gawk curl zsh language-pack-zh-hans language-pack-zh-hans-ba git unzip wget python-dev python3-pip python-pip lsof \ libtool-bin gettext sudo \ cmake automake m4 autoconf libtool build-essential pkg-config wamerican \ - autojump nmap iproute2 net-tools sshfs axel + autojump nmap iproute2 net-tools sshfs axel netcat apt-get remove -y neovim exuberant-ctags npm install -g yarn if [ "Y$OPT_MAN" == "Yyes" ];then diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index e73eca0..35cde1f 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -18,14 +18,13 @@ END function leetcode_ins(){ ! (grep -F 'ianding1/leetcode' ~/.config/nvim/init.vim &>/dev/null ) && \ pip3 install requests beautifulsoup4 && \ - sed -i "/plug#begin/aPlug 'ianding1/leetcode.vim'" ~/.config/nvim/init.vim + sed -i "/plug#begin/aPlug 'zhoupro/leetcode.vim', { 'do': 'pip3 install -r requirements.txt' }" ~/.config/nvim/init.vim ! ( grep -F "LeetCodeList" ~/.config/nvim/init.vim ) && \ cat >> ~/.config/nvim/init.vim <ll :LeetCodeList nnoremap lt :LeetCodeTest nnoremap ls :LeetCodeSubmit - nnoremap li :LeetCodeSignIn END } From 463bc2dc9ad1e54146c6bfff57c80ffed6dd01bd Mon Sep 17 00:00:00 2001 From: prozhou Date: Mon, 20 Jan 2020 11:00:26 +0800 Subject: [PATCH 09/21] gopkgs --- tools/dep/ubuntu_init.sh | 8 ++++++++ tools/neovim/ubuntu_init.sh | 25 ++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/tools/dep/ubuntu_init.sh b/tools/dep/ubuntu_init.sh index 05ca0f6..5b3af23 100644 --- a/tools/dep/ubuntu_init.sh +++ b/tools/dep/ubuntu_init.sh @@ -66,6 +66,14 @@ if [ "Y$OPT_VIM" == "Yyes" ];then yarn global add vim-language-server fi +if [ "Y$OPT_GO" == "Yyes" ];then + + if [ ! -f /usr/local/bin/gopkgs ];then + wget https://github.com/haya14busa/gopkgs/releases/download/v1.0.0/gopkgs_linux_amd64 && mv gopkgs_linux_amd64 /usr/local/bin/gopkgs && chmod u+x /usr/local/bin/gopkgs + fi + +fi + if [ "Y$OPT_LUA" == "Yyes" ];then apt install -y lua5.3-dev luarocks lua5.3 luarocks install --server=http://luarocks.org/dev lua-lsp diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index 35cde1f..d672eec 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -16,15 +16,38 @@ END } function leetcode_ins(){ - ! (grep -F 'ianding1/leetcode' ~/.config/nvim/init.vim &>/dev/null ) && \ + ! (grep -F 'zhoupro/leetcode' ~/.config/nvim/init.vim &>/dev/null ) && \ pip3 install requests beautifulsoup4 && \ sed -i "/plug#begin/aPlug 'zhoupro/leetcode.vim', { 'do': 'pip3 install -r requirements.txt' }" ~/.config/nvim/init.vim ! ( grep -F "LeetCodeList" ~/.config/nvim/init.vim ) && \ cat >> ~/.config/nvim/init.vim <ll :LeetCodeList nnoremap lt :LeetCodeTest nnoremap ls :LeetCodeSubmit + + function! s:get_go_pkgs() + function! s:go_import(pk) + execute 'GoImport' a:pk + endfunction + call fzf#run(fzf#wrap({'source': 'gopkgs | sort | uniq', 'sink': function('s:go_import')})) + endfunction + + function! s:get_go_doc() + function! s:go_doc(pk) + execute 'GoDoc' a:pk + endfunction + call fzf#run(fzf#wrap({'source': 'gopkgs | sort | uniq', 'sink': function('s:go_doc')})) + endfunction + augroup gopkgs + autocmd! + autocmd FileType go command! -buffer GI exe s:get_go_pkgs() + autocmd FileType go command! -buffer GD exe s:get_go_doc() + augroup END + + map i :GI + map d :GD END } From 7bce168746214115cf096143b1b8deefa244bead Mon Sep 17 00:00:00 2001 From: prozhou Date: Mon, 20 Jan 2020 03:53:18 +0000 Subject: [PATCH 10/21] add lazygit --- tools/dep/ubuntu_init.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/dep/ubuntu_init.sh b/tools/dep/ubuntu_init.sh index 5b3af23..305e4fa 100644 --- a/tools/dep/ubuntu_init.sh +++ b/tools/dep/ubuntu_init.sh @@ -7,6 +7,11 @@ apt-get install -y gawk curl zsh language-pack-zh-hans language-pack-zh-hans-ba autojump nmap iproute2 net-tools sshfs axel netcat apt-get remove -y neovim exuberant-ctags npm install -g yarn + +#install lazygit +if [ ! -f /usr/local/bin/lazygit ]; then + wget https://github.com/jesseduffield/lazygit/releases/download/v0.13/lazygit_0.13_Linux_x86_64.tar.gz && tar xzvf lazygit_0.13_Linux_x86_64.tar.gz && mv lazygit /usr/local/bin/ && chmod u+x /usr/local/bin/lazygit +fi if [ "Y$OPT_MAN" == "Yyes" ];then [ -f /etc/dpkg/dpkg.cfg.d/excludes ] && rm -rf /etc/dpkg/dpkg.cfg.d/excludes apt-get install -y \ From 5c2b6bc79aeb741dd125aedcb149665b4861d6ec Mon Sep 17 00:00:00 2001 From: zhoupro Date: Sun, 5 Jul 2020 22:13:21 +0800 Subject: [PATCH 11/21] for ubuntu20.04 --- README.md | 2 +- init.sh | 18 ++++++++----- tools/dep/ubuntu_init.sh | 54 +++++++++++++++++-------------------- tools/neovim/init.vim | 4 ++- tools/neovim/ubuntu_init.sh | 41 +++++++++++++--------------- tools/pxy/pxy.sh | 12 ++++----- tools/tmux/ubuntu_init.sh | 5 ---- tools/zsh/ubuntu_init.sh | 19 ++++++------- 8 files changed, 72 insertions(+), 83 deletions(-) diff --git a/README.md b/README.md index 6249028..bf75522 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # cli develop env ### os -* ubuntu +* ubuntu20.04 ### language - php - c/c++ diff --git a/init.sh b/init.sh index 454c167..08a580d 100755 --- a/init.sh +++ b/init.sh @@ -10,16 +10,20 @@ source "./helper/installer.sh" source "./helper/option.sh" ins dep ins pxy + +if [ "Y$OPT_JAVA" == "Yyes" ];then + ins jdk +fi + + +# main tools start +ins tmux ins zsh -ins hyper ins neovim -ins tmux +#main tools end +ins hyper ins karabiner ins ssh -ins clipper ins phoenix -if [ "Y$OPT_JAVA" == "Yyes" ];then - ins jdk -fi -zsh +ins clipper # vim: set ts=4 sw=4 tw=0 et : diff --git a/tools/dep/ubuntu_init.sh b/tools/dep/ubuntu_init.sh index 305e4fa..964c407 100644 --- a/tools/dep/ubuntu_init.sh +++ b/tools/dep/ubuntu_init.sh @@ -1,33 +1,26 @@ #!/bin/bash -apt-get install -y gawk curl zsh language-pack-zh-hans language-pack-zh-hans-base \ - git unzip wget python-dev python3-pip python-pip lsof \ - libtool-bin gettext sudo \ - cmake automake m4 autoconf libtool build-essential pkg-config wamerican \ - autojump nmap iproute2 net-tools sshfs axel netcat +apt-get install -y gawk curl zsh \ + git unzip wget python3-pip lsof sudo \ + autojump nmap iproute2 net-tools axel netcat ripgrep + + #clibtool-bin gettext make automake m4 autoconf libtool build-essential pkg-config wamerican \ + + apt-get remove -y neovim exuberant-ctags -npm install -g yarn + + #install lazygit -if [ ! -f /usr/local/bin/lazygit ]; then - wget https://github.com/jesseduffield/lazygit/releases/download/v0.13/lazygit_0.13_Linux_x86_64.tar.gz && tar xzvf lazygit_0.13_Linux_x86_64.tar.gz && mv lazygit /usr/local/bin/ && chmod u+x /usr/local/bin/lazygit -fi +#if [ ! -f /usr/local/bin/lazygit ]; then +# wget https://github.com/jesseduffield/lazygit/releases/download/v0.13/lazygit_0.13_Linux_x86_64.tar.gz && tar xzvf lazygit_0.13_Linux_x86_64.tar.gz && mv lazygit /usr/local/bin/ && chmod u+x /usr/local/bin/lazygit +#fi + if [ "Y$OPT_MAN" == "Yyes" ];then [ -f /etc/dpkg/dpkg.cfg.d/excludes ] && rm -rf /etc/dpkg/dpkg.cfg.d/excludes apt-get install -y \ cppman man manpages manpages-dev manpages-posix manpages-posix-dev fi -if [ "Y$OPT_DICT" == "Yyes" ];then - apt-get install -y sdcv - if [ ! -d /usr/share/stardict/dict/stardict-oxford-gb-2.4.2 ];then - mkdir -p /usr/share/stardict/dic/ && \ - wget http://download.huzheng.org/zh_CN/stardict-oxford-gb-2.4.2.tar.bz2 && \ - wget http://download.huzheng.org/zh_CN/stardict-wubi86-2.4.2.tar.bz2 && \ - tar -xjvf stardict-wubi86-2.4.2.tar.bz2 -C /usr/share/stardict/dic && \ - tar -xjvf stardict-oxford-gb-2.4.2.tar.bz2 -C /usr/share/stardict/dic && \ - rm -rf stardict-* - fi -fi #install clangd8 url:https://apt.llvm.org/ if [ "Y$OPT_CPP" == "Yyes" ];then @@ -47,27 +40,32 @@ END wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - &&\ apt update && apt install -y clang-tools-8 &&\ sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-8 100 -fi -if [ "Y$OPT_CPP" == "Yyes" ];then apt-get install -y \ valgrind clang-format cscope gdb fi + if [ "Y$OPT_BASH" == "Yyes" ];then apt-get install -y \ shellcheck if ! which bash-language-server > /dev/null; then - sudo npm i -g bash-language-server --unsafe-perm + npm i -g bash-language-server --unsafe-perm fi fi + if [ "Y$OPT_PHP" == "Yyes" ];then - sudo npm i -g intelephense + npm i -g intelephense fi + if [ "Y$OPT_PYTHON" == "Yyes" ];then - sudo pip3 install jedi + pip3 install jedi fi + if [ "Y$OPT_VIM" == "Yyes" ];then + + apt install -y npm + npm install -g yarn yarn global add vim-language-server fi @@ -83,10 +81,12 @@ if [ "Y$OPT_LUA" == "Yyes" ];then apt install -y lua5.3-dev luarocks lua5.3 luarocks install --server=http://luarocks.org/dev lua-lsp fi + if [ "Y$OPT_FE" == "Yyes" ];then sudo npm install -g typescript typescript-language-server sudo npm install -g vscode-css-languageserver-bin fi + if [ "Y$OPT_JAVA" == "Yyes" ];then OLD_DIR=`pwd` if [ ! -d ~/.config/coc/extensions/coc-java-data/server/config_linux ];then @@ -107,7 +107,3 @@ if [ "Y$OPT_JAVA" == "Yyes" ];then fi fi -# install ripgrep -! which rg && \ - curl -LO https://github.com/BurntSushi/ripgrep/releases/download/0.10.0/ripgrep_0.10.0_amd64.deb && \ - sudo dpkg -i ripgrep_0.10.0_amd64.deb && rm -rf ripgrep_0.10.0_amd64.deb diff --git a/tools/neovim/init.vim b/tools/neovim/init.vim index 5c92f38..e825860 100755 --- a/tools/neovim/init.vim +++ b/tools/neovim/init.vim @@ -22,7 +22,9 @@ call plug#begin('~/.local/share/nvim/plugged') "git Plug 'tpope/vim-fugitive' Plug 'airblade/vim-gitgutter' - Plug 'gregsexton/gitv' + " + " + "Plug 'gregsexton/gitv' " transform Plug 'tpope/vim-abolish' Plug 'tpope/vim-surround' diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index d672eec..3852926 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -124,31 +124,35 @@ if [ ! -f /usr/local/bin/vim ];then sudo ln -s ~/opt/soft/nvim/squashfs-root/usr/bin/nvim /usr/local/bin/nvim rm -rf nvim.appimage fi -pip3 install neovim --upgrade -pip2 install neovim --upgrade + +if [ ! "$(pip3 list | grep neovim)" ];then + pip3 install neovim --upgrade +fi #------------------------------------------------------------------------------- # install vim-plug #------------------------------------------------------------------------------- if [ ! -f ~/.local/share/nvim/site/autoload/plug.vim ] ; then - curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ + pxy curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim fi #------------------------------------------------------------------------------- # copy init.vim to home dir, and install from command line #------------------------------------------------------------------------------- -if [ ! -f ~/.vim/c_cnt.sh ] ; then - mkdir -p ~/.config/nvim - cp tools/neovim/c_cnt.sh ~/.config/nvim/c_cnt.sh - cp tools/neovim/add_swap.sh ~/.config/nvim/add_swap.sh - cp tools/neovim/del_swap.sh ~/.config/nvim/del_swap.sh -fi +# if [ ! -f ~/.vim/c_cnt.sh ] ; then +# mkdir -p ~/.config/nvim +# cp tools/neovim/c_cnt.sh ~/.config/nvim/c_cnt.sh +# cp tools/neovim/add_swap.sh ~/.config/nvim/add_swap.sh +# cp tools/neovim/del_swap.sh ~/.config/nvim/del_swap.sh +# fi + rm -f ~/.config/nvim/init.vim #common config mkdir -p ~/.config/nvim cp tools/neovim/init.vim ~/.config/nvim/init.vim cp tools/neovim/coc-settings.json ~/.config/nvim/coc-settings.json + # copy if nmap localhost -p 8377 | grep open 2>/dev/null;then sed -in 's#NCHOST#localhost#g' ~/.config/nvim/init.vim @@ -232,11 +236,11 @@ fi cat tools/neovim/cfg.ini >> ~/.config/nvim/init.vim ! ( grep -F "cus_ini_env" ~/.env ) && \ cat tools/neovim/env.ini >> ~/.env -[ ! -f /usr/local/bin/genUrl ] &&\ - cp tools/neovim/genUrl.sh /usr/local/bin/genUrl && chmod u+x /usr/local/bin/genUrl -[ ! -d /usr/local/vimsplain ] &&\ - git clone https://github.com/pafcu/vimsplain.git /usr/local/vimsplain -rm -rf ~/.gdbinit && cp tools/neovim/gdbinit ~/.gdbinit +# [ ! -f /usr/local/bin/genUrl ] &&\ +# cp tools/neovim/genUrl.sh /usr/local/bin/genUrl && chmod u+x /usr/local/bin/genUrl +# [ ! -d /usr/local/vimsplain ] &&\ +# git clone https://github.com/pafcu/vimsplain.git /usr/local/vimsplain +#rm -rf ~/.gdbinit && cp tools/neovim/gdbinit ~/.gdbinit ! ( grep -F "defx_my_settings" ~/.config/nvim/init.vim ) && \ @@ -313,15 +317,6 @@ function! s:defx_my_settings() abort endfunction END -if [ "Y$OPT_DICT" == "Yyes" ];then - ! ( grep -F "QuerySel" ~/.config/nvim/init.vim ) && \ - cat >> ~/.config/nvim/init.vim <w :call QuerySel() -END -fi #coc setting ! ( grep -F "show_documentation" ~/.config/nvim/init.vim ) && \ diff --git a/tools/pxy/pxy.sh b/tools/pxy/pxy.sh index 3bcc787..c00ec38 100755 --- a/tools/pxy/pxy.sh +++ b/tools/pxy/pxy.sh @@ -2,13 +2,13 @@ export http_proxy="" export https_proxy="" -if nmap localhost -p 8787 | grep open >/dev/null;then - export http_proxy=http://localhost:8787 - export https_proxy=http://localhost:8787 -elif nmap host.docker.internal -p 8787 | grep open >/dev/null;then +if nmap localhost -p 39571 | grep open >/dev/null;then + export http_proxy=http://localhost:39571 + export https_proxy=http://localhost:39571 +elif nmap host.docker.internal -p 39571 | grep open >/dev/null;then ip=$(/sbin/ip route|awk '/default/ { print $3 }') - export http_proxy=http://$ip:8787 - export https_proxy=http://$ip:8787 + export http_proxy=http://$ip:39571 + export https_proxy=http://$ip:39571 elif nmap localhost -p 8087 | grep open >/dev/null;then export http_proxy=http://localhost:8087 export https_proxy=http://localhost:8087 diff --git a/tools/tmux/ubuntu_init.sh b/tools/tmux/ubuntu_init.sh index 9d1a266..4f9a417 100755 --- a/tools/tmux/ubuntu_init.sh +++ b/tools/tmux/ubuntu_init.sh @@ -2,8 +2,3 @@ ! which tmux &&\ apt-get install tmux -y -rm -f ~/.tmux.conf ~/.tmux.conf.local -cp tools/tmux/tmux.conf ~/.tmux.conf -cp tools/tmux/tmux.conf.local ~/.tmux.conf.local -echo 'alias tmux="tmux -2"' >> "$HOME/.env" -echo 'export TERM=xterm-256color' >> "$HOME/.env" diff --git a/tools/zsh/ubuntu_init.sh b/tools/zsh/ubuntu_init.sh index 9ab998a..4dd9f1d 100755 --- a/tools/zsh/ubuntu_init.sh +++ b/tools/zsh/ubuntu_init.sh @@ -4,17 +4,22 @@ # CREATED: 2018/03/24 18时08分31秒 #=============================================================================== -set -o nounset # Treat unset variables as an error -sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -| sed 's/env zsh -l//g')" +if [ -d ~/.oh-my-zsh ];then + return +fi + +sh -c "$(pxy wget --no-check-certificate https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -| sed 's/env zsh -l//g')" if [ ! -d "$HOME/.zplug" ];then git clone https://github.com/zplug/zplug.git ~/.zplug sudo usermod -s /bin/zsh root fi + ! (grep -F 'zsh-autosuggestions' ~/.zshrc &>/dev/null ) && \ git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" && \ sed -E -i "s/plugins=\((.*)\)/plugins=\(\1 zsh-autosuggestions\)/g" ~/.zshrc + ! (grep -F 'LC_ALL' ~/.env &>/dev/null ) && \ echo 'export LC_ALL=zh_CN.UTF-8' >> "$HOME/.env" && \ echo 'export LANG=zh_CN.UTF-8' >> "$HOME/.env" && \ @@ -52,11 +57,6 @@ END ! (grep -F '.env' ~/.zshrc &>/dev/null ) && \ echo 'if [ -f ~/.env ];then; source ~/.env;fi' >> ~/.zshrc -#themes -! (grep -F 'avit' ~/.zshrc &>/dev/null ) && \ - sed -i 's#ZSH_THEME="robbyrussell"#ZSH_THEME="avit"#g' ~/.zshrc - - ! (grep -F 'history-incremental-search-backward' ~/.cus_zshrc &>/dev/null ) && \ cat >> ~/.cus_zshrc </dev/null ) && \ -sed -i "/if.*n.*me.*then/i ip=\`ifconfig | grep 'inet ' | grep -v 127.0.0.1 | awk '{print \$2}'\`" ~/.oh-my-zsh/themes/avit.zsh-theme && \ -sed -i '/if.*n.*me.*then/i me="%n@$ip"' ~/.oh-my-zsh/themes/avit.zsh-theme + From 8609ae9688201225e8d2c4fab4b791531d5787fc Mon Sep 17 00:00:00 2001 From: zhoupro Date: Mon, 6 Jul 2020 11:36:46 +0800 Subject: [PATCH 12/21] add sql language server --- tools/neovim/config.yml | 4 ++++ tools/neovim/ubuntu_init.sh | 43 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 tools/neovim/config.yml diff --git a/tools/neovim/config.yml b/tools/neovim/config.yml new file mode 100644 index 0000000..9e40b21 --- /dev/null +++ b/tools/neovim/config.yml @@ -0,0 +1,4 @@ +connections: + - alias: dsn_mysql + 'driver': 'mysql' + 'dataSourceName': 'root:zsz123@tcp(127.0.0.1:3306)/mysql' diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index 3852926..637892d 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -15,6 +15,47 @@ END } +function sql_ins(){ + + rm ~/.config/sqls -rf && \ + mkdir -p ~/.config/sqls/ && \ + cp tools/neovim/config.yml ~/.config/sqls/ + + ! (grep -F 'lighttiger2505/sqls.vim' ~/.config/nvim/init.vim &>/dev/null ) && \ + sed -i "/plug#begin/aPlug 'lighttiger2505/sqls.vim'" ~/.config/nvim/init.vim && \ + sed -i "/plug#begin/aPlug 'prabirshrestha/vim-lsp'" ~/.config/nvim/init.vim && \ + sed -i "/plug#begin/aPlug 'prabirshrestha/async.vim'" ~/.config/nvim/init.vim + + ! ( grep -F "config.yml" ~/.config/nvim/coc-settings.json ) && \ + sed -i '/languageserver/a "sql": {\n"command": "sqls",\n"args":["-config", "/root/.config/sqls/config.yml"],\n"filetypes": ["sql"]\n},' ~/.config/nvim/coc-settings.json + + ! ( grep -F "LspSqls" ~/.config/nvim/init.vim ) && \ +cat >> ~/.config/nvim/init.vim <['sqls']}, + \ 'whitelist': ['sql'], + \ 'workspace_config': { + \ 'sqls': { + \ 'connections': [ + \ { + \ 'driver': 'mysql', + \ 'dataSourceName': 'root:zsz123@tcp(127.0.0.1:3306)/test', + \ }, + \ ], + \ }, + \ }, + \ }) + augroup END +endif +END + +} + + function leetcode_ins(){ ! (grep -F 'zhoupro/leetcode' ~/.config/nvim/init.vim &>/dev/null ) && \ pip3 install requests beautifulsoup4 && \ @@ -168,8 +209,10 @@ fi #language + if [ "Y$OPT_GO" == "Yyes" ];then go_ins + sql_ins fi if [ "Y$OPT_PHP" == "Yyes" ];then From 4490cfaf09bb4e5f3175fb4603ea6d4e2d3eb7a6 Mon Sep 17 00:00:00 2001 From: zhoupro Date: Mon, 6 Jul 2020 12:33:27 +0800 Subject: [PATCH 13/21] clangd language server --- tools/dep/ubuntu_init.sh | 19 +------------------ tools/neovim/coc-settings.json | 7 +++++++ tools/neovim/ubuntu_init.sh | 16 ++++++++-------- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/tools/dep/ubuntu_init.sh b/tools/dep/ubuntu_init.sh index 964c407..1f502cc 100644 --- a/tools/dep/ubuntu_init.sh +++ b/tools/dep/ubuntu_init.sh @@ -24,25 +24,8 @@ fi #install clangd8 url:https://apt.llvm.org/ if [ "Y$OPT_CPP" == "Yyes" ];then - ! ( grep -F "llvm-toolchain-" /etc/apt/sources.list ) && \ - cat >> /etc/apt/sources.list <> ~/.config/nvim/init.vim <> ~/.config/nvim/init.vim < Date: Mon, 6 Jul 2020 17:33:30 +0800 Subject: [PATCH 14/21] java language server --- tools/dep/ubuntu_init.sh | 39 +++++++++++++++++++------------------ tools/jdk/init.sh | 5 ++++- tools/neovim/ubuntu_init.sh | 5 +---- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/tools/dep/ubuntu_init.sh b/tools/dep/ubuntu_init.sh index 1f502cc..b25120e 100644 --- a/tools/dep/ubuntu_init.sh +++ b/tools/dep/ubuntu_init.sh @@ -70,23 +70,24 @@ if [ "Y$OPT_FE" == "Yyes" ];then sudo npm install -g vscode-css-languageserver-bin fi -if [ "Y$OPT_JAVA" == "Yyes" ];then - OLD_DIR=`pwd` - if [ ! -d ~/.config/coc/extensions/coc-java-data/server/config_linux ];then - mkdir -p ~/.config/coc/extensions/coc-java-data/server && \ - cd ~/.config/coc/extensions/coc-java-data/server && \ - axel https://download.eclipse.org/jdtls/milestones/0.35.0/jdt-language-server-0.35.0-201903142358.tar.gz && \ - tar xf jdt-language-server-0.35.0-201903142358.tar.gz && rm jdt-language-server*.tar.gz - fi - cd $OLD_DIR - if [ ! -d /opt/apache-maven-3.6.1 ];then - # install maven - cd /opt && \ - wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz && \ - tar xf apache-maven-3.6.1-bin.tar.gz && \ - export PATH=/opt/apache-maven-3.6.1/bin:$PATH && \ - echo "export PATH=\"/opt/apache-maven-3.6.1:$PATH\"" >> "$HOME/.cus_zshrc" - cd $OLD_DIR - fi -fi +apt install maven -y +# if [ "Y$OPT_JAVA" == "Yyes" ];then +# OLD_DIR=`pwd` +# if [ ! -d ~/.config/coc/extensions/coc-java-data/server/config_linux ];then +# mkdir -p ~/.config/coc/extensions/coc-java-data/server && \ +# cd ~/.config/coc/extensions/coc-java-data/server && \ +# axel https://download.eclipse.org/jdtls/milestones/0.35.0/jdt-language-server-0.35.0-201903142358.tar.gz && \ +# tar xf jdt-language-server-0.35.0-201903142358.tar.gz && rm jdt-language-server*.tar.gz +# fi +# cd $OLD_DIR +# if [ ! -d /opt/apache-maven-3.6.1 ];then +# # install maven +# cd /opt && \ +# wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz && \ +# tar xf apache-maven-3.6.1-bin.tar.gz && \ +# export PATH=/opt/apache-maven-3.6.1/bin:$PATH && \ +# echo "export PATH=\"/opt/apache-maven-3.6.1:$PATH\"" >> "$HOME/.cus_zshrc" +# cd $OLD_DIR +# fi +# fi diff --git a/tools/jdk/init.sh b/tools/jdk/init.sh index 4ae594c..905fd8c 100644 --- a/tools/jdk/init.sh +++ b/tools/jdk/init.sh @@ -20,6 +20,9 @@ function jdk(){ export PATH="/usr/lib/jvm/jdk${JDK_VERSION}/bin:$PATH" fi } + + if [ ! -f /usr/lib/jvm/jdk${JDK_VERSION}/bin/java ];then - jdk + #jdk + apt install -y openjdk-14-jdk fi diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index dfb7771..bcb8c0a 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -95,10 +95,7 @@ function python_ins(){ } function java_ins(){ - ! ( grep -F "leetcode_solution_filetype" ~/.config/nvim/init.vim ) && \ -cat >> ~/.config/nvim/init.vim < Date: Mon, 6 Jul 2020 17:45:14 +0800 Subject: [PATCH 15/21] php language server --- tools/dep/ubuntu_init.sh | 1 + tools/neovim/ubuntu_init.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/dep/ubuntu_init.sh b/tools/dep/ubuntu_init.sh index b25120e..0a4f7dd 100644 --- a/tools/dep/ubuntu_init.sh +++ b/tools/dep/ubuntu_init.sh @@ -38,6 +38,7 @@ if [ "Y$OPT_BASH" == "Yyes" ];then fi if [ "Y$OPT_PHP" == "Yyes" ];then + apt install php -y npm i -g intelephense fi diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index bcb8c0a..65612c9 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -138,8 +138,8 @@ function php_ins(){ END chmod u+x /usr/local/bin/phpxd - ! ( grep -F "languageserver" ~/.config/nvim/coc-settings.json ) && \ - sed -i '/suggest.timeout/i "languageserver": { \n"intelephense": {\n"command": "intelephense",\n"args": ["--stdio"],\n"filetypes": ["php"],\n"initializationOptions": {\n"storagePath": "/tmp/intelephense"\n }\n }\n},' ~/.config/nvim/coc-settings.json + ! ( grep -F "intelephense" ~/.config/nvim/coc-settings.json ) && \ + sed -i '/languageserver/a "intelephense": {\n"command": "intelephense",\n"args": ["--stdio"],\n"filetypes": ["php"],\n"initializationOptions": {\n"storagePath": "/tmp/intelephense"\n }\n },' ~/.config/nvim/coc-settings.json } From 09eccee3b50f8c83f8b327fb032955c64f7ff1cc Mon Sep 17 00:00:00 2001 From: zhoupro Date: Mon, 12 Oct 2020 08:23:13 +0800 Subject: [PATCH 16/21] del sth --- init.sh | 7 +- tools/clipper/com.wincent.clipper.plist | 21 ---- tools/clipper/mac_init.sh | 6 -- tools/karabiner/mac_init.sh | 10 -- tools/neovim/add_swap.sh | 23 ----- tools/neovim/config.yml | 4 - tools/neovim/del_swap.sh | 19 ---- tools/neovim/init.vim | 125 +----------------------- tools/neovim/ubuntu_init.sh | 88 ++--------------- tools/phoenix/mac_init.sh | 11 --- tools/zsh/ubuntu_init.sh | 32 ------ 11 files changed, 15 insertions(+), 331 deletions(-) delete mode 100644 tools/clipper/com.wincent.clipper.plist delete mode 100644 tools/clipper/mac_init.sh delete mode 100644 tools/karabiner/mac_init.sh delete mode 100644 tools/neovim/add_swap.sh delete mode 100644 tools/neovim/config.yml delete mode 100644 tools/neovim/del_swap.sh delete mode 100644 tools/phoenix/mac_init.sh diff --git a/init.sh b/init.sh index 08a580d..758b350 100755 --- a/init.sh +++ b/init.sh @@ -20,10 +20,5 @@ fi ins tmux ins zsh ins neovim -#main tools end -ins hyper -ins karabiner -ins ssh -ins phoenix -ins clipper +#ins ssh # vim: set ts=4 sw=4 tw=0 et : diff --git a/tools/clipper/com.wincent.clipper.plist b/tools/clipper/com.wincent.clipper.plist deleted file mode 100644 index 21b50f6..0000000 --- a/tools/clipper/com.wincent.clipper.plist +++ /dev/null @@ -1,21 +0,0 @@ - - - - - Label - com.wincent.clipper - ProgramArguments - - /usr/local/bin/clipper - - EnvironmentVariables - - LANG - en_US.UTF-8 - - KeepAlive - - LimitLoadToSessionType - Aqua - - diff --git a/tools/clipper/mac_init.sh b/tools/clipper/mac_init.sh deleted file mode 100644 index 532c4e2..0000000 --- a/tools/clipper/mac_init.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -if [ ! -f ~/Library/LaunchAgents/com.wincent.clipper.plist ];then - cp tools/clipper/com.wincent.clipper.plist ~/Library/LaunchAgents/ - launchctl load -w -S Aqua ~/Library/LaunchAgents/com.wincent.clipper.plist -fi - diff --git a/tools/karabiner/mac_init.sh b/tools/karabiner/mac_init.sh deleted file mode 100644 index 1bd4c69..0000000 --- a/tools/karabiner/mac_init.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -if [ ! -d /Applications/Karabiner-Elements.app ];then - wget "https://pqrs.org/osx/karabiner/files/Karabiner-Elements-12.1.0.dmg" - sudo hdiutil attach -quiet "Karabiner-Elements-12.1.0.dmg" - sudo installer -pkg "/Volumes/Karabiner-Elements-12.1.0/Karabiner-Elements.sparkle_guided.pkg" -target / - sudo hdiutil detach "/Volumes/Karabiner-Elements-12.1.0" - rm -rf "Karabiner-Elements-12.1.0.dmg" -fi -rm -rf ~/.config/karabiner/assets/complex_modifications/cap_esc_exchage_terminal.json && \ -wget -P ~/.config/karabiner/assets/complex_modifications/ https://raw.githubusercontent.com/zhoupro/cap_esc_exchange_terminal/master/cap_esc_exchage_terminal.json diff --git a/tools/neovim/add_swap.sh b/tools/neovim/add_swap.sh deleted file mode 100644 index 64192ca..0000000 --- a/tools/neovim/add_swap.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# size of swapfile in megabytes -swapsize=2048 - -# does the swap file already exist? -grep -q "swapfile" /etc/fstab - -# if not then create it -if [ $? -ne 0 ]; then - echo 'swapfile not found. Adding swapfile.' - fallocate -l ${swapsize}M /swapfile - chmod 600 /swapfile - mkswap /swapfile - swapon /swapfile - echo '/swapfile none swap defaults 0 0' >> /etc/fstab -else - echo 'swapfile found. No changes made.' -fi - -# output results to terminal -cat /proc/swaps -cat /proc/meminfo | grep Swap diff --git a/tools/neovim/config.yml b/tools/neovim/config.yml deleted file mode 100644 index 9e40b21..0000000 --- a/tools/neovim/config.yml +++ /dev/null @@ -1,4 +0,0 @@ -connections: - - alias: dsn_mysql - 'driver': 'mysql' - 'dataSourceName': 'root:zsz123@tcp(127.0.0.1:3306)/mysql' diff --git a/tools/neovim/del_swap.sh b/tools/neovim/del_swap.sh deleted file mode 100644 index f5537e8..0000000 --- a/tools/neovim/del_swap.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -# does the swap file exist? -grep -q "swapfile" /etc/fstab - -# if it does then remove it -if [ $? -eq 0 ]; then - echo 'swapfile found. Removing swapfile.' - sed -i '/swapfile/d' /etc/fstab - echo "3" > /proc/sys/vm/drop_caches - swapoff -a - rm -f /swapfile -else - echo 'No swapfile found. No changes made.' -fi - -# output results to terminal -cat /proc/swaps -cat /proc/meminfo | grep Swap diff --git a/tools/neovim/init.vim b/tools/neovim/init.vim index e825860..8374b4a 100755 --- a/tools/neovim/init.vim +++ b/tools/neovim/init.vim @@ -29,49 +29,29 @@ call plug#begin('~/.local/share/nvim/plugged') Plug 'tpope/vim-abolish' Plug 'tpope/vim-surround' Plug 'tpope/vim-repeat' - " snips - Plug 'SirVer/ultisnips' - Plug 'honza/vim-snippets' - " 语言语法高亮 - Plug 'sheerun/vim-polyglot' " num rep Plug 'glts/vim-magnum' Plug 'glts/vim-radical' " mru Plug 'vim-scripts/mru.vim' - " start screen - Plug 'mhinz/vim-startify' - " add header - Plug 'alpertuna/vim-header' " select Plug 'terryma/vim-expand-region' - "nginx - Plug 'chr4/nginx.vim' " icon Plug 'ryanoasis/vim-devicons' - " tmux - Plug 'christoomey/vim-tmux-navigator' - " emmet - Plug 'mattn/emmet-vim' "indent Plug 'Yggdroot/indentLine' "undo Plug 'mbbill/undotree' Plug 'wellle/targets.vim' - Plug 'forevernull/vim-json-format' - Plug 'paroxayte/vwm.vim' Plug 'jiangmiao/auto-pairs' call plug#end() " our will be the space key let mapleader="," set noswapfile -map js :call json_format#parse("l") " : completion. inoremap pumvisible() ? "\" : "\" -"words -"set dictionary=/usr/share/dict/words " Highlight search results set hlsearch " Makes search act like search in modern browsers @@ -112,48 +92,6 @@ endfunc autocmd VimEnter * noremap t :call RunProgram() " ctags set tags=tags; " ; 不可省略,表示若当前目录中不存在tags, 则在父目录中寻找。 -nmap ]s :call GenCscope() -func! GenCscope() - exec "w" - if &filetype == 'php' - exec '!find . -name "*.php" > cscope.files' - exec "!cscope -bkq -i cscope.files" - exec "!(cat cscope.files | ctags -f tags --languages=php --php-kinds=ctif --fields=+aimS -L -)" - elseif &filetype == 'c' || &filetype == 'cpp' || &filetype == 'h' || &filetype == 'cc' || &filetype == 'c++' - exec '!find . -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.cc" -o -name "*.c++" > cscope.files' - exec "!cscope -bkq -i cscope.files" - exec "!(cat cscope.files | ctags -f tags --c++-kinds=+p --fields=+iaS --extras=+q -L -)" - endif -endfunc - -if has("cscope") - set cscopetag " 使支持用 Ctrl+] 和 Ctrl+t 快捷键在代码间跳来跳去 - " check cscope for definition of a symbol before checking ctags: - " set to 1 if you want the reverse search order. - set csto=1 - nmap [s :cs find s =expand("") - nmap [g :cs find g =expand("") - nmap [c :cs find c =expand("") - nmap [t :cs find t =expand("") - nmap [e :cs find e =expand("") - nmap [f :cs find f =expand("") - nmap [i :cs find i =expand("")$ - nmap [d :cs find d =expand("") -endif -" Autoloading Cscope Database -function! LoadCscope() - let db = findfile("cscope.out", ".;") - if (!empty(db)) - let path = strpart(db, 0, match(db, "/cscope.out$")) - set nocscopeverbose " suppress 'duplicate connection' error - exe "cs add " . db . " " . path - set cscopeverbose - " else add the database pointed to by environment variable - elseif $CSCOPE_DB != "" - cs add $CSCOPE_DB - endif -endfunction -au BufEnter /* call LoadCscope() " for debug set nu @@ -163,30 +101,9 @@ set list nnoremap f :Files nnoremap e :MRU -" PHP debug -let g:vdebug_options= { - \ "port" : 9010, - \ "server" : '0.0.0.0', - \ "timeout" : 100, - \ "on_close" : 'detach', - \ "break_on_open" : 1, - \ "ide_key" : 'xdebug', - \ "path_maps" : {}, - \ "debug_window_level" : 0, - \ "debug_file_level" : 0, - \ "debug_file" : "", - \ "watch_window_style" : 'expanded', - \ "marker_default" : '⬦', - \ "marker_closed_tree" : '▸', - \ "marker_open_tree" : '▾' - \} -highlight DbgBreakptLine ctermbg=none ctermfg=none -highlight DbgBreakptSign ctermbg=none ctermfg=10 -highlight DbgCurrentLine ctermbg=none ctermfg=none -highlight DbgCurrentSign ctermbg=none ctermfg=red - nnoremap y :call system('NCCOMMAND NCHOST 8377', @0) nnoremap ] :call fzf#vim#tags('^' . expand(''), {'options': '--exact --select-1 --exit-0 +i'}) + " color change fix in tmux set t_Co=256 "switch windows @@ -208,20 +125,13 @@ if has('nvim') vnoremap l l " Normal mode: nnoremap h h - nnoremap j ji + nnoremap j j nnoremap k k nnoremap l l endif -set scrolloff=5 -let g:header_auto_add_header = 0 -let g:tmux_navigator_no_mappings = 1 -nnoremap :TmuxNavigateLeft -nnoremap :TmuxNavigateUp -nnoremap :TmuxNavigatePrevious " backward noremap \ , -let g:polyglot_disabled = ['markdown'] " buf tab let g:airline#extensions#tabline#enabled = 1 @@ -241,6 +151,7 @@ nmap 6 AirlineSelectTab6 nmap 7 AirlineSelectTab7 nmap 8 AirlineSelectTab8 nmap 9 AirlineSelectTab9 + command! -bang -nargs=* Rg \ call fzf#vim#grep( \ 'rg --column --line-number --hidden --ignore-case --ignore-file ~/.fzf_ignore --no-heading --color=always '., 1, @@ -248,10 +159,6 @@ command! -bang -nargs=* Rg \ : fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}, 'right:50%:hidden', '?'), \ 0) nnoremap a :Rg -if has("persistent_undo") - set undodir=~/.undodir/ - set undofile -endif " tab 替换为4个空格 set tabstop=4 @@ -268,6 +175,7 @@ function! AppendModeline() call append(line("$"), l:modeline) endfunction nnoremap ml :call AppendModeline() + " add current file to ignore file command Gg call system('echo '.expand("%"). '>> .git/info/exclude') " remove current file from ignore file @@ -277,28 +185,5 @@ fu! s:isdir(dir) abort return !empty(a:dir) && (isdirectory(a:dir) || \ (!empty($SYSTEMDRIVE) && isdirectory('/'.tolower($SYSTEMDRIVE[0]).a:dir))) endfu -set foldmethod=manual -let s:bot = { -\ 'name': 'bot', -\ 'set_all': ['nonu', 'nornu'], -\ 'bot': -\ { -\ 'h_sz': 12, -\ 'init': [ 'term zsh' ] -\ } -\ } -let g:vwm#layouts = [s:bot] - -" clang_format -let g:clang_format#style_options = { - \ "AccessModifierOffset" : -4, - \ "AllowShortIfStatementsOnASingleLine" : "true", - \ "AlwaysBreakTemplateDeclarations" : "true", - \ "Standard" : "C++11"} - -" map to cf in C++ code -autocmd FileType c,cpp,objc nnoremap cf :ClangFormat -autocmd FileType c,cpp,objc vnoremap cf :ClangFormat -" Toggle auto formatting: -nmap C :ClangFormatAutoToggle +set foldmethod=manual diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index 65612c9..39559e9 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -1,54 +1,12 @@ #!/bin/bash function c_ins(){ - ! (grep -F 'nvim-gdb' ~/.config/nvim/init.vim &>/dev/null ) && \ - sed -i "/plug#begin/aPlug 'vim-scripts/a.vim'" ~/.config/nvim/init.vim && \ - sed -i "/plug#begin/aPlug 'gauteh/vim-cppman'" ~/.config/nvim/init.vim && \ - sed -i "/plug#begin/aPlug 'rhysd/vim-clang-format'" ~/.config/nvim/init.vim && \ - sed -i "/plug#begin/aPlug 'sakhnik/nvim-gdb' , { 'branch': 'legacy' }" ~/.config/nvim/init.vim - #! ( grep -F "objcpp" ~/.config/nvim/coc-settings.json ) && \ - #sed -i '/languageserver/a "clangd": {\n"command": "clangd",\n"args":["-background-index"],\n"filetypes": ["c", "cpp", "objc", "objcpp"]\n},' ~/.config/nvim/coc-settings.json + echo "no" } function sql_ins(){ - - rm ~/.config/sqls -rf && \ - mkdir -p ~/.config/sqls/ && \ - cp tools/neovim/config.yml ~/.config/sqls/ - - ! (grep -F 'lighttiger2505/sqls.vim' ~/.config/nvim/init.vim &>/dev/null ) && \ - sed -i "/plug#begin/aPlug 'lighttiger2505/sqls.vim'" ~/.config/nvim/init.vim && \ - sed -i "/plug#begin/aPlug 'prabirshrestha/vim-lsp'" ~/.config/nvim/init.vim && \ - sed -i "/plug#begin/aPlug 'prabirshrestha/async.vim'" ~/.config/nvim/init.vim - - ! ( grep -F "config.yml" ~/.config/nvim/coc-settings.json ) && \ - sed -i '/languageserver/a "sql": {\n"command": "sqls",\n"args":["-config", "/root/.config/sqls/config.yml"],\n"filetypes": ["sql"]\n},' ~/.config/nvim/coc-settings.json - - ! ( grep -F "LspSqls" ~/.config/nvim/init.vim ) && \ -cat >> ~/.config/nvim/init.vim <['sqls']}, - \ 'whitelist': ['sql'], - \ 'workspace_config': { - \ 'sqls': { - \ 'connections': [ - \ { - \ 'driver': 'mysql', - \ 'dataSourceName': 'root:zsz123@tcp(127.0.0.1:3306)/test', - \ }, - \ ], - \ }, - \ }, - \ }) - augroup END -endif -END - + echo "no" } @@ -99,8 +57,7 @@ function java_ins(){ } function lua_ins(){ - ! ( grep -F "languageserver" ~/.config/nvim/coc-settings.json ) && \ - sed -i '/suggest.timeout/i "languageserver": {\n"lua": {\n"command": "lua-lsp",\n"filetypes": ["lua"]\n}\n },' ~/.config/nvim/coc-settings.json + echo "no" } function bash_ins(){ @@ -128,18 +85,7 @@ END } function php_ins(){ - ! (grep -F 'vim-php-cs-fixer' ~/.config/nvim/init.vim &>/dev/null ) && \ - sed -i "/plug#begin/aPlug 'stephpy/vim-php-cs-fixer'" ~/.config/nvim/init.vim && \ - sed -i "/plug#begin/aPlug 'vim-vdebug/vdebug'" ~/.config/nvim/init.vim - cat > /usr/local/bin/phpxd <> ~/.config/nvim/init.vim ! ( grep -F "cus_ini_env" ~/.env ) && \ cat tools/neovim/env.ini >> ~/.env -# [ ! -f /usr/local/bin/genUrl ] &&\ -# cp tools/neovim/genUrl.sh /usr/local/bin/genUrl && chmod u+x /usr/local/bin/genUrl -# [ ! -d /usr/local/vimsplain ] &&\ -# git clone https://github.com/pafcu/vimsplain.git /usr/local/vimsplain -#rm -rf ~/.gdbinit && cp tools/neovim/gdbinit ~/.gdbinit - ! ( grep -F "defx_my_settings" ~/.config/nvim/init.vim ) && \ cat >> ~/.config/nvim/init.vim </dev/null ) && \ -echo 'export LC_ALL=zh_CN.UTF-8' >> "$HOME/.env" && \ -echo 'export LANG=zh_CN.UTF-8' >> "$HOME/.env" && \ -echo "export PATH=\$PATH:$HOME/.composer/vendor/bin" >> "$HOME/.env" - ! (grep -F 'zsh-syntax-highlighting' ~/.cus_zshrc &>/dev/null ) && \ cat >> ~/.cus_zshrc </dev/null ) && \ - echo 'if [ -f ~/.env ];then; source ~/.env;fi' >> ~/.zshrc - -! (grep -F 'history-incremental-search-backward' ~/.cus_zshrc &>/dev/null ) && \ -cat >> ~/.cus_zshrc < Date: Thu, 15 Oct 2020 08:19:30 +0800 Subject: [PATCH 17/21] vimspector --- tools/neovim/init.vim | 1 + tools/neovim/vimspector.json | 139 +++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 tools/neovim/vimspector.json diff --git a/tools/neovim/init.vim b/tools/neovim/init.vim index 8374b4a..066bb1b 100755 --- a/tools/neovim/init.vim +++ b/tools/neovim/init.vim @@ -1,4 +1,5 @@ call plug#begin('~/.local/share/nvim/plugged') + Plug 'puremourning/vimspector', { 'dir': '~/.vim/vimspector-config', 'do': './install_gadget.py ' } "complete Plug 'neoclide/coc.nvim', {'branch': 'release'} "outline diff --git a/tools/neovim/vimspector.json b/tools/neovim/vimspector.json new file mode 100644 index 0000000..19ac953 --- /dev/null +++ b/tools/neovim/vimspector.json @@ -0,0 +1,139 @@ +{ + + "configurations": { + + "Python: Attach To Vim": { + + "variables": { + + "port": "5678", + + "host": "localhost" + + }, + + "adapter": "multi-session", + + "configuration": { + + "request": "attach" + + } + + }, + + "Python: Run current script": { + + "adapter": "debugpy", + + "configuration": { + + "request": "launch", + + "program": "${file}", + + "args": [ "*${args:--update-gadget-config}" ], + + "justMyCode#json": "${justMyCode:false}" + + } + + }, + + + + "cpp Launch": { + + "adapter": "vscode-cpptools", + + "configuration": { + + "request": "launch", + + "args": [ "*${args:-x /root/workspace/linux-0.12/oslab/bochs/.gdbrc}" ], + + "program": "/root/workspace/linux-0.12/linux-0.12/tools/system", + + "MIMode": "gdb", + + "stopAtEntry": true, + + "miDebuggerServerAddress": "localhost:1234" + + + + + + } + + }, + + "run go": { + + "adapter": "vscode-go", + + "configuration": { + + "request": "launch", + + "program": "${fileDirname}", + + "mode": "debug", + + "dlvToolPath": "$HOME/go/bin/dlv" + + } + + }, + + "Listen for XDebug": { + + "adapter": "vscode-php-debug", + + "configuration": { + + "name": "Listen for XDebug", + + "type": "php", + + "request": "launch", + + "port": 9000, + + "stopOnEntry": false, + + "pathMappings": { + + "/var/www/html": "${workspaceRoot}" + + } + + } + + }, + + "Launch currently open script": { + + "adapter": "vscode-php-debug", + + "configuration": { + + "name": "Launch currently open script", + + "type": "php", + + "request": "launch", + + "program": "${file}", + + "cwd": "${fileDirname}", + + "port": 9000 + + } + + } + +} + +} From 7cfa67be7e5fcaa31fa30a46c32a4c019d86471d Mon Sep 17 00:00:00 2001 From: zhoupro Date: Sat, 17 Oct 2020 01:21:02 +0800 Subject: [PATCH 18/21] remove sth --- init.sh | 12 +- tools/dep/centos_init.sh | 20 - tools/dep/mac_init.sh | 20 - tools/dep/ubuntu_init.sh | 27 - tools/hyper/hyper.js | 164 ----- tools/hyper/mac_init.sh | 12 - tools/jdk/init.sh | 28 - tools/jdk/mac_init.sh | 20 - tools/neovim/base_init.vim | 384 ------------ tools/neovim/c_cnt.sh | 11 - tools/neovim/centos_init.sh | 39 -- tools/neovim/cfg.ini | 3 - tools/neovim/env.ini | 5 - tools/neovim/gdbinit | 2 - tools/neovim/genUrl.sh | 35 -- tools/neovim/init.vim | 12 +- tools/neovim/mac_init.sh | 38 -- tools/neovim/ubuntu_init.sh | 17 +- tools/neovim/vimspector.json | 84 +-- tools/pxy/init.sh | 7 - tools/pxy/pxy.sh | 35 -- tools/ssh/mac_init.sh | 4 - tools/ssh/ssh.exp | 14 - tools/tmux/centos_init.sh | 22 - tools/tmux/mac_init.sh | 5 - tools/tmux/tmux.conf | 1152 ---------------------------------- tools/tmux/tmux.conf.local | 325 ---------- tools/tmux/ubuntu_init.sh | 4 + tools/zsh/centos_init.sh | 92 --- tools/zsh/mac_init.sh | 81 --- tools/zsh/ubuntu_init.sh | 21 +- 31 files changed, 53 insertions(+), 2642 deletions(-) delete mode 100644 tools/dep/centos_init.sh delete mode 100644 tools/dep/mac_init.sh delete mode 100644 tools/hyper/hyper.js delete mode 100755 tools/hyper/mac_init.sh delete mode 100644 tools/jdk/init.sh delete mode 100644 tools/jdk/mac_init.sh delete mode 100755 tools/neovim/base_init.vim delete mode 100755 tools/neovim/c_cnt.sh delete mode 100644 tools/neovim/centos_init.sh delete mode 100644 tools/neovim/cfg.ini delete mode 100644 tools/neovim/env.ini delete mode 100644 tools/neovim/gdbinit delete mode 100644 tools/neovim/genUrl.sh delete mode 100644 tools/neovim/mac_init.sh delete mode 100644 tools/pxy/init.sh delete mode 100755 tools/pxy/pxy.sh delete mode 100644 tools/ssh/mac_init.sh delete mode 100755 tools/ssh/ssh.exp delete mode 100755 tools/tmux/centos_init.sh delete mode 100755 tools/tmux/mac_init.sh delete mode 100644 tools/tmux/tmux.conf delete mode 100644 tools/tmux/tmux.conf.local delete mode 100644 tools/zsh/centos_init.sh delete mode 100755 tools/zsh/mac_init.sh diff --git a/init.sh b/init.sh index 758b350..d46169b 100755 --- a/init.sh +++ b/init.sh @@ -9,16 +9,10 @@ source "./helper/system_info.sh" source "./helper/installer.sh" source "./helper/option.sh" ins dep -ins pxy -if [ "Y$OPT_JAVA" == "Yyes" ];then - ins jdk -fi +ins neovim +#ins tmux +#ins zsh -# main tools start -ins tmux -ins zsh -ins neovim -#ins ssh # vim: set ts=4 sw=4 tw=0 et : diff --git a/tools/dep/centos_init.sh b/tools/dep/centos_init.sh deleted file mode 100644 index 82b3277..0000000 --- a/tools/dep/centos_init.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -! which rg && \ -sudo yum-config-manager --add-repo=https://copr.fedorainfracloud.org/coprs/carlwgeorge/ripgrep/repo/epel-7/carlwgeorge-ripgrep-epel-7.repo && \ -sudo yum install -y ripgrep - -! which fzf && \ -wget https://github.com/junegunn/fzf-bin/releases/download/0.17.5/fzf-0.17.5-linux_amd64.tgz && -tar xzvf fzf-0.17.5-linux_amd64.tgz && sudo mv fzf "/usr/local/bin" && rm fzf-*.tgz - -sudo yum install -y python34-pip -sudo yum install -y python2-pip zsh - - -! which netcat && \ -wget http://sourceforge.net/projects/netcat/files/netcat/0.7.1/netcat-0.7.1.tar.gz && \ -tar xzvf netcat-0.7.1.tar.gz && \ -cd netcat-0.7.1 && \ -./configure && make && make install && \ -cd .. diff --git a/tools/dep/mac_init.sh b/tools/dep/mac_init.sh deleted file mode 100644 index b6521bf..0000000 --- a/tools/dep/mac_init.sh +++ /dev/null @@ -1,20 +0,0 @@ -which brew -if ! which brew;then - /usr/bin/ruby -e \ - "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -fi - -apps="wget fzf ripgrep autojump netcat iproute2mac clipper nmap graphviz" -for app in $apps -do - ! brew list | grep $app && brew install $app -done - -! brew list | grep python && brew install python3 -! brew list | grep python@2 && brew install python2 -! brew list | grep node && brew install node -! brew list | grep yarn && brew install yarn -! ls /Library/Fonts | grep Fura && -wget https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/patched-fonts/FiraCode/Retina/complete/Fura%20Code%20Retina%20Nerd%20Font%20Complete%20Mono.ttf && \ -mv Fura*Mono.ttf /Library/Fonts -! brew list | grep gnu-sed && brew install coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt grep diff --git a/tools/dep/ubuntu_init.sh b/tools/dep/ubuntu_init.sh index 0a4f7dd..893eddc 100644 --- a/tools/dep/ubuntu_init.sh +++ b/tools/dep/ubuntu_init.sh @@ -11,18 +11,12 @@ apt-get remove -y neovim exuberant-ctags -#install lazygit -#if [ ! -f /usr/local/bin/lazygit ]; then -# wget https://github.com/jesseduffield/lazygit/releases/download/v0.13/lazygit_0.13_Linux_x86_64.tar.gz && tar xzvf lazygit_0.13_Linux_x86_64.tar.gz && mv lazygit /usr/local/bin/ && chmod u+x /usr/local/bin/lazygit -#fi - if [ "Y$OPT_MAN" == "Yyes" ];then [ -f /etc/dpkg/dpkg.cfg.d/excludes ] && rm -rf /etc/dpkg/dpkg.cfg.d/excludes apt-get install -y \ cppman man manpages manpages-dev manpages-posix manpages-posix-dev fi -#install clangd8 url:https://apt.llvm.org/ if [ "Y$OPT_CPP" == "Yyes" ];then apt-get install -y \ valgrind clangd cscope gdb @@ -71,24 +65,3 @@ if [ "Y$OPT_FE" == "Yyes" ];then sudo npm install -g vscode-css-languageserver-bin fi -apt install maven -y -# if [ "Y$OPT_JAVA" == "Yyes" ];then -# OLD_DIR=`pwd` -# if [ ! -d ~/.config/coc/extensions/coc-java-data/server/config_linux ];then -# mkdir -p ~/.config/coc/extensions/coc-java-data/server && \ -# cd ~/.config/coc/extensions/coc-java-data/server && \ -# axel https://download.eclipse.org/jdtls/milestones/0.35.0/jdt-language-server-0.35.0-201903142358.tar.gz && \ -# tar xf jdt-language-server-0.35.0-201903142358.tar.gz && rm jdt-language-server*.tar.gz -# fi -# cd $OLD_DIR -# if [ ! -d /opt/apache-maven-3.6.1 ];then -# # install maven -# cd /opt && \ -# wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz && \ -# tar xf apache-maven-3.6.1-bin.tar.gz && \ -# export PATH=/opt/apache-maven-3.6.1/bin:$PATH && \ -# echo "export PATH=\"/opt/apache-maven-3.6.1:$PATH\"" >> "$HOME/.cus_zshrc" -# cd $OLD_DIR -# fi -# fi - diff --git a/tools/hyper/hyper.js b/tools/hyper/hyper.js deleted file mode 100644 index 78a014a..0000000 --- a/tools/hyper/hyper.js +++ /dev/null @@ -1,164 +0,0 @@ -// Future versions of Hyper may add additional config options, -// which will not automatically be merged into this file. -// See https://hyper.is#cfg for all currently supported options. - -module.exports = { - config: { - // choose either `'stable'` for receiving highly polished, - // or `'canary'` for less polished but more frequent updates - updateChannel: 'stable', - - // default font size in pixels for all tabs - fontSize: 16, - - // font family with optional fallbacks - fontFamily: '"FuraCode Nerd Font Mono", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace', - // default font weight: 'normal' or 'bold' - fontWeight: 'normal', - - // font weight for bold characters: 'normal' or 'bold' - fontWeightBold: 'bold', - - // terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) - cursorColor: 'rgba(248,28,229,0.8)', - - // terminal text color under BLOCK cursor - cursorAccentColor: '#000', - - // `'BEAM'` for |, `'UNDERLINE'` for _, `'BLOCK'` for █ - cursorShape: 'BLOCK', - - // set to `true` (without backticks and without quotes) for blinking cursor - cursorBlink: false, - - // color of the text - foregroundColor: '#fff', - - // terminal background color - // opacity is only supported on macOS - backgroundColor: '#000', - - // terminal selection color - selectionColor: 'rgba(248,28,229,0.3)', - - // border color (window, tabs) - borderColor: '#333', - - // custom CSS to embed in the main window - css: '', - - // custom CSS to embed in the terminal window - termCSS: '', - - // if you're using a Linux setup which show native menus, set to false - // default: `true` on Linux, `true` on Windows, ignored on macOS - showHamburgerMenu: '', - - // set to `false` (without backticks and without quotes) if you want to hide the minimize, maximize and close buttons - // additionally, set to `'left'` if you want them on the left, like in Ubuntu - // default: `true` (without backticks and without quotes) on Windows and Linux, ignored on macOS - showWindowControls: '', - - // custom padding (CSS format, i.e.: `top right bottom left`) - padding: '3px 0px 14px 0px', - - // the full list. if you're going to provide the full color palette, - // including the 6 x 6 color cubes and the grayscale map, just provide - // an array here instead of a color map object - colors: { - black: '#000000', - red: '#C51E14', - green: '#1DC121', - yellow: '#C7C329', - blue: '#0A2FC4', - magenta: '#C839C5', - cyan: '#20C5C6', - white: '#C7C7C7', - lightBlack: '#686868', - lightRed: '#FD6F6B', - lightGreen: '#67F86F', - lightYellow: '#FFFA72', - lightBlue: '#6A76FB', - lightMagenta: '#FD7CFC', - lightCyan: '#68FDFE', - lightWhite: '#FFFFFF', - }, - - // the shell to run when spawning a new session (i.e. /usr/local/bin/fish) - // if left empty, your system's login shell will be used by default - // - // Windows - // - Make sure to use a full path if the binary name doesn't work - // - Remove `--login` in shellArgs - // - // Bash on Windows - // - Example: `C:\\Windows\\System32\\bash.exe` - // - // PowerShell on Windows - // - Example: `C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe` - shell: '', - - // for setting shell arguments (i.e. for using interactive shellArgs: `['-i']`) - // by default `['--login']` will be used - shellArgs: ['--login'], - - // for environment variables - env: {}, - - // set to `false` for no bell - bell: 'SOUND', - - // if `true` (without backticks and without quotes), selected text will automatically be copied to the clipboard - copyOnSelect: false, - - // if `true` (without backticks and without quotes), hyper will be set as the default protocol client for SSH - defaultSSHApp: true, - - // if `true` (without backticks and without quotes), on right click selected text will be copied or pasted if no - // selection is present (`true` by default on Windows and disables the context menu feature) - // quickEdit: true, - - // URL to custom bell - // bellSoundURL: 'http://example.com/bell.mp3', - - // for advanced config flags please refer to https://hyper.is/#cfg - - hyperTabs: { - trafficButtons: true, - border: true, - tabIconsColored: true, - activityColor: 'salmon', - }, - visor: { - hotkey: 'Command+P', - position: 'top', // or left, right, bottom - }, - }, - - - // a list of plugins to fetch and install from npm - // format: [@org/]project[#version] - // examples: - // `hyperpower` - // `@company/project` - // `project#1.0.1` - plugins: [ - 'hyper-one-dark', - 'hyper-tabs-enhanced', - "hyper-dark-scrollbar", - "hyper-search", - "hyperterm-visor", - ], - - - - // in development, you can create a directory under - // `~/.hyper_plugins/local/` and include it here - // to load it and avoid it being `npm install`ed - localPlugins: [], - - keymaps: { - // Example - // 'window:devtools': 'cmd+alt+o', - }, -}; diff --git a/tools/hyper/mac_init.sh b/tools/hyper/mac_init.sh deleted file mode 100755 index b775bae..0000000 --- a/tools/hyper/mac_init.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -rm ~/.hyper.js -cp tools/hyper/hyper.js ~/.hyper.js -if [ -d "/Applications/Hyper.app" ];then - return -fi - -wget "https://github.com/zeit/hyper/releases/download/2.1.0/Hyper-2.1.0.dmg" -sudo hdiutil attach -quiet "Hyper-2.1.0.dmg" -sudo cp -r "/Volumes/Hyper 2.1.0/Hyper.app" /Applications -sudo hdiutil detach "/Volumes/Hyper 2.1.0" -rm -rf "Hyper-2.1.0.dmg" diff --git a/tools/jdk/init.sh b/tools/jdk/init.sh deleted file mode 100644 index 905fd8c..0000000 --- a/tools/jdk/init.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -JDK_VERSION=11 -function jdk(){ - DOWN_URL="https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_linux-x64_bin.tar.gz" - sudo mkdir -p /usr/lib/jvm && sudo chmod 777 /usr/lib/jvm - if [ ! -d /usr/lib/jvm/jdk${JDK_VERSION} ]; then - if [ ! -f openjdk*.tar.gz ]; - then - echo "downloading jdk ${JDK_VERSION}" - wget $DOWN_URL - fi - rm -rf /usr/lib/jvm/* - tar xzvf openjdk*.tar.gz && mv jdk-11 jdk${JDK_VERSION} && mv jdk${JDK_VERSION} /usr/lib/jvm/ - echo "export JAVA_HOME=/usr/lib/jvm/jdk${JDK_VERSION}" >> "$HOME/.cus_zshrc" - echo "export CLASSPATH=\".:/usr/lib/jvm/jdk${JDK_VERSION}/lib:/usr/lib/jvm/jdk${JDK_VERSION}\"" >> "$HOME/.cus_zshrc" - echo "export PATH=\"/usr/lib/jvm/jdk${JDK_VERSION}/bin:$PATH\"" >> "$HOME/.cus_zshrc" - export JAVA_HOME="/usr/lib/jdk${JDK_VERSION}" - export CLASSPATH=".:/usr/lib/jvm/jdk${JDK_VERSION}/lib:/usr/lib/jvm/jdk${JDK_VERSION}" - export PATH="/usr/lib/jvm/jdk${JDK_VERSION}/bin:$PATH" - fi -} - - -if [ ! -f /usr/lib/jvm/jdk${JDK_VERSION}/bin/java ];then - #jdk - apt install -y openjdk-14-jdk -fi diff --git a/tools/jdk/mac_init.sh b/tools/jdk/mac_init.sh deleted file mode 100644 index a504c66..0000000 --- a/tools/jdk/mac_init.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -#http://www.linuxidc.com/Linux/2016-06/132678.htm - -function downloadjdk(){ - wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/11.0.2+9/f51449fcd52f4d52b93a989c5c56ed3c/jdk-11.0.2_osx-x64_bin.dmg -} - - -function jdk(){ - if [ ! -f jdk-11.0.2_osx-x64_bin.dmg ];then - downloadjdk - fi - sudo hdiutil attach -quiet jdk-11.0.2_osx-x64_bin.dmg - sudo installer -pkg /Volumes/JDK\ 11.0.2/JDK\ 11.0.2.pkg -target "/" - sudo hdiutil detach "/Volumes/JDK 11.0.2" - -} -if [ ! -d /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk ];then - jdk -fi diff --git a/tools/neovim/base_init.vim b/tools/neovim/base_init.vim deleted file mode 100755 index 85d82de..0000000 --- a/tools/neovim/base_init.vim +++ /dev/null @@ -1,384 +0,0 @@ -call plug#begin('~/.local/share/nvim/plugged') - "deop - Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } - "outline - Plug 'majutsushi/tagbar' - Plug 'vim-airline/vim-airline' - Plug 'vim-airline/vim-airline-themes' - " explore - Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } - Plug 'junegunn/fzf.vim' - Plug 'vim-scripts/ctags.vim' - Plug 'tpope/vim-commentary' - " explore - if has('nvim') - Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' } - else - Plug 'Shougo/defx.nvim' - Plug 'roxma/nvim-yarp' - Plug 'roxma/vim-hug-neovim-rpc' - endif - Plug 'kristijanhusak/defx-icons' - Plug 'kristijanhusak/defx-git' - "git - Plug 'tpope/vim-fugitive' - Plug 'airblade/vim-gitgutter' - Plug 'gregsexton/gitv' - " c - Plug 'vim-scripts/a.vim' - " transform - Plug 'tpope/vim-abolish' - Plug 'tpope/vim-surround' - Plug 'tpope/vim-repeat' - " snips - Plug 'SirVer/ultisnips' - Plug 'honza/vim-snippets' - " themes - Plug 'joshdick/onedark.vim' - " 语言语法高亮 - Plug 'sheerun/vim-polyglot' - " num rep - Plug 'glts/vim-magnum' - Plug 'glts/vim-radical' - " mru - Plug 'vim-scripts/mru.vim' - " start screen - Plug 'mhinz/vim-startify' - " add header - Plug 'alpertuna/vim-header' - " select - Plug 'terryma/vim-expand-region' - Plug 'terryma/vim-multiple-cursors' - "nginx - Plug 'chr4/nginx.vim' - " icon - Plug 'ryanoasis/vim-devicons' - " tmux - Plug 'christoomey/vim-tmux-navigator' - Plug 'junegunn/goyo.vim' - "indent - Plug 'Yggdroot/indentLine' - "undo - Plug 'mbbill/undotree' - "markdown - " have nodejs and yarn - Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' } - Plug 'wellle/targets.vim' - Plug 'forevernull/vim-json-format' - Plug 'paroxayte/vwm.vim' - Plug 'jiangmiao/auto-pairs' - Plug 'iandingx/leetcode.vim' - " graphviz - Plug 'liuchengxu/graphviz.vim' - call plug#end() - -" our will be the space key -let mapleader="," -set noswapfile -map js :call json_format#parse("l") -" Highlight search results -set hlsearch -" Makes search act like search in modern browsers -set incsearch -" clear highlight -nnoremap :nohlsearch -map K (expand_region_expand) -map J (expand_region_shrink) -""""""""""""""""""""""""""""""""""""" -" Mappings configurationn -""""""""""""""""""""""""""""""""""""" -map n :Defx -map m :TagbarOpenAutoClose - -func! RunProgram() - exec "w" - if &filetype == 'c' - exec "!gcc % -o %<" - exec "! ./%<" - elseif &filetype == 'cpp' - exec "!g++ % -o %<" - exec "! ./%<" - elseif &filetype == 'sh' - exec "!bash %" - elseif &filetype == 'go' - exec "!go run %" - elseif &filetype == 'python' - exec "!python %" - elseif &filetype == 'php' - exec "!php %" - elseif &filetype == 'lua' - exec "!lua %" - elseif &filetype == 'dot' - exec "GraphvizCompile png" - exec "Graphviz png" - elseif &filetype == 'java' - exec "!javac %" - exec "!java -cp %:p:h %:t:r" - endif -endfunc -autocmd VimEnter * noremap t :call RunProgram() -" ctags -set tags=tags; " ; 不可省略,表示若当前目录中不存在tags, 则在父目录中寻找。 -nmap ]s :call GenCscope() -func! GenCscope() - exec "w" - if &filetype == 'php' - exec '!find . -name "*.php" > cscope.files' - exec "!cscope -bkq -i cscope.files" - exec "!(cat cscope.files | ctags -f tags --languages=php --php-kinds=ctif --fields=+aimS -L -)" - elseif &filetype == 'c' - exec '!find . -name "*.c" -o -name "*.h" > cscope.files' - exec "!cscope -bkq -i cscope.files" - exec "!(cat cscope.files | ctags -f tags --c++-kinds=+p --fields=+iaS --extras=+q -L -)" - endif -endfunc - -if has("cscope") - set cscopetag " 使支持用 Ctrl+] 和 Ctrl+t 快捷键在代码间跳来跳去 - " check cscope for definition of a symbol before checking ctags: - " set to 1 if you want the reverse search order. - set csto=1 - nmap [s :cs find s =expand("") - nmap [g :cs find g =expand("") - nmap [c :cs find c =expand("") - nmap [t :cs find t =expand("") - nmap [e :cs find e =expand("") - nmap [f :cs find f =expand("") - nmap [i :cs find i =expand("")$ - nmap [d :cs find d =expand("") -endif -" Autoloading Cscope Database -function! LoadCscope() - let db = findfile("cscope.out", ".;") - if (!empty(db)) - let path = strpart(db, 0, match(db, "/cscope.out$")) - set nocscopeverbose " suppress 'duplicate connection' error - exe "cs add " . db . " " . path - set cscopeverbose - " else add the database pointed to by environment variable - elseif $CSCOPE_DB != "" - cs add $CSCOPE_DB - endif -endfunction -au BufEnter /* call LoadCscope() - -set background=dark - - -" for debug -set nu -set list - -" exploer -nnoremap f :Files -nnoremap e :MRU - -" snips -" UltiSnips 的 tab 键与 YCM 冲突,重新设定 -let g:UltiSnipsExpandTrigger="" -let g:UltiSnipsJumpForwardTrigger="" -let g:UltiSnipsJumpBackwardTrigger="" -nnoremap y :call system('NCCOMMAND NCHOST 8377', @0) -nnoremap ] :call fzf#vim#tags('^' . expand(''), {'options': '--exact --select-1 --exit-0 +i'}) - -" color change fix in tmux -set t_Co=256 -"switch windows -if has('nvim') - " Terminal mode: - tnoremap h h - tnoremap j j - tnoremap k k - tnoremap l l - " Insert mode: - inoremap h h - inoremap j j - inoremap k k - inoremap l l - " Visual mode: - vnoremap h h - vnoremap j j - vnoremap k k - vnoremap l l - " Normal mode: - nnoremap h h - nnoremap j ji - nnoremap k k - nnoremap l l -endif -set scrolloff=5 -let g:header_auto_add_header = 0 - -let g:tmux_navigator_no_mappings = 1 -nnoremap :TmuxNavigateLeft -nnoremap :TmuxNavigateUp -nnoremap :TmuxNavigatePrevious - -" backward -noremap \ , -let g:polyglot_disabled = ['markdown'] - -" buf tab -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#tabline#tab_nr_type = 1 " tab number -let g:airline#extensions#tabline#show_tab_nr = 1 -let g:airline#extensions#tabline#formatter = 'default' -let g:airline#extensions#tabline#buffer_nr_show = 0 -let g:airline#extensions#tabline#fnametruncate = 16 -let g:airline#extensions#tabline#fnamecollapse = 2 -let g:airline#extensions#tabline#buffer_idx_mode = 1 -nmap 1 AirlineSelectTab1 -nmap 2 AirlineSelectTab2 -nmap 3 AirlineSelectTab3 -nmap 4 AirlineSelectTab4 -nmap 5 AirlineSelectTab5 -nmap 6 AirlineSelectTab6 -nmap 7 AirlineSelectTab7 -nmap 8 AirlineSelectTab8 -nmap 9 AirlineSelectTab9 -command! -bang -nargs=* Rg - \ call fzf#vim#grep( - \ 'rg --column --line-number --hidden --ignore-case --ignore-file ~/.fzf_ignore --no-heading --color=always '., 1, - \ 0 ? fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}, 'up:60%') - \ : fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}, 'right:50%:hidden', '?'), - \ 0) -nnoremap a :Rg -if has("persistent_undo") - set undodir=~/.undodir/ - set undofile -endif -" tab 替换为4个空格 -set tabstop=4 -set shiftwidth=4 -set expandtab - -" Append modeline after last line in buffer. -" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX -" files. -function! AppendModeline() - let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", - \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') - let l:modeline = substitute(&commentstring, "%s", l:modeline, "") - call append(line("$"), l:modeline) -endfunction -nnoremap ml :call AppendModeline() -" add current file to ignore file -command Gg call system('echo '.expand("%"). '>> .git/info/exclude') -" remove current file from ignore file -command Gr call system('sed -i "s#'.expand("%").'##g" .git/info/exclude') -fu! s:isdir(dir) abort - return !empty(a:dir) && (isdirectory(a:dir) || - \ (!empty($SYSTEMDRIVE) && isdirectory('/'.tolower($SYSTEMDRIVE[0]).a:dir))) -endfu -set foldmethod=manual - -let s:bot = { -\ 'name': 'bot', -\ 'set_all': ['nonu', 'nornu'], -\ 'bot': -\ { -\ 'h_sz': 12, -\ 'init': [ 'term zsh' ] -\ } -\ } - -let g:vwm#layouts = [s:bot] -"https://github.com/Shougo/deoplete.nvim/issues/440 -let g:deoplete#enable_at_startup = 1 -" : completion. -inoremap pumvisible() ? "\" : "\" -let g:deoplete#auto_complete_delay = 150 -let g:deoplete#omni#input_patterns = get(g:,'deoplete#omni#input_patterns',{}) -autocmd FileType dot let g:deoplete#omni#input_patterns.dot = '\w+|[^. *\t][.:]\w*' -"defx -augroup vimrc_defx - autocmd! - autocmd FileType defx call s:defx_my_settings() "Defx mappings - autocmd VimEnter * call s:setup_defx() -augroup END -let s:default_columns = 'indent:git:icons:filename' -function! s:setup_defx() abort - call defx#custom#option('_', { - \ 'columns': s:default_columns, - \ 'show_ignored_files': 0, - \ 'buffer_name': '', - \ 'toggle': 1, - \ 'resume': 1, - \ }) - - call defx#custom#column('filename', { - \ 'min_width': 80, - \ 'max_width': 80, - \ }) - call s:defx_open() -endfunction - -function! s:defx_open(...) abort - sil! au! FileExplorer * - if s:isdir(expand('%')) | bd | exe 'Defx' | endif -endfunction - -function! s:defx_my_settings() abort - " Define mappings - nnoremap - \ defx#do_action('open') - nnoremap c - \ defx#do_action('copy') - nnoremap m - \ defx#do_action('move') - nnoremap p - \ defx#do_action('paste') - nnoremap l - \ defx#do_action('open') - nnoremap E - \ defx#do_action('open', 'vsplit') - nnoremap P - \ defx#do_action('open', 'pedit') - nnoremap o - \ defx#do_action('open_or_close_tree') - nnoremap K - \ defx#do_action('new_directory') - nnoremap N - \ defx#do_action('new_file') - nnoremap M - \ defx#do_action('new_multiple_files') - nnoremap C - \ defx#do_action('toggle_columns', - \ 'mark:filename:type:size:time') - nnoremap S - \ defx#do_action('toggle_sort', 'time') - nnoremap d - \ defx#do_action('remove') - nnoremap r - \ defx#do_action('rename') - nnoremap ! - \ defx#do_action('execute_command') - nnoremap x - \ defx#do_action('execute_system') - nnoremap yy - \ defx#do_action('yank_path') - nnoremap . - \ defx#do_action('toggle_ignored_files') - nnoremap ; - \ defx#do_action('repeat') - nnoremap h - \ defx#do_action('cd', ['..']) - nnoremap ~ - \ defx#do_action('cd') - nnoremap q - \ defx#do_action('quit') - nnoremap - \ defx#do_action('toggle_select') . 'j' - nnoremap * - \ defx#do_action('toggle_select_all') - nnoremap j - \ line('.') == line('$') ? 'gg' : 'j' - nnoremap k - \ line('.') == 1 ? 'G' : 'k' - nnoremap - \ defx#do_action('redraw') - nnoremap - \ defx#do_action('print') - nnoremap cd - \ defx#do_action('change_vim_cwd') -endfunction diff --git a/tools/neovim/c_cnt.sh b/tools/neovim/c_cnt.sh deleted file mode 100755 index e1ebc98..0000000 --- a/tools/neovim/c_cnt.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -trim() { - local var="$*" - # remove leading whitespace characters - var="${var#"${var%%[![:space:]]*}"}" - # remove trailing whitespace characters - var="${var%"${var##*[![:space:]]}"}" - echo -n "$var" -} -cnt=$(tail "$1/cscope.out" | grep -e "\.c$" | wc -l) -trim $cnt diff --git a/tools/neovim/centos_init.sh b/tools/neovim/centos_init.sh deleted file mode 100644 index 2f1e8b9..0000000 --- a/tools/neovim/centos_init.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -if [ ! -f /usr/local/bin/vim ];then - if [ ! -f nvim.appimage ];then - wget https://github.com/neovim/neovim/releases/download/stable/nvim.appimage - fi - sudo chmod u+x nvim.appimage && sudo ./nvim.appimage --appimage-extract - mkdir -p ~/opt/soft - sudo mv squashfs-root ~/opt/soft/nvim - sudo ln -s ~/opt/soft/nvim/usr/bin/nvim /usr/local/bin/vim - rm -rf nvim.appimage -fi -sudo pip3 install neovim --upgrade -sudo pip2 install neovim --upgrade -pip3 install requests beautifulsoup4 -#------------------------------------------------------------------------------- -# install vim-plug -#------------------------------------------------------------------------------- -if [ ! -f ~/.local/share/nvim/site/autoload/plug.vim ] ; then - sudo curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -fi -sudo rm -f ~/.config/nvim/base_init.vim -sudo mkdir -p ~/.config/nvim -sudo cp tools/neovim/base_init.vim ~/.config/nvim/init.vim -vim +'PlugInstall --sync' +qall - -# copy -if nmap localhost -p 8377 | grep open 2>/dev/null;then - sed -in 's#NCHOST#localhost#g' ~/.config/nvim/init.vim -else - sed -in 's#NCHOST#host.docker.internal#g' ~/.config/nvim/init.vim -fi - -if [ "$sys_os" == "ubuntu" ];then - sed -in 's#NCCOMMAND#nc -q 1#g' ~/.config/nvim/init.vim -else - sed -in 's#NCCOMMAND#nc -c#g' ~/.config/nvim/init.vim -fi - diff --git a/tools/neovim/cfg.ini b/tools/neovim/cfg.ini deleted file mode 100644 index e5f6f64..0000000 --- a/tools/neovim/cfg.ini +++ /dev/null @@ -1,3 +0,0 @@ -" cus_ini_vim -let g:header_field_author = 'prozhou' -let g:header_field_author_email = 'zhoushengzheng@gmail.com' diff --git a/tools/neovim/env.ini b/tools/neovim/env.ini deleted file mode 100644 index 9237a5e..0000000 --- a/tools/neovim/env.ini +++ /dev/null @@ -1,5 +0,0 @@ -#cus_ini_env -alias vim="nvim" -alias vi="nvim" -alias gdb="gdb -q" - diff --git a/tools/neovim/gdbinit b/tools/neovim/gdbinit deleted file mode 100644 index 88e7caf..0000000 --- a/tools/neovim/gdbinit +++ /dev/null @@ -1,2 +0,0 @@ -set confirm off -set pagination off diff --git a/tools/neovim/genUrl.sh b/tools/neovim/genUrl.sh deleted file mode 100644 index 745dbc8..0000000 --- a/tools/neovim/genUrl.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# check file -[ ! -f "$1" ] && - exit 0 -git_path="$HOME/.local/share/nvim/plugged/" -git_repo="git@github.com:zhoupro/images.git" -repo_name="images" -github_prefix="https://raw.githubusercontent.com/zhoupro/images/master" -old_path=$(pwd) -cur_date=$(date +"%Y%m%d") -file_name=$(basename "$1") - -if [ ! -d "$git_path/$repo_name/.git" ] -then - cd $git_path - git clone --quiet $git_repo - cd $old_path -fi -cd "$git_path/$repo_name" && \ -ls | grep -v $cur_date | xargs rm -rf &&\ -cd "$old_path" - -if [ -f "$git_path/$repo_name/$cur_date/$file_name" ] -then - echo "$github_prefix/$cur_date/$file_name" - exit 0 -fi -mkdir -p $git_path/$repo_name/$cur_date -cp $1 $git_path/$repo_name/$cur_date -cd $git_path/$repo_name && \ -git add "$cur_date" > /dev/null &&\ -git commit -m "$cur_date $file_name" >/dev/null &&\ -git push --quiet origin master &&\ -cd $old_path -echo "$github_prefix/$cur_date/$file_name" diff --git a/tools/neovim/init.vim b/tools/neovim/init.vim index 066bb1b..eb99440 100755 --- a/tools/neovim/init.vim +++ b/tools/neovim/init.vim @@ -1,5 +1,5 @@ call plug#begin('~/.local/share/nvim/plugged') - Plug 'puremourning/vimspector', { 'dir': '~/.vim/vimspector-config', 'do': './install_gadget.py ' } + Plug 'puremourning/vimspector' "complete Plug 'neoclide/coc.nvim', {'branch': 'release'} "outline @@ -188,3 +188,13 @@ fu! s:isdir(dir) abort endfu set foldmethod=manual + + + +nmap VimspectorToggleBreakpoint +nmap VimspectorToggleConditionalBreakpoint +nmap VimspectorAddFunctionBreakpoint +nmap VimspectorContinue +nmap VimspectorStepOver +nmap VimspectorStepInto +nmap VimspectorStepOut diff --git a/tools/neovim/mac_init.sh b/tools/neovim/mac_init.sh deleted file mode 100644 index edb2867..0000000 --- a/tools/neovim/mac_init.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -if [ ! -f /usr/local/bin/vim ];then - if [ ! -f nvim-macos.tar.gz ];then - wget https://github.com/neovim/neovim/releases/download/stable/nvim-macos.tar.gz - fi - rm -rf ~/opt/soft/nvim-osx64 - tar xzvf nvim-macos.tar.gz - rm -rf nvim-macos.tar.gz - mkdir -p ~/opt/soft - mv nvim-osx64 ~/opt/soft - ln -s ~/opt/soft/nvim-osx64/bin/nvim /usr/local/bin/vim -fi -pip3 install neovim --upgrade -pip2 install neovim --upgrade -pip3 install requests beautifulsoup4 -#------------------------------------------------------------------------------- -# install vim-plug -#------------------------------------------------------------------------------- -if [ ! -f ~/.local/share/nvim/site/autoload/plug.vim ] ; then - curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -fi -rm -f ~/.config/nvim/base_init.vim -mkdir -p ~/.config/nvim -cp tools/neovim/base_init.vim ~/.config/nvim/init.vim -vim +'PlugInstall --sync' +qall -# copy -if nmap localhost -p 8377 | grep open 2>/dev/null;then - sed -in 's#NCHOST#localhost#g' ~/.config/nvim/init.vim -else - sed -in 's#NCHOST#host.docker.internal#g' ~/.config/nvim/init.vim -fi - -if [ "$sys_os" == "ubuntu" ];then - sed -in 's#NCCOMMAND#nc -q 1#g' ~/.config/nvim/init.vim -else - sed -in 's#NCCOMMAND#nc -c#g' ~/.config/nvim/init.vim -fi diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index 39559e9..dfa790d 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -184,16 +184,27 @@ if [ "Y$OPT_FE" == "Yyes" ];then nvim "+CocInstall -sync coc-html coc-css coc-tsserver coc-emmet" +qall fi +if [ "Y$OPT_PHP" == "Yyes" ];then + ~/.local/share/nvim/plugged/vimspector/install_gadget.py --force-enable-php +fi + +if [ "Y$OPT_GO" == "Yyes" ];then + ~/.local/share/nvim/plugged/vimspector/install_gadget.py --enable-go +fi + + if [ "Y$OPT_JAVA" == "Yyes" ];then nvim "+CocInstall -sync coc-java" +qall fi if [ "Y$OPT_PYTHON" == "Yyes" ];then nvim "+CocInstall -sync coc-python" +qall + ~/.local/share/nvim/plugged/vimspector/install_gadget.py --enable-python fi if [ "Y$OPT_CPP" == "Yyes" ];then nvim "+CocInstall -sync coc-clangd" +qall + ~/.local/share/nvim/plugged/vimspector/install_gadget.py --enable-c fi if [ "Y$OPT_VIM" == "Yyes" ];then @@ -208,10 +219,6 @@ fi ! ( grep -F "highlight Normal ctermbg=None" ~/.config/nvim/init.vim ) && \ echo "highlight Normal ctermbg=None" >> ~/.config/nvim/init.vim -! ( grep -F "cus_ini_vim" ~/.config/nvim/init.vim ) && \ - cat tools/neovim/cfg.ini >> ~/.config/nvim/init.vim -! ( grep -F "cus_ini_env" ~/.env ) && \ - cat tools/neovim/env.ini >> ~/.env ! ( grep -F "defx_my_settings" ~/.config/nvim/init.vim ) && \ cat >> ~/.config/nvim/init.vim <> ~/.config/nvim/init.vim </dev/null;then - export http_proxy=http://localhost:39571 - export https_proxy=http://localhost:39571 -elif nmap host.docker.internal -p 39571 | grep open >/dev/null;then - ip=$(/sbin/ip route|awk '/default/ { print $3 }') - export http_proxy=http://$ip:39571 - export https_proxy=http://$ip:39571 -elif nmap localhost -p 8087 | grep open >/dev/null;then - export http_proxy=http://localhost:8087 - export https_proxy=http://localhost:8087 - curl http://localhost:8085/module/gae_proxy/control/download_cert |sudo tee --append /usr/local/share/ca-certificates/goagent.crt -elif nmap host.docker.internal -p 8087 | grep open >/dev/null;then - ip=$(/sbin/ip route|awk '/default/ { print $3 }') - if [ ! -f /usr/local/share/ca-certificates/goagent.crt ];then - wget "http://$ip:8085/module/gae_proxy/control/download_cert" -O /usr/local/share/ca-certificates/goagent.crt - mkdir -p /usr/local/share/ca-certificates - touch /usr/local/share/ca-certificates/goagent.crt - fi - export http_proxy=http://$ip:8087 - export https_proxy=http://$ip:8087 -else - export http_proxy="" - export https_proxy="" -fi -starttime=$(date +%s) -#执行程序 -"$@" -endtime=$(date +%s) -echo "use time: "$((endtime-starttime))"s" -unset http_proxy -unset https_proxy diff --git a/tools/ssh/mac_init.sh b/tools/ssh/mac_init.sh deleted file mode 100644 index d32b4da..0000000 --- a/tools/ssh/mac_init.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -cp tools/ssh/ssh.exp /usr/local/bin/ -sudo chmod 777 /usr/local/bin/ssh.exp diff --git a/tools/ssh/ssh.exp b/tools/ssh/ssh.exp deleted file mode 100755 index dcb75b2..0000000 --- a/tools/ssh/ssh.exp +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/expect -set loginstring [lindex $argv 0] -set fields [split $loginstring "@"] -lassign $fields user host -spawn ssh -CfNgqP -R 0.0.0.0:8377:127.0.0.1:8377 $user@$host -expect { - -re "password" { set passwd [gets stdin]; send "$passwd\r"} -} -interact -spawn ssh $user@$host -expect { - -re "password" {send "$passwd\r"} -} -interact diff --git a/tools/tmux/centos_init.sh b/tools/tmux/centos_init.sh deleted file mode 100755 index d5d30b4..0000000 --- a/tools/tmux/centos_init.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -if ! which tmux;then - wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz - tar xzvf libevent-2.0.21-stable.tar.gz - cd libevent-2.0.21-stable - ./configure && make - sudo make install - cd .. - git clone https://github.com/tmux/tmux.git tmux - cd tmux - sh autogen.sh - ./configure && make - sudo make install - cd .. -fi - -rm -f ~/.tmux.conf ~/.tmux.conf.local -cp tools/tmux/tmux.conf ~/.tmux.conf -cp tools/tmux/tmux.conf.local ~/.tmux.conf.local -echo 'alias tmux="tmux -2"' >> "$HOME/.bashrc" -echo 'export TERM=xterm-256color' >> "$HOME/.bashrc" diff --git a/tools/tmux/mac_init.sh b/tools/tmux/mac_init.sh deleted file mode 100755 index 57e1163..0000000 --- a/tools/tmux/mac_init.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -! brew list | grep tmux && brew install tmux -rm -f ~/.tmux.conf ~/.tmux.conf.local -cp tools/tmux/tmux.conf ~/.tmux.conf -cp tools/tmux/tmux.conf.local ~/.tmux.conf.local diff --git a/tools/tmux/tmux.conf b/tools/tmux/tmux.conf deleted file mode 100644 index b650e6f..0000000 --- a/tools/tmux/tmux.conf +++ /dev/null @@ -1,1152 +0,0 @@ -# cat << EOF > /dev/null -# https://github.com/gpakosz/.tmux -# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license, -# without any warranty. -# Copyright 2012— Gregory Pakosz (@gpakosz). -# /!\ do not edit this file -# instead, override settings in ~/.tmux.conf.local, see README.md - - -# -- general ------------------------------------------------------------------- - -set -g default-terminal "screen-256color" # colors! -setw -g xterm-keys on -set -s escape-time 10 # faster command sequences -set -sg repeat-time 600 # increase repeat timeout -set -s focus-events on - -set -g prefix2 C-a # GNU-Screen compatible prefix -bind C-a send-prefix -2 - -set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2) -setw -q -g utf8 on - -set -g history-limit 5000 # boost history - -# edit configuration -bind e new-window -n '~/.tmux.conf.local' "sh -c '\${EDITOR:-vim} ~/.tmux.conf.local && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'" - -# reload configuration -bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced' - - -# -- display ------------------------------------------------------------------- - -set -g base-index 1 # start windows numbering at 1 -setw -g pane-base-index 1 # make pane numbering consistent with windows - -setw -g automatic-rename on # rename window to reflect current program -set -g renumber-windows on # renumber windows when a window is closed - -set -g set-titles on # set terminal title - -set -g display-panes-time 800 # slightly longer pane indicators display time -set -g display-time 1000 # slightly longer status messages display time - -set -g status-interval 10 # redraw status line every 10 seconds - -# clear both screen and history -bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history - -# activity -set -g monitor-activity on -set -g visual-activity off - - -# -- navigation ---------------------------------------------------------------- - -# create session -bind C-c new-session - -# find session -bind C-f command-prompt -p find-session 'switch-client -t %%' - -# split current window horizontally -bind - split-window -v -# split current window vertically -bind _ split-window -h - -# pane navigation -bind -r h select-pane -L # move left -bind -r j select-pane -D # move down -bind -r k select-pane -U # move up -bind -r l select-pane -R # move right -bind > swap-pane -D # swap current pane with the next one -bind < swap-pane -U # swap current pane with the previous one - -# maximize current pane -bind + run 'cut -c3- ~/.tmux.conf | sh -s _maximize_pane "#{session_name}" #D' - -# pane resizing -bind -r H resize-pane -L 2 -bind -r J resize-pane -D 2 -bind -r K resize-pane -U 2 -bind -r L resize-pane -R 2 - -# window navigation -unbind n -unbind p -bind -r C-h previous-window # select previous window -bind -r C-l next-window # select next window -bind Tab last-window # move to last active window - -# toggle mouse -bind m run "cut -c3- ~/.tmux.conf | sh -s _toggle_mouse" - - -# -- urlview ------------------------------------------------------------------- - -bind U run "cut -c3- ~/.tmux.conf | sh -s _urlview #{pane_id}" - - -# -- facebook pathpicker ------------------------------------------------------- - -bind F run "cut -c3- ~/.tmux.conf | sh -s _fpp #{pane_id}" - - -# -- list choice (tmux < 2.4) -------------------------------------------------- - -# vi-choice is gone in tmux >= 2.4 -run -b 'tmux bind -t vi-choice h tree-collapse 2> /dev/null || true' -run -b 'tmux bind -t vi-choice l tree-expand 2> /dev/null || true' -run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null || true' -run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null || true' -run -b 'tmux bind -t vi-choice H tree-collapse-all 2> /dev/null || true' -run -b 'tmux bind -t vi-choice L tree-expand-all 2> /dev/null || true' -run -b 'tmux bind -t vi-choice Escape cancel 2> /dev/null || true' - - -# -- edit mode (tmux < 2.4) ---------------------------------------------------- - -# vi-edit is gone in tmux >= 2.4 -run -b 'tmux bind -ct vi-edit H start-of-line 2> /dev/null || true' -run -b 'tmux bind -ct vi-edit L end-of-line 2> /dev/null || true' -run -b 'tmux bind -ct vi-edit q cancel 2> /dev/null || true' -run -b 'tmux bind -ct vi-edit Escape cancel 2> /dev/null || true' - - -# -- copy mode ----------------------------------------------------------------- - -bind Enter copy-mode # enter copy mode - -run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true' -run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true' -run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true' -run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true' -run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true' -run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true' -run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true' -run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true' -run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true' -run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true' -run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true' -run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true' - -# copy to Mac OSX clipboard -if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"' -# copy to X11 clipboard -if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"' -if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"' -# copy to Windows clipboard -if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"' -if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"' - - -# -- buffers ------------------------------------------------------------------- - -bind b list-buffers # list paste buffers -bind p paste-buffer # paste from the top paste buffer -bind P choose-buffer # choose which buffer to paste from - - -# -- user defined overrides ---------------------------------------------------- - -if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local' - - -# -- 8< ------------------------------------------------------------------------ - -run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' - - -# EOF -# -# # exit the script if any statement returns a non-true return value -# set -e -# -# export LC_NUMERIC=C -# -# __newline=' -# ' -# -# _is_enabled() { -# ( ([ x"$1" = x"enabled" ] || [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"1" ]) && return 0 ) || return 1 -# } -# -# _circled_digit() { -# circled_digits='⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳' -# if [ "$1" -le 20 ] 2>/dev/null; then -# i=$(( $1 + 1 )) -# eval set -- "$circled_digits" -# eval echo "\${$i}" -# else -# echo "$1" -# fi -# } -# -# _maximize_pane() { -# current_session=${1:-$(tmux display -p '#{session_name}')} -# current_pane=${2:-$(tmux display -p '#{pane_id}')} -# -# dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -o '^1 %.\+maximized.\+$' || true) -# restore=$(echo "$dead_panes" | sed -n -E -e "s/^1 $current_pane .+maximized.+'(%[0-9]+)'$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t $current_pane/p" -e "s/^1 (%[0-9]+) .+maximized.+'$current_pane'$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t \1/p" ) -# -# if [ -z "$restore" ]; then -# [ "$(tmux list-panes -t "$current_session:" | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return -# window=$(tmux new-window -t "$current_session:" -P "exec maximized... 2> /dev/null & tmux setw -t \"$current_session:\" remain-on-exit on; printf \"Pane has been maximized, press + to restore. %s\" '$current_pane'") -# window=${window%.*} -# -# retry=10 -# while [ x"$(tmux list-panes -t "$window" -F '#{session_name}:#{window_index} #{pane_dead}' 2>/dev/null)" != x"$window 1" ] && [ "$retry" -ne 0 ]; do -# sleep 0.05 -# retry=$((retry - 1)) -# done -# if [ "$retry" -eq 0 ]; then -# tmux display 'Unable to maximize pane' -# fi -# -# new_pane=$(tmux display -t "$window" -p '#{pane_id}') -# tmux setw -t "$window" remain-on-exit off \; swap-pane -s "$current_pane" -t "$new_pane" -# else -# $restore || tmux kill-pane -# fi -# } -# -# _toggle_mouse() { -# old=$(tmux show -gv mouse) -# new="" -# -# if [ "$old" = "on" ]; then -# new="off" -# else -# new="on" -# fi -# -# tmux set -g mouse $new \;\ -# display "mouse: $new" -# } -# -# _battery() { -# charge=0 -# uname_s=$(uname -s) -# case "$uname_s" in -# *Darwin*) -# while IFS= read -r line; do -# if [ x"$discharging" != x"true" ]; then -# discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false") -# fi -# percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%') -# charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }') -# count=$((count + 1)) -# done << EOF -# $(pmset -g batt | grep 'InternalBattery') -# EOF -# ;; -# *Linux*) -# while IFS= read -r batpath; do -# grep -i -q device "$batpath/scope" 2> /dev/null && continue -# -# if [ x"$discharging" != x"true" ]; then -# discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false") -# fi -# bat_capacity="$batpath/capacity" -# if [ -r "$bat_capacity" ]; then -# charge=$(awk -v charge="$charge" -v capacity="$(cat "$bat_capacity")" 'BEGIN { print charge + capacity / 100 }') -# else -# bat_energy_full="$batpath/energy_full" -# bat_energy_now="$batpath/energy_now" -# if [ -r "$bat_energy_full" ] && [ -r "$bat_energy_now" ]; then -# charge=$(awk -v charge="$charge" -v energy_now="$(cat "$bat_energy_now")" -v energy_full="$(cat "$bat_energy_full")" 'BEGIN { print charge + energy_now / energy_full }') -# fi -# fi -# count=$((count + 1)) -# done << EOF -# $(find /sys/class/power_supply -maxdepth 1 -iname '*bat*') -# EOF -# ;; -# *CYGWIN*|*MSYS*|*MINGW*) -# while IFS= read -r line; do -# [ -z "$line" ] && continue -# if [ x"$discharging" != x"true" ]; then -# discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }') -# fi -# charge=$(printf '%s' "$line" | awk -v charge="$charge" '{ print charge + $2 / 100 }') -# count=$((count + 1)) -# done << EOF -# $(wmic path Win32_Battery get BatteryStatus, EstimatedChargeRemaining | tr -d '\r' | tail -n +2) -# EOF -# ;; -# *OpenBSD*) -# for batid in 0 1 2; do -# sysctl -n "hw.sensors.acpibat$batid.raw0" 2>&1 | grep -q 'not found' && continue -# if [ x"$discharging" != x"true" ]; then -# discharging=$(sysctl -n "hw.sensors.acpibat$batid.raw0" | grep -q 1 && echo "true" || echo "false") -# fi -# if sysctl -n "hw.sensors.acpibat$batid" | grep -q amphour; then -# charge=$(awk -v charge="$charge" -v remaining="$(sysctl -n hw.sensors.acpibat$batid.amphour3 | cut -d' ' -f1)" -v full="$(sysctl -n hw.sensors.acpibat$batid.amphour0 | cut -d' ' -f1)" 'BEGIN { print charge + remaining / full }') -# else -# charge=$(awk -v charge="$charge" -v remaining="$(sysctl -n hw.sensors.acpibat$batid.watthour3 | cut -d' ' -f1)" -v full="$(sysctl -n hw.sensors.acpibat$batid.watthour0 | cut -d' ' -f1)" 'BEGIN { print charge + remaining / full }') -# fi -# count=$((count + 1)) -# done -# ;; -# esac -# charge=$(awk -v charge="$charge" -v count="$count" 'BEGIN { print charge / count }') -# if [ "$charge" -eq 0 ]; then -# tmux set -ug '@battery_status' \;\ -# set -ug '@battery_bar' \;\ -# set -ug '@battery_hbar' \;\ -# set -ug '@battery_vbar' \;\ -# set -ug '@battery_percentage' -# return -# fi -# -# variables=$(tmux show -gqv '@battery_bar_symbol_full' \;\ -# show -gqv '@battery_bar_symbol_empty' \;\ -# show -gqv '@battery_bar_length' \;\ -# show -gqv '@battery_bar_palette' \;\ -# show -gqv '@battery_hbar_palette' \;\ -# show -gqv '@battery_vbar_palette' \;\ -# show -gqv '@battery_status_charging' \;\ -# show -gqv '@battery_status_discharging') -# # shellcheck disable=SC2086 -# { set -f; IFS="$__newline"; set -- $variables; unset IFS; set +f; } -# -# battery_bar_symbol_full=$1 -# battery_bar_symbol_empty=$2 -# battery_bar_length=$3 -# battery_bar_palette=$4 -# battery_hbar_palette=$5 -# battery_vbar_palette=$6 -# battery_status_charging=$7 -# battery_status_discharging=$8 -# -# if [ x"$battery_bar_length" = x"auto" ]; then -# columns=$(tmux -q display -p '#{client_width}' 2> /dev/null || echo 80) -# if [ "$columns" -ge 80 ]; then -# battery_bar_length=10 -# else -# battery_bar_length=5 -# fi -# fi -# -# if [ x"$discharging" = x"true" ]; then -# battery_status="$battery_status_discharging" -# else -# battery_status="$battery_status_charging" -# fi -# -# if echo "$battery_bar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then -# # shellcheck disable=SC2086 -# { set -f; IFS=,; set -- $battery_bar_palette; unset IFS; set +f; } -# palette_style=$1 -# battery_bg=${2:-none} -# [ x"$palette_style" = x"gradient" ] && \ -# palette="196 202 208 214 220 226 190 154 118 82 46" -# [ x"$palette_style" = x"heat" ] && \ -# palette="243 245 247 144 143 142 184 214 208 202 196" -# -# palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }') -# eval set -- "$palette" -# -# full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }") -# battery_bar="#[bg=$battery_bg]" -# # shellcheck disable=SC2046 -# [ "$full" -gt 0 ] && \ -# battery_bar="$battery_bar$(printf "#[fg=colour%s]$battery_bar_symbol_full" $(echo "$palette" | cut -d' ' -f1-"$full"))" -# # shellcheck disable=SC2046 -# empty=$((battery_bar_length - full)) -# # shellcheck disable=SC2046 -# [ "$empty" -gt 0 ] && \ -# battery_bar="$battery_bar$(printf "#[fg=colour%s]$battery_bar_symbol_empty" $(echo "$palette" | cut -d' ' -f$((full + 1))-$((full + empty))))" -# eval battery_bar="$battery_bar#[fg=colour\${$((full == 0 ? 1 : full))}]" -# elif echo "$battery_bar_palette" | grep -q -E '^(([#a-z0-9]{7,9}|none),?){3}$'; then -# # shellcheck disable=SC2086 -# { set -f; IFS=,; set -- $battery_bar_palette; unset IFS; set +f; } -# battery_full_fg=$1 -# battery_empty_fg=$2 -# battery_bg=$3 -# -# full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }") -# [ x"$battery_bg" != x"none" ] && \ -# battery_bar="#[bg=$battery_bg]" -# #shellcheck disable=SC2046 -# [ "$full" -gt 0 ] && \ -# battery_bar="$battery_bar#[fg=$battery_full_fg]$(printf "%0.s$battery_bar_symbol_full" $(seq 1 "$full"))" -# empty=$((battery_bar_length - full)) -# #shellcheck disable=SC2046 -# [ "$empty" -gt 0 ] && \ -# battery_bar="$battery_bar#[fg=$battery_empty_fg]$(printf "%0.s$battery_bar_symbol_empty" $(seq 1 "$empty"))" && \ -# battery_bar="$battery_bar#[fg=$battery_empty_fg]" -# fi -# -# if echo "$battery_hbar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then -# # shellcheck disable=SC2086 -# { set -f; IFS=,; set -- $battery_hbar_palette; unset IFS; set +f; } -# palette_style=$1 -# [ x"$palette_style" = x"gradient" ] && \ -# palette="196 202 208 214 220 226 190 154 118 82 46" -# [ x"$palette_style" = x"heat" ] && \ -# palette="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196" -# -# palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }') -# eval set -- "$palette" -# -# full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }") -# eval battery_hbar_fg="colour\${$((full == 0 ? 1 : full))}" -# elif echo "$battery_hbar_palette" | grep -q -E '^([#a-z0-9]{7,9},?){3}$'; then -# # shellcheck disable=SC2086 -# { set -f; IFS=,; set -- $battery_hbar_palette; unset IFS; set +f; } -# -# # shellcheck disable=SC2046 -# eval $(awk "BEGIN { printf \"battery_hbar_fg=$%d\", (($charge) - 0.001) * $# + 1 }") -# fi -# -# eval set -- "▏ ▎ ▍ ▌ ▋ ▊ ▉ █" -# # shellcheck disable=SC2046 -# eval $(awk "BEGIN { printf \"battery_hbar_symbol=$%d\", ($charge) * ($# - 1) + 1 }") -# battery_hbar="#[fg=${battery_hbar_fg?}]${battery_hbar_symbol?}" -# -# if echo "$battery_vbar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then -# # shellcheck disable=SC2086 -# { set -f; IFS=,; set -- $battery_vbar_palette; unset IFS; set +f; } -# palette_style=$1 -# [ x"$palette_style" = x"gradient" ] && \ -# palette="196 202 208 214 220 226 190 154 118 82 46" -# [ x"$palette_style" = x"heat" ] && \ -# palette="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196" -# -# palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }') -# eval set -- "$palette" -# -# full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }") -# eval battery_vbar_fg="colour\${$((full == 0 ? 1 : full))}" -# elif echo "$battery_vbar_palette" | grep -q -E '^([#a-z0-9]{7,9},?){3}$'; then -# # shellcheck disable=SC2086 -# { set -f; IFS=,; set -- $battery_vbar_palette; unset IFS; set +f; } -# -# # shellcheck disable=SC2046 -# eval $(awk "BEGIN { printf \"battery_vbar_fg=$%d\", (($charge) - 0.001) * $# + 1 }") -# fi -# -# eval set -- "▁ ▂ ▃ ▄ ▅ ▆ ▇ █" -# # shellcheck disable=SC2046 -# eval $(awk "BEGIN { printf \"battery_vbar_symbol=$%d\", ($charge) * ($# - 1) + 1 }") -# battery_vbar="#[fg=${battery_vbar_fg?}]${battery_vbar_symbol?}" -# -# battery_percentage="$(awk "BEGIN { printf \"%.0f%%\", ($charge) * 100 }")" -# -# tmux set -g '@battery_status' "$battery_status" \;\ -# set -g '@battery_bar' "$battery_bar" \;\ -# set -g '@battery_hbar' "$battery_hbar" \;\ -# set -g '@battery_vbar' "$battery_vbar" \;\ -# set -g '@battery_percentage' "$battery_percentage" -# } -# -# _username() { -# tty=${1:-$(tmux display -p '#{pane_tty}')} -# ssh_only=$2 -# # shellcheck disable=SC2039 -# if [ x"$OSTYPE" = x"cygwin" ]; then -# pid=$(ps -a | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { print $1 }') -# [ -n "$pid" ] && ssh_parameters=$(tr '\0' ' ' < "/proc/$pid/cmdline" | sed 's/^ssh //') -# else -# ssh_parameters=$(ps -t "$tty" -o command= | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }') -# fi -# if [ -n "$ssh_parameters" ]; then -# # shellcheck disable=SC2086 -# username=$(ssh -G $ssh_parameters 2>/dev/null | awk 'NR > 2 { exit } ; /^user / { print $2 }') -# # shellcheck disable=SC2086 -# [ -z "$username" ] && username=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" $ssh_parameters 2>&1 | awk '/^%username% / { print $2; exit }') -# else -# if ! _is_enabled "$ssh_only"; then -# # shellcheck disable=SC2039 -# if [ x"$OSTYPE" = x"cygwin" ]; then -# username=$(whoami) -# else -# username=$(ps -t "$tty" -o user= -o pid= -o ppid= -o command= | awk ' -# !/ssh/ { user[$2] = $1; ppid[$3] = 1 } -# END { -# for (i in user) -# if (!(i in ppid)) -# { -# print user[i] -# exit -# } -# } -# ') -# fi -# fi -# fi -# -# echo "$username" -# } -# -# _hostname() { -# tty=${1:-$(tmux display -p '#{pane_tty}')} -# ssh_only=$2 -# # shellcheck disable=SC2039 -# if [ x"$OSTYPE" = x"cygwin" ]; then -# pid=$(ps -a | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { print $1 }') -# [ -n "$pid" ] && ssh_parameters=$(tr '\0' ' ' < "/proc/$pid/cmdline" | sed 's/^ssh //') -# else -# ssh_parameters=$(ps -t "$tty" -o command= | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }') -# fi -# if [ -n "$ssh_parameters" ]; then -# # shellcheck disable=SC2086 -# hostname=$(ssh -G $ssh_parameters 2>/dev/null | awk 'NR > 2 { exit } ; /^hostname / { print $2 }') -# # shellcheck disable=SC2086 -# [ -z "$hostname" ] && hostname=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%hostname%% %h >&2'" $ssh_parameters 2>&1 | awk '/^%hostname% / { print $2; exit }') -# #shellcheck disable=SC1004 -# hostname=$(echo "$hostname" | awk '\ -# { \ -# if ($1~/^[0-9.:]+$/) \ -# print $1; \ -# else \ -# split($1, a, ".") ; print a[1] \ -# }') -# else -# if ! _is_enabled "$ssh_only"; then -# hostname=$(command hostname -s) -# fi -# fi -# -# echo "$hostname" -# } -# -# _root() { -# tty=${1:-$(tmux display -p '#{pane_tty}')} -# username=$(_username "$tty" false) -# -# if [ x"$username" = x"root" ]; then -# tmux show -gqv '@root' -# else -# echo "" -# fi -# } -# -# _uptime() { -# case $(uname -s) in -# *Darwin*) -# boot=$(sysctl -q -n kern.boottime | awk -F'[ ,:]+' '{ print $4 }') -# now=$(date +%s) -# ;; -# *Linux*|*CYGWIN*|*MSYS*|*MINGW*) -# now=$(cut -d' ' -f1 < /proc/uptime) -# ;; -# *OpenBSD*) -# boot=$(sysctl -n kern.boottime) -# now=$(date +%s) -# esac -# # shellcheck disable=SC1004 -# awk -v boot="$boot" -v now="$now" ' -# BEGIN { -# uptime = now - boot -# d = int(uptime / 86400) -# h = int(uptime / 3600) % 24 -# m = int(uptime / 60) % 60 -# s = int(uptime) % 60 -# -# system("tmux set -g @uptime_d " d + 0 " \\; " \ -# "set -g @uptime_h " h + 0 " \\; " \ -# "set -g @uptime_m " m + 0 " \\; " \ -# "set -g @uptime_s " s + 0) -# }' -# } -# -# _loadavg() { -# case $(uname -s) in -# *Darwin*) -# tmux set -g @loadavg "$(sysctl -q -n vm.loadavg | cut -d' ' -f2)" -# ;; -# *Linux*) -# tmux set -g @loadavg "$(cut -d' ' -f1 < /proc/loadavg)" -# ;; -# *OpenBSD*) -# tmux set -g @loadavg "$(sysctl -q -n vm.loadavg | cut -d' ' -f1)" -# ;; -# esac -# } -# -# _split_window() { -# tty=${1:-$(tmux display -p '#{pane_tty}')} -# shift -# # shellcheck disable=SC2039 -# if [ x"$OSTYPE" = x"cygwin" ]; then -# pid=$(ps -a | sort -d | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && !/-W/ { print $1; exit 0 }') -# [ -n "$pid" ] && ssh=$(tr '\0' ' ' < "/proc/$pid/cmdline") -# else -# ssh=$(ps -t "$tty" -o command= | sort -d | awk '/ssh/ && !/-W/ { print $0; exit 0 }') -# fi -# if [ -n "$ssh" ]; then -# # shellcheck disable=SC2046 -# tmux split-window "$@" $(echo "$ssh" | sed -e "s/;/\\\\;/g") -# else -# tmux split-window "$@" -# fi -# } -# -# _apply_overrides() { -# tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-false} -# if _is_enabled "$tmux_conf_theme_24b_colour"; then -# case "$TERM" in -# screen-*|tmux-*) -# ;; -# *) -# tmux set-option -ga terminal-overrides ",*256col*:Tc" -# ;; -# esac -# fi -# } -# -# _apply_bindings() { -# line=$(tmux list-keys | grep new-window | head -1) -# prefix=${line%new-window*} -# column=${#prefix} -# -# tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-false} -# while IFS= read -r line; do -# [ -z "$line" ] && continue -# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g') -# if _is_enabled "$tmux_conf_new_window_retain_current_path"; then -# right=$(printf '%s' "$line" | cut -c"$column-" | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/new-window$/new-window -c "#{pane_current_path}"/g') -# else -# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/-c[ \t]+"#\{pane_current_path\}"$//g') -# fi -# eval "tmux $left $right" 2>/dev/null || true -# done << EOF -# $(tmux list-keys 2>/dev/null | grep -e 'new-window\(\s\+-c\s\+"#{pane_current_path}\|$\)') -# EOF -# -# tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true} -# while IFS= read -r line; do -# [ -z "$line" ] && continue -# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g') -# if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then -# right=$(printf '%s' "$line" | cut -c"$column-" | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/split-window([ \t]+-(h|v))?$/& -c "#{pane_current_path}"/g') -# else -# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/-c[ \t]+"#\{pane_current_path\}"$//g') -# fi -# eval "tmux $left $right" 2>/dev/null || true -# done << EOF -# $(tmux list-keys 2>/dev/null | grep -e 'split\(-\|_\)window') -# EOF -# -# tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false} -# while IFS= read -r line; do -# [ -z "$line" ] && continue -# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g') -# if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then -# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/"/\\"/g' -e 's/split-window([^;]+)/run-shell "cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1"/g') -# else -# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/\\"/"/g' -e 's/run-shell "cut -c3- ~\/\.tmux\.conf \| sh -s _split_window #\{pane_tty\}([^;]+)"/split-window\1/g' -e 's/#\{.+\}/\"&\"/g') -# fi -# eval "tmux $left $right" 2>/dev/null || true -# done << EOF -# $(tmux list-keys 2>/dev/null | grep -e 'split\(-\|_\)window') -# EOF -# -# tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false} -# while IFS= read -r line; do -# [ -z "$line" ] && continue -# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g') -# if _is_enabled "$tmux_conf_new_session_prompt"; then -# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/new-session$/command-prompt -p new-session \"new-session -s '"'"'%%'"'"'\"/g') -# else -# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }'| sed -E -e 's/command-prompt -p new-session[^;]+/new-session/g') -# fi -# eval "tmux $left $right" 2>/dev/null || true -# done << EOF -# $(tmux list-keys 2>/dev/null | grep -e 'new-session') -# EOF -# -# tmux_conf_copy_to_os_clipboard=${tmux_conf_copy_to_os_clipboard:-false} -# command -v pbcopy > /dev/null 2>&1 && command='pbcopy' -# command -v reattach-to-user-namespace > /dev/null 2>&1 && command='reattach-to-user-namespace pbcopy' -# command -v xsel > /dev/null 2>&1 && command='xsel -i -b' -# ! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1 && command='xclip -i -selection clipboard > \/dev\/null 2>\&1' -# command -v clip.exe > /dev/null 2>&1 && command='clip\.exe' -# [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard' -# -# if [ -n "$command" ]; then -# # shellcheck disable=SC2086 -# for table in "" "-t emacs-copy" "-t vi-copy"; do -# line=$(tmux list-keys $table 2>/dev/null | grep -e 'copy-selection\|copy-pipe' | head -1) -# prefix=${line%copy-*} -# column=${#prefix} -# [ -z "$line" ] && continue -# -# while IFS= read -r line; do -# [ -z "$line" ] && continue -# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g') -# if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then -# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e "s/copy-selection(-and-cancel)?$/copy-pipe\1 \"$command\"/g") -# else -# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e "s/copy-pipe(-and-cancel)? \"$command\"$/copy-selection\1/g") -# fi -# eval "tmux $left $right" 2>/dev/null || true -# done << EOF -# $(tmux list-keys $table 2>/dev/null | grep -e 'copy-selection\|copy-pipe') -# EOF -# done -# fi -# } -# -# _apply_theme() { -# -# # -- panes ------------------------------------------------------------- -# -# tmux_conf_theme_window_fg=${tmux_conf_theme_window_fg:-default} -# tmux_conf_theme_window_bg=${tmux_conf_theme_window_bg:-default} -# tmux_conf_theme_highlight_focused_pane=${tmux_conf_theme_highlight_focused_pane:-false} -# tmux_conf_theme_focused_pane_fg=${tmux_conf_theme_focused_pane_fg:-'default'} # default -# tmux_conf_theme_focused_pane_bg=${tmux_conf_theme_focused_pane_bg:-'#0087d7'} # light blue -# -# # tmux 1.9 doesn't really like set -q -# if tmux show -g -w | grep -q window-style; then -# tmux setw -g window-style "fg=$tmux_conf_theme_window_fg,bg=$tmux_conf_theme_window_bg" -# -# if _is_enabled "$tmux_conf_theme_highlight_focused_pane"; then -# tmux setw -g window-active-style "fg=$tmux_conf_theme_focused_pane_fg,bg=$tmux_conf_theme_focused_pane_bg" -# else -# tmux setw -g window-active-style default -# fi -# fi -# -# tmux_conf_theme_pane_border_style=${tmux_conf_theme_pane_border_style:-thin} -# tmux_conf_theme_pane_border=${tmux_conf_theme_pane_border:-'#444444'} # light gray -# tmux_conf_theme_pane_active_border=${tmux_conf_theme_pane_active_border:-'#00afff'} # light blue -# tmux_conf_theme_pane_border_fg=${tmux_conf_theme_pane_border_fg:-$tmux_conf_theme_pane_border} -# tmux_conf_theme_pane_active_border_fg=${tmux_conf_theme_pane_active_border_fg:-$tmux_conf_theme_pane_active_border} -# case "$tmux_conf_theme_pane_border_style" in -# fat) -# tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-$tmux_conf_theme_pane_border_fg} -# tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-$tmux_conf_theme_pane_active_border_fg} -# ;; -# thin|*) -# tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-'default'} -# tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-'default'} -# ;; -# esac -# tmux setw -g pane-border-style "fg=$tmux_conf_theme_pane_border_fg,bg=$tmux_conf_theme_pane_border_bg" \; set -g pane-active-border-style "fg=$tmux_conf_theme_pane_active_border_fg,bg=$tmux_conf_theme_pane_active_border_bg" -# -# tmux_conf_theme_pane_indicator=${tmux_conf_theme_pane_indicator:-'#00afff'} # light blue -# tmux_conf_theme_pane_active_indicator=${tmux_conf_theme_pane_active_indicator:-'#00afff'} # light blue -# -# tmux set -g display-panes-colour "$tmux_conf_theme_pane_indicator" \; set -g display-panes-active-colour "$tmux_conf_theme_pane_active_indicator" -# -# # -- status line ------------------------------------------------------- -# -# tmux_conf_theme_left_separator_main=${tmux_conf_theme_left_separator_main-''} -# tmux_conf_theme_left_separator_sub=${tmux_conf_theme_left_separator_sub-'|'} -# tmux_conf_theme_right_separator_main=${tmux_conf_theme_right_separator_main-''} -# tmux_conf_theme_right_separator_sub=${tmux_conf_theme_right_separator_sub-'|'} -# -# tmux_conf_theme_message_fg=${tmux_conf_theme_message_fg:-'#000000'} # black -# tmux_conf_theme_message_bg=${tmux_conf_theme_message_bg:-'#ffff00'} # yellow -# tmux_conf_theme_message_attr=${tmux_conf_theme_message_attr:-'bold'} -# tmux set -g message-style "fg=$tmux_conf_theme_message_fg,bg=$tmux_conf_theme_message_bg,$tmux_conf_theme_message_attr" -# -# tmux_conf_theme_message_command_fg=${tmux_conf_theme_message_command_fg:-'#ffff00'} # yellow -# tmux_conf_theme_message_command_bg=${tmux_conf_theme_message_command_bg:-'#000000'} # black -# tmux_conf_theme_message_command_attr=${tmux_conf_theme_message_command_attr:-'bold'} -# tmux set -g message-command-style "fg=$tmux_conf_theme_message_command_fg,bg=$tmux_conf_theme_message_command_bg,$tmux_conf_theme_message_command_attr" -# -# tmux_conf_theme_mode_fg=${tmux_conf_theme_mode_fg:-'#000000'} # black -# tmux_conf_theme_mode_bg=${tmux_conf_theme_mode_bg:-'#ffff00'} # yellow -# tmux_conf_theme_mode_attr=${tmux_conf_theme_mode_attr:-'bold'} -# tmux setw -g mode-style "fg=$tmux_conf_theme_mode_fg,bg=$tmux_conf_theme_mode_bg,$tmux_conf_theme_mode_attr" -# -# tmux_conf_theme_status_fg=${tmux_conf_theme_status_fg:-'#8a8a8a'} # white -# tmux_conf_theme_status_bg=${tmux_conf_theme_status_bg:-'#080808'} # dark gray -# tmux_conf_theme_status_attr=${tmux_conf_theme_status_attr:-'none'} -# tmux set -g status-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ -# set -g status-left-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ -# set -g status-right-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" -# -# tmux_conf_theme_terminal_title=${tmux_conf_theme_terminal_title:-'#h ❐ #S ● #I #W'} -# -# tmux_conf_theme_terminal_title=$(echo "$tmux_conf_theme_terminal_title" | sed \ -# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #I)%g' \ -# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g') -# tmux set -g set-titles-string "$tmux_conf_theme_terminal_title" -# -# tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-'#8a8a8a'} # white -# tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-'#080808'} # dark gray -# tmux_conf_theme_window_status_attr=${tmux_conf_theme_window_status_attr:-'none'} -# tmux_conf_theme_window_status_format=${tmux_conf_theme_window_status_format:-'#I #W'} -# -# tmux_conf_theme_window_status_current_fg=${tmux_conf_theme_window_status_current_fg:-'#000000'} # black -# tmux_conf_theme_window_status_current_bg=${tmux_conf_theme_window_status_current_bg:-'#00afff'} # light blue -# tmux_conf_theme_window_status_current_attr=${tmux_conf_theme_window_status_current_attr:-'bold'} -# tmux_conf_theme_window_status_current_format=${tmux_conf_theme_window_status_current_format:-'#I #W'} -# if [ x"$(tmux show -g -v status-justify)" = x"right" ]; then -# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_window_status_bg]$tmux_conf_theme_right_separator_main#[fg=default,bg=default,default] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_right_separator_main" -# else -# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg]$tmux_conf_theme_left_separator_main#[fg=default,bg=default,default] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none]$tmux_conf_theme_left_separator_main" -# fi -# -# tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | sed \ -# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #I)%g' \ -# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g') -# tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed \ -# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #I)%g' \ -# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g') -# -# tmux setw -g window-status-style "fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr" \;\ -# setw -g window-status-format "$tmux_conf_theme_window_status_format" \;\ -# setw -g window-status-current-style "fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr" \;\ -# setw -g window-status-current-format "$tmux_conf_theme_window_status_current_format" -# -# tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-'default'} -# tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-'default'} -# tmux_conf_theme_window_status_activity_attr=${tmux_conf_theme_window_status_activity_attr:-'underscore'} -# tmux setw -g window-status-activity-style "fg=$tmux_conf_theme_window_status_activity_fg,bg=$tmux_conf_theme_window_status_activity_bg,$tmux_conf_theme_window_status_activity_attr" -# -# tmux_conf_theme_window_status_bell_fg=${tmux_conf_theme_window_status_bell_fg:-'#ffff00'} # yellow -# tmux_conf_theme_window_status_bell_bg=${tmux_conf_theme_window_status_bell_bg:-'default'} -# tmux_conf_theme_window_status_bell_attr=${tmux_conf_theme_window_status_bell_attr:-'blink,bold'} -# tmux setw -g window-status-bell-style "fg=$tmux_conf_theme_window_status_bell_fg,bg=$tmux_conf_theme_window_status_bell_bg,$tmux_conf_theme_window_status_bell_attr" -# -# tmux_conf_theme_window_status_last_fg=${tmux_conf_theme_window_status_last_fg:-'#00afff'} # light blue -# tmux_conf_theme_window_status_last_bg=${tmux_conf_theme_window_status_last_bg:-'default'} -# tmux_conf_theme_window_status_last_attr=${tmux_conf_theme_window_status_last_attr:-'none'} -# tmux setw -g window-status-last-style "fg=$tmux_conf_theme_window_status_last_fg,bg=$tmux_conf_theme_window_status_last_bg,$tmux_conf_theme_window_status_last_attr" -# -# # -- indicators -# -# tmux_conf_theme_pairing=${tmux_conf_theme_pairing:-'👓'} # U+1F453 -# tmux_conf_theme_pairing_fg=${tmux_conf_theme_pairing_fg:-'#e4e4e4'} # white -# tmux_conf_theme_pairing_bg=${tmux_conf_theme_pairing_bg:-'none'} -# tmux_conf_theme_pairing_attr=${tmux_conf_theme_pairing_attr:-'none'} -# -# tmux_conf_theme_prefix=${tmux_conf_theme_prefix:-'⌨'} # U+2328 -# tmux_conf_theme_prefix_fg=${tmux_conf_theme_prefix_fg:-'#e4e4e4'} # white -# tmux_conf_theme_prefix_bg=${tmux_conf_theme_prefix_bg:-'none'} -# tmux_conf_theme_prefix_attr=${tmux_conf_theme_prefix_attr:-'none'} -# -# tmux_conf_theme_root=${tmux_conf_theme_root:-'!'} -# tmux_conf_theme_root_fg=${tmux_conf_theme_root_fg:-'none'} -# tmux_conf_theme_root_bg=${tmux_conf_theme_root_bg:-'none'} -# tmux_conf_theme_root_attr=${tmux_conf_theme_root_attr:-'bold,blink'} -# -# tmux_conf_theme_synchronized=${tmux_conf_theme_synchronized:-'🔒'} # U+1F512 -# tmux_conf_theme_synchronized_fg=${tmux_conf_theme_synchronized_fg:-'none'} -# tmux_conf_theme_synchronized_bg=${tmux_conf_theme_synchronized_bg:-'none'} -# tmux_conf_theme_synchronized_attr=${tmux_conf_theme_synchronized_attr:-'none'} -# -# # -- status left style -# -# tmux_conf_theme_status_left=${tmux_conf_theme_status_left-' ❐ #S '} -# tmux_conf_theme_status_left_fg=${tmux_conf_theme_status_left_fg:-'#000000,#e4e4e4,#e4e4e4'} # black, white , white -# tmux_conf_theme_status_left_bg=${tmux_conf_theme_status_left_bg:-'#ffff00,#ff00af,#00afff'} # yellow, pink, white blue -# tmux_conf_theme_status_left_attr=${tmux_conf_theme_status_left_attr:-'bold,none,none'} -# -# tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \ -# -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{?session_many_attached,$tmux_conf_theme_pairing,}/g") -# -# tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \ -# -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix,$tmux_conf_theme_prefix,}/g") -# -# tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} #D)#[inherit]%g") -# -# tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \ -# -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized,}%g") -# -# if [ -n "$tmux_conf_theme_status_left" ]; then -# status_left=$(awk \ -# -v fg_="$tmux_conf_theme_status_left_fg" \ -# -v bg_="$tmux_conf_theme_status_left_bg" \ -# -v attr_="$tmux_conf_theme_status_left_attr" \ -# -v mainsep="$tmux_conf_theme_left_separator_main" \ -# -v subsep="$tmux_conf_theme_left_separator_sub" ' -# function subsplit(s, l, i, a, r) -# { -# l = split(s, a, ",") -# for (i = 1; i <= l; ++i) -# { -# o = split(a[i], _, "(") - 1 -# c = split(a[i], _, ")") - 1 -# open += o - c -# o_ = split(a[i], _, "{") - 1 -# c_ = split(a[i], _, "}") - 1 -# open_ += o_ - c_ -# o__ = split(a[i], _, "[") - 1 -# c__ = split(a[i], _, "]") - 1 -# open__ += o__ - c__ -# -# if (i == l) -# r = sprintf("%s%s", r, a[i]) -# else if (open || open_ || open__) -# r = sprintf("%s%s,", r, a[i]) -# else -# r = sprintf("%s%s#[fg=%s,bg=%s,%s]%s", r, a[i], fg[j], bg[j], attr[j], subsep) -# } -# -# gsub(/#\[inherit\]/, sprintf("#[default]#[fg=%s,bg=%s,%s]", fg[j], bg[j], attr[j]), r) -# return r -# } -# BEGIN { -# FS = "|" -# l1 = split(fg_, fg, ",") -# l2 = split(bg_, bg, ",") -# l3 = split(attr_, attr, ",") -# l = l1 < l2 ? (l1 < l3 ? l1 : l3) : (l2 < l3 ? l2 : l3) -# } -# { -# for (i = j = 1; i <= NF; ++i) -# { -# if (open || open_ || open__) -# printf "|%s", subsplit($i) -# else -# { -# if (i > 1) -# printf "#[fg=%s,bg=%s,none]%s#[fg=%s,bg=%s,%s]%s", bg[j_], bg[j], mainsep, fg[j], bg[j], attr[j], subsplit($i) -# else -# printf "#[fg=%s,bg=%s,%s]%s", fg[j], bg[j], attr[j], subsplit($i) -# } -# -# if (!open && !open_ && !open__) -# { -# j_ = j -# j = j % l + 1 -# } -# } -# printf "#[fg=%s,bg=%s,none]%s", bg[j_], "default", mainsep -# }' << EOF -# $tmux_conf_theme_status_left -# EOF -# ) -# fi -# -# status_left="$status_left " -# -# # -- status right style -# -# tmux_conf_theme_status_right=${tmux_conf_theme_status_right-'#{pairing}#{prefix} #{battery_status} #{battery_bar} #{battery_percentage} , %R , %d %b | #{username} | #{hostname} '} -# tmux_conf_theme_status_right_fg=${tmux_conf_theme_status_right_fg:-'#8a8a8a,#e4e4e4,#000000'} # light gray, white, black -# tmux_conf_theme_status_right_bg=${tmux_conf_theme_status_right_bg:-'#080808,#d70000,#e4e4e4'} # dark gray, red, white -# tmux_conf_theme_status_right_attr=${tmux_conf_theme_status_right_attr:-'none,none,bold'} -# -# tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \ -# -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{?session_many_attached,$tmux_conf_theme_pairing,}/g") -# -# tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \ -# -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix,$tmux_conf_theme_prefix,}/g") -# -# tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} #D)#[inherit]%g") -# -# tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \ -# -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized,}%g") -# -# if [ -n "$tmux_conf_theme_status_right" ]; then -# status_right=$(awk \ -# -v fg_="$tmux_conf_theme_status_right_fg" \ -# -v bg_="$tmux_conf_theme_status_right_bg" \ -# -v attr_="$tmux_conf_theme_status_right_attr" \ -# -v mainsep="$tmux_conf_theme_right_separator_main" \ -# -v subsep="$tmux_conf_theme_right_separator_sub" ' -# function subsplit(s, l, i, a, r) -# { -# l = split(s, a, ",") -# for (i = 1; i <= l; ++i) -# { -# o = split(a[i], _, "(") - 1 -# c = split(a[i], _, ")") - 1 -# open += o - c -# o_ = split(a[i], _, "{") - 1 -# c_ = split(a[i], _, "}") - 1 -# open_ += o_ - c_ -# o__ = split(a[i], _, "[") - 1 -# c__ = split(a[i], _, "]") - 1 -# open__ += o__ - c__ -# -# if (i == l) -# r = sprintf("%s%s", r, a[i]) -# else if (open || open_ || open__) -# r = sprintf("%s%s,", r, a[i]) -# else -# r = sprintf("%s%s#[fg=%s,bg=%s,%s]%s", r, a[i], fg[j], bg[j], attr[j], subsep) -# } -# -# gsub(/#\[inherit\]/, sprintf("#[default]#[fg=%s,bg=%s,%s]", fg[j], bg[j], attr[j]), r) -# return r -# } -# BEGIN { -# FS = "|" -# l1 = split(fg_, fg, ",") -# l2 = split(bg_, bg, ",") -# l3 = split(attr_, attr, ",") -# l = l1 < l2 ? (l1 < l3 ? l1 : l3) : (l2 < l3 ? l2 : l3) -# } -# { -# for (i = j = 1; i <= NF; ++i) -# { -# if (open_ || open || open__) -# printf "|%s", subsplit($i) -# else -# printf "#[fg=%s,bg=%s,none]%s#[fg=%s,bg=%s,%s]%s", bg[j], (i == 1) ? "default" : bg[j_], mainsep, fg[j], bg[j], attr[j], subsplit($i) -# -# if (!open && !open_ && !open__) -# { -# j_ = j -# j = j % l + 1 -# } -# } -# }' << EOF -# $tmux_conf_theme_status_right -# EOF -# ) -# fi -# -# # -- variables -# -# tmux set -g '@root' "$tmux_conf_theme_root" -# -# tmux_conf_battery_bar_symbol_full=${tmux_conf_battery_bar_symbol_full:-'◼'} -# tmux_conf_battery_bar_symbol_empty=${tmux_conf_battery_bar_symbol_empty:-'◻'} -# tmux_conf_battery_bar_length=${tmux_conf_battery_bar_length:-'auto'} -# tmux_conf_battery_bar_palette=${tmux_conf_battery_bar_palette:-'gradient'} -# tmux_conf_battery_hbar_palette=${tmux_conf_battery_hbar_palette:-'gradient'} # red, orange, green -# tmux_conf_battery_vbar_palette=${tmux_conf_battery_vbar_palette:-'gradient'} # red, orange, green -# tmux_conf_battery_status_charging=${tmux_conf_battery_status_charging:-'↑'} # U+2191 -# tmux_conf_battery_status_discharging=${tmux_conf_battery_status_discharging:-'↓'} # U+2193 -# -# case "$status_left $status_right" in -# *'#{battery_status}'*|*'#{battery_bar}'*|*'#{battery_hbar}'*|*'#{battery_vbar}'*|*'#{battery_percentage}'*) -# status_left=$(echo "$status_left" | sed -E \ -# -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \ -# -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \ -# -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \ -# -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \ -# -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g') -# status_right=$(echo "$status_right" | sed -E \ -# -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \ -# -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \ -# -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \ -# -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \ -# -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g') -# -# tmux set -g '@battery_bar_symbol_full' "$tmux_conf_battery_bar_symbol_full" \;\ -# set -g '@battery_bar_symbol_empty' "$tmux_conf_battery_bar_symbol_empty" \;\ -# set -g '@battery_bar_length' "$tmux_conf_battery_bar_length" \;\ -# set -g '@battery_bar_palette' "$tmux_conf_battery_bar_palette" \;\ -# set -g '@battery_hbar_palette' "$tmux_conf_battery_hbar_palette" \;\ -# set -g '@battery_vbar_palette' "$tmux_conf_battery_vbar_palette" \;\ -# set -g '@battery_status_charging' "$tmux_conf_battery_status_charging" \;\ -# set -g '@battery_status_discharging' "$tmux_conf_battery_status_discharging" -# status_right="#(cut -c3- ~/.tmux.conf | sh -s _battery)$status_right" -# ;; -# esac -# -# case "$status_left $status_right" in -# *'#{username}'*|*'#{hostname}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*) -# status_left=$(echo "$status_left" | sed \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g') -# status_right=$(echo "$status_right" | sed \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g') -# ;; -# esac -# -# case "$status_left $status_right" in -# *'#{uptime_d}'*|*'#{uptime_h}'*|*'#{uptime_m}'*) -# status_left=$(echo "$status_left" | sed -E \ -# -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \ -# -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \ -# -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \ -# -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g') -# status_right=$(echo "$status_right" | sed -E \ -# -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \ -# -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \ -# -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \ -# -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g') -# status_right="#(cut -c3- ~/.tmux.conf | sh -s _uptime)$status_right" -# ;; -# esac -# -# case "$status_left $status_right" in -# *'#{loadavg}'*) -# status_left=$(echo "$status_left" | sed -E \ -# -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') -# status_right=$(echo "$status_right" | sed -E \ -# -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') -# status_right="#(cut -c3- ~/.tmux.conf | sh -s _loadavg)$status_right" -# ;; -# esac -# -# status_left=$(echo "$status_left" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g') -# status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g') -# -# tmux set -g status-left-length 1000 \; set -g status-left "$status_left" \;\ -# set -g status-right-length 1000 \; set -g status-right "$status_right" -# -# # -- clock ------------------------------------------------------------- -# -# tmux_conf_theme_clock_colour=${tmux_conf_theme_clock_colour:-'#00afff'} # light blue -# tmux_conf_theme_clock_style=${tmux_conf_theme_clock_style:-'24'} -# tmux setw -g clock-mode-colour "$tmux_conf_theme_clock_colour" \;\ -# setw -g clock-mode-style "$tmux_conf_theme_clock_style" -# } -# -# _apply_configuration() { -# -# # see https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard -# if command -v reattach-to-user-namespace > /dev/null 2>&1; then -# default_shell="$(tmux show -gv default-shell)" -# case "$default_shell" in -# *fish) -# tmux set -g default-command "reattach-to-user-namespace -l $default_shell" -# ;; -# *sh) -# tmux set -g default-command "exec $default_shell... 2> /dev/null & reattach-to-user-namespace -l $default_shell" -# ;; -# esac -# fi -# -# _apply_overrides -# _apply_bindings -# _apply_theme -# for name in $(printenv | grep -Eo '^tmux_conf_[^=]+'); do tmux setenv -gu "$name"; done; -# } -# -# _urlview() { -# tmux capture-pane -J -S - -E - -b "urlview-$1" -t "$1" -# tmux split-window "tmux show-buffer -b urlview-$1 | urlview || true; tmux delete-buffer -b urlview-$1" -# } -# -# _fpp() { -# tmux capture-pane -J -S - -E - -b "fpp-$1" -t "$1" -# tmux split-window "tmux show-buffer -b fpp-$1 | fpp || true; tmux delete-buffer -b fpp-$1" -# } -# -# "$@" diff --git a/tools/tmux/tmux.conf.local b/tools/tmux/tmux.conf.local deleted file mode 100644 index 63f48da..0000000 --- a/tools/tmux/tmux.conf.local +++ /dev/null @@ -1,325 +0,0 @@ -# https://github.com/gpakosz/.tmux -# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license, -# without any warranty. -# Copyright 2012— Gregory Pakosz (@gpakosz). - - -# -- navigation ---------------------------------------------------------------- - -# if you're running tmux within iTerm2 -# - and tmux is 1.9 or 1.9a -# - and iTerm2 is configured to let option key act as +Esc -# - and iTerm2 is configured to send [1;9A -> [1;9D for option + arrow keys -# then uncomment the following line to make Meta + arrow keys mapping work -#set -ga terminal-overrides "*:kUP3=\e[1;9A,*:kDN3=\e[1;9B,*:kRIT3=\e[1;9C,*:kLFT3=\e[1;9D" - - -# -- windows & pane creation --------------------------------------------------- - -# new window retains current path, possible values are: -# - true -# - false (default) -tmux_conf_new_window_retain_current_path=false - -# new pane retains current path, possible values are: -# - true (default) -# - false -tmux_conf_new_pane_retain_current_path=true - -# new pane tries to reconnect ssh sessions (experimental), possible values are: -# - true -# - false (default) -tmux_conf_new_pane_reconnect_ssh=false - -# prompt for session name when creating a new session, possible values are: -# - true -# - false (default) -tmux_conf_new_session_prompt=false - - -# -- display ------------------------------------------------------------------- - -# RGB 24-bit colour support (tmux >= 2.2), possible values are: -# - true -# - false (default) -tmux_conf_theme_24b_colour=false - -# window style -tmux_conf_theme_window_fg='default' -tmux_conf_theme_window_bg='default' - -# highlight focused pane (tmux >= 2.1), possible values are: -# - true -# - false (default) -tmux_conf_theme_highlight_focused_pane=false - -# focused pane colours: -tmux_conf_theme_focused_pane_fg='default' -tmux_conf_theme_focused_pane_bg='#0087d7' # light blue - -# pane border style, possible values are: -# - thin (default) -# - fat -tmux_conf_theme_pane_border_style=thin - -# pane borders colours: -tmux_conf_theme_pane_border='#444444' # gray -tmux_conf_theme_pane_active_border='#00afff' # light blue - -# pane indicator colours -tmux_conf_theme_pane_indicator='#00afff' # light blue -tmux_conf_theme_pane_active_indicator='#00afff' # light blue - -# status line style -tmux_conf_theme_message_fg='#000000' # black -tmux_conf_theme_message_bg='#ffff00' # yellow -tmux_conf_theme_message_attr='bold' - -# status line command style ( : Escape) -tmux_conf_theme_message_command_fg='#ffff00' # yellow -tmux_conf_theme_message_command_bg='#000000' # black -tmux_conf_theme_message_command_attr='bold' - -# window modes style -tmux_conf_theme_mode_fg='#000000' # black -tmux_conf_theme_mode_bg='#ffff00' # yellow -tmux_conf_theme_mode_attr='bold' - -# status line style -tmux_conf_theme_status_fg='#8a8a8a' # light gray -tmux_conf_theme_status_bg='#080808' # dark gray -tmux_conf_theme_status_attr='none' - -# terminal title -# - built-in variables are: -# - #{circled_window_index} -# - #{circled_session_name} -# - #{hostname} -# - #{hostname_ssh} -# - #{username} -# - #{username_ssh} -tmux_conf_theme_terminal_title='❐ #S ● #I #W' - -# window status style -# - built-in variables are: -# - #{circled_window_index} -# - #{circled_session_name} -# - #{hostname} -# - #{hostname_ssh} -# - #{username} -# - #{username_ssh} -tmux_conf_theme_window_status_fg='#8a8a8a' # light gray -tmux_conf_theme_window_status_bg='#080808' # dark gray -tmux_conf_theme_window_status_attr='none' -tmux_conf_theme_window_status_format='#I #W' -#tmux_conf_theme_window_status_format='#{circled_window_index} #W' -#tmux_conf_theme_window_status_format='#I #W#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}' - -# window current status style -# - built-in variables are: -# - #{circled_window_index} -# - #{circled_session_name} -# - #{hostname} -# - #{hostname_ssh} -# - #{username} -# - #{username_ssh} -tmux_conf_theme_window_status_current_fg='#000000' # black -tmux_conf_theme_window_status_current_bg='#00afff' # light blue -tmux_conf_theme_window_status_current_attr='bold' -tmux_conf_theme_window_status_current_format='#I #W' -#tmux_conf_theme_window_status_current_format='#{circled_window_index} #W' -#tmux_conf_theme_window_status_current_format='#I #W#{?window_zoomed_flag,🔍,}' - -# window activity status style -tmux_conf_theme_window_status_activity_fg='default' -tmux_conf_theme_window_status_activity_bg='default' -tmux_conf_theme_window_status_activity_attr='underscore' - -# window bell status style -tmux_conf_theme_window_status_bell_fg='#ffff00' # yellow -tmux_conf_theme_window_status_bell_bg='default' -tmux_conf_theme_window_status_bell_attr='blink,bold' - -# window last status style -tmux_conf_theme_window_status_last_fg='#00afff' # light blue -tmux_conf_theme_window_status_last_bg='default' -tmux_conf_theme_window_status_last_attr='none' - -# status left/right sections separators -#tmux_conf_theme_left_separator_main='' -#tmux_conf_theme_left_separator_sub='|' -#tmux_conf_theme_right_separator_main='' -#tmux_conf_theme_right_separator_sub='|' -tmux_conf_theme_left_separator_main='' # /!\ you don't need to install Powerline -tmux_conf_theme_left_separator_sub='' # you only need fonts patched with -tmux_conf_theme_right_separator_main='' # Powerline symbols or the standalone -tmux_conf_theme_right_separator_sub='' # PowerlineSymbols.otf font - -# status left/right content: -# - separate main sections with '|' -# - separate subsections with ',' -# - built-in variables are: -# - #{battery_bar} -# - #{battery_hbar} -# - #{battery_percentage} -# - #{battery_status} -# - #{battery_vbar} -# - #{circled_session_name} -# - #{hostname_ssh} -# - #{hostname} -# - #{loadavg} -# - #{pairing} -# - #{prefix} -# - #{root} -# - #{synchronized} -# - #{uptime_d} -# - #{uptime_h} -# - #{uptime_m} -# - #{uptime_s} -# - #{username} -# - #{username_ssh} -tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} ' -tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} ' - -# status left style -tmux_conf_theme_status_left_fg='#000000,#e4e4e4,#e4e4e4' # black, white , white -tmux_conf_theme_status_left_bg='#ffff00,#ff00af,#00afff' # yellow, pink, white blue -tmux_conf_theme_status_left_attr='bold,none,none' - -# status right style -tmux_conf_theme_status_right_fg='#8a8a8a,#e4e4e4,#000000' # light gray, white, black -tmux_conf_theme_status_right_bg='#080808,#d70000,#e4e4e4' # dark gray, red, white -tmux_conf_theme_status_right_attr='none,none,bold' - -# pairing indicator -tmux_conf_theme_pairing='👓 ' # U+1F453 -tmux_conf_theme_pairing_fg='none' -tmux_conf_theme_pairing_bg='none' -tmux_conf_theme_pairing_attr='none' - -# prefix indicator -tmux_conf_theme_prefix='⌨ ' # U+2328 -tmux_conf_theme_prefix_fg='none' -tmux_conf_theme_prefix_bg='none' -tmux_conf_theme_prefix_attr='none' - -# root indicator -tmux_conf_theme_root='!' -tmux_conf_theme_root_fg='none' -tmux_conf_theme_root_bg='none' -tmux_conf_theme_root_attr='bold,blink' - -# synchronized indicator -tmux_conf_theme_synchronized='🔒' # U+1F512 -tmux_conf_theme_synchronized_fg='none' -tmux_conf_theme_synchronized_bg='none' -tmux_conf_theme_synchronized_attr='none' - -# battery bar symbols -tmux_conf_battery_bar_symbol_full='◼' -tmux_conf_battery_bar_symbol_empty='◻' -#tmux_conf_battery_bar_symbol_full='♥' -#tmux_conf_battery_bar_symbol_empty='·' - -# battery bar length (in number of symbols), possible values are: -# - auto -# - a number, e.g. 5 -tmux_conf_battery_bar_length='auto' - -# battery bar palette, possible values are: -# - gradient (default) -# - heat -# - 'colour_full_fg,colour_empty_fg,colour_bg' -tmux_conf_battery_bar_palette='gradient' -#tmux_conf_battery_bar_palette='#d70000,#e4e4e4,#000000' # red, white, black - -# battery hbar palette, possible values are: -# - gradient (default) -# - heat -# - 'colour_low,colour_half,colour_full' -tmux_conf_battery_hbar_palette='gradient' -#tmux_conf_battery_hbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green - -# battery vbar palette, possible values are: -# - gradient (default) -# - heat -# - 'colour_low,colour_half,colour_full' -tmux_conf_battery_vbar_palette='gradient' -#tmux_conf_battery_vbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green - -# symbols used to indicate whether battery is charging or discharging -tmux_conf_battery_status_charging='↑' # U+2191 -tmux_conf_battery_status_discharging='↓' # U+2193 -#tmux_conf_battery_status_charging='⚡ ' # U+26A1 -#tmux_conf_battery_status_charging='🔌 ' # U+1F50C -#tmux_conf_battery_status_discharging='🔋 ' # U+1F50B - -# clock style -tmux_conf_theme_clock_colour='#00afff' # light blue -tmux_conf_theme_clock_style='24' - - -# -- clipboard ----------------------------------------------------------------- - -# in copy mode, copying selection also copies to the OS clipboard -# - true -# - false (default) -# on macOS, this requires installing reattach-to-user-namespace, see README.md -# on Linux, this requires xsel or xclip -tmux_conf_copy_to_os_clipboard=false - - -# -- user customizations ------------------------------------------------------- -# this is the place to override or undo settings - -# increase history size -#set -g history-limit 10000 - -# start with mouse mode enabled -#set -g mouse on - -# force Vi mode -# really you should export VISUAL or EDITOR environment variable, see manual -#set -g status-keys vi -#set -g mode-keys vi - -# replace C-b by C-a instead of using both prefixes -# set -gu prefix2 -# unbind C-a -# unbind C-b -# set -g prefix C-a -# bind C-a send-prefix - -# move status line to top -#set -g status-position top - -bind C-b send-prefix -bind | split-window -h -bind - split-window -v -bind h select-pane -L -bind j select-pane -D -bind k select-pane -U -bind l select-pane -R -bind C-h select-window -t :- -bind C-l select-window -t :+ -bind -r H resize-pane -L 5 -bind -r J resize-pane -D 5 -bind -r K resize-pane -U 5 -bind -r L resize-pane -R 5 -set-option -ga terminal-overrides ",xterm-256color:Tc" - -bind P paste-buffer -setw -g mode-keys vi -bind-key -T copy-mode-vi v send-keys -X begin-selection -bind-key -T copy-mode-vi y send-keys -X copy-selection - -# Smart pane switching with awareness of Vim splits. -# See: https://github.com/christoomey/vim-tmux-navigator -is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ - | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" -bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" -bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" -bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" -bind-key -T copy-mode-vi C-h select-pane -L -bind-key -T copy-mode-vi C-k select-pane -U -bind-key -T copy-mode-vi C-\ select-pane -l diff --git a/tools/tmux/ubuntu_init.sh b/tools/tmux/ubuntu_init.sh index 4f9a417..2c0a21f 100755 --- a/tools/tmux/ubuntu_init.sh +++ b/tools/tmux/ubuntu_init.sh @@ -2,3 +2,7 @@ ! which tmux &&\ apt-get install tmux -y + +[ -f ~/.tmux.conf ] || pxy git clone https://github.com/gpakosz/.tmux.git ~/.tmux && \ +ln -s -f ~/.tmux/.tmux.conf ~/.tmux.conf && \ +cp ~/.tmux/.tmux.conf.local ~/.tmux.conf.local diff --git a/tools/zsh/centos_init.sh b/tools/zsh/centos_init.sh deleted file mode 100644 index 8c9430e..0000000 --- a/tools/zsh/centos_init.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash - -#=============================================================================== -# AUTHOR: prozhou -# CREATED: 2018/03/24 18时08分31秒 -#=============================================================================== - -set -o nounset # Treat unset variables as an error -sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" -if [ ! -d "$HOME/.zplug" ];then - curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh - sudo usermod -s /bin/zsh root -fi - -! (grep -F 'LC_ALL' ~/.env &>/dev/null ) && \ -echo 'export LC_ALL=zh_CN.UTF-8' >> "$HOME/.env" && \ -echo 'export LANG=zh_CN.UTF-8' >> "$HOME/.env" && \ -echo "export PATH=\$PATH:$HOME/.composer/vendor/bin" >> "$HOME/.env" - - -! (grep -F 'zsh-syntax-highlighting' ~/.cus_zshrc &>/dev/null ) && \ -cat >> ~/.cus_zshrc </dev/null ) && \ - echo 'if [ -f ~/.cus_zshrc ];then; source ~/.cus_zshrc;fi' >> ~/.zshrc && \ - echo 'zplug install' >> ~/.zshrc - -! (grep -F 'LESS_TERMCAP_mb' ~/.env &>/dev/null ) && \ -cat >> ~/.env </dev/null ) && \ - sed -E -i "s/plugins=\((.*)\)/plugins=\(\1 autojump\)/g" ~/.zshrc - -#auto suggest -! (grep -F 'zsh-autosuggestions' ~/.zshrc &>/dev/null ) && \ - git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" && \ - sed -E -i "s/plugins=\((.*)\)/plugins=\(\1 zsh-autosuggestions\)/g" ~/.zshrc - -#env -! (grep -F '.env' ~/.zshrc &>/dev/null ) && \ - echo 'if [ -f ~/.env ];then; source ~/.env;fi' >> ~/.zshrc - -#themes -! (grep -F 'avit' ~/.zshrc &>/dev/null ) && \ - sed -i 's#ZSH_THEME="robbyrussell"#ZSH_THEME="avit"#g' ~/.zshrc - - -! (grep -F 'history-incremental-search-backward' ~/.cus_zshrc &>/dev/null ) && \ -cat >> ~/.cus_zshrc </dev/null ) && \ -sed -i "/if.*n.*me.*then/i ip=\`ifconfig | grep 'inet ' | grep -v 127.0.0.1 | awk '{print \$2}'\`" ~/.oh-my-zsh/themes/avit.zsh-theme && \ -sed -i '/if.*n.*me.*then/i me="%n@$ip"' ~/.oh-my-zsh/themes/avit.zsh-theme diff --git a/tools/zsh/mac_init.sh b/tools/zsh/mac_init.sh deleted file mode 100755 index 6c4614c..0000000 --- a/tools/zsh/mac_init.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -[ ! -d ~/.oh-my-zsh ] && sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" - -echo $PATH | awk -F ':' '{print $NF}'|grep -q '/usr/local/bin'; [ $? -ne 0 ] && export PATH=$PATH:/usr/local/bin && \ - echo 'export PATH=$PATH:/usr/local/bin' >> ~/.zshrc -#auto suggest -! (grep -F 'zsh-autosuggestions' ~/.zshrc &>/dev/null ) && \ -git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" && \ -gsed -E -i "s/plugins=\((.*)\)/plugins=\(\1 zsh-autosuggestions\)/g" ~/.zshrc -echo 'no' - -[ ! -d "$HOME/.zplug" ] && curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh - -! (grep -F 'zsh-syntax-highlighting' ~/.cus_zshrc &>/dev/null ) && \ -cat >> ~/.cus_zshrc </dev/null ) && \ -gsed -i '1iexport LANGUAGE=en_US.UTF-8' ~/.zshrc &&\ -gsed -i '1iexport LC_ALL=en_US.UTF-8' ~/.zshrc &&\ -gsed -i '1iexport LANG=en_US.UTF-8' ~/.zshrc &&\ -gsed -i '1iexport LC_TYPE=en_US.UTF-8' ~/.zshrc -#zsh plugin -! (grep -F '.cus_zshrc' ~/.zshrc &>/dev/null ) && \ - echo 'if [ -f ~/.cus_zshrc ];then; source ~/.cus_zshrc;fi' >> ~/.zshrc && \ - echo 'zplug install' >> ~/.zshrc -! (grep -F 'bracketed-paste-magic' ~/.zshrc &>/dev/null ) && \ -cat >> ~/.zshrc </dev/null ) && \ - gsed -i 's#ZSH_THEME="robbyrussell"#ZSH_THEME="avit"#g' ~/.zshrc - -! (grep -F 'history-incremental-search-backward' ~/.cus_zshrc &>/dev/null ) && \ -cat >> ~/.cus_zshrc </dev/null ) && \ -gsed -i "/if.*n.*me.*then/i ip=\`ifconfig | grep 'inet ' | grep -v 127.0.0.1 | awk '{print \$2}'\`" ~/.oh-my-zsh/themes/avit.zsh-theme && \ -gsed -i '/if.*n.*me.*then/i me="%n@$ip"' ~/.oh-my-zsh/themes/avit.zsh-theme diff --git a/tools/zsh/ubuntu_init.sh b/tools/zsh/ubuntu_init.sh index a449988..7e58f01 100755 --- a/tools/zsh/ubuntu_init.sh +++ b/tools/zsh/ubuntu_init.sh @@ -8,10 +8,11 @@ if [ -d ~/.oh-my-zsh ];then return fi -sh -c "$(pxy wget --no-check-certificate https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -| sed 's/env zsh -l//g')" + +sh -c "$(pxy curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended if [ ! -d "$HOME/.zplug" ];then - git clone https://github.com/zplug/zplug.git ~/.zplug + pxy git clone https://github.com/zplug/zplug.git ~/.zplug sudo usermod -s /bin/zsh root fi @@ -32,8 +33,11 @@ END #zsh plugin ! (grep -F '.cus_zshrc' ~/.zshrc &>/dev/null ) && \ echo 'if [ -f ~/.cus_zshrc ];then; source ~/.cus_zshrc;fi' >> ~/.zshrc && \ + echo 'if [ -f ~/.env ];then; source ~/.env;fi' >> ~/.zshrc && \ echo 'zplug install' >> ~/.zshrc + +#man highlight ! (grep -F 'LESS_TERMCAP_mb' ~/.env &>/dev/null ) && \ cat >> ~/.env </dev/null ) && \ +cat >> ~/.zshrc < Date: Mon, 19 Apr 2021 07:16:53 +0800 Subject: [PATCH 19/21] lsp --- init.sh | 5 +++-- tools/neovim/init.vim | 7 +++++++ tools/neovim/ubuntu_init.sh | 14 ++++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/init.sh b/init.sh index d46169b..114fd3b 100755 --- a/init.sh +++ b/init.sh @@ -11,8 +11,9 @@ source "./helper/option.sh" ins dep ins neovim -#ins tmux -#ins zsh +ins tmux +ins zsh + # vim: set ts=4 sw=4 tw=0 et : diff --git a/tools/neovim/init.vim b/tools/neovim/init.vim index eb99440..5feb036 100755 --- a/tools/neovim/init.vim +++ b/tools/neovim/init.vim @@ -1,4 +1,6 @@ call plug#begin('~/.local/share/nvim/plugged') +Plug 'honza/vim-snippets' + Plug 'morhetz/gruvbox' Plug 'puremourning/vimspector' "complete Plug 'neoclide/coc.nvim', {'branch': 'release'} @@ -198,3 +200,8 @@ nmap VimspectorContinue nmap VimspectorStepOver nmap VimspectorStepInto nmap VimspectorStepOut + +let g:airline_powerline_fonts = 1 +colorscheme gruvbox +set background=dark +autocmd Filetype json let g:indentLine_enabled = 0 diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index dfa790d..ab5ad64 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -177,8 +177,6 @@ fi export shell=/bin/bash nvim +'PlugInstall --sync' +qall -#language server install -nvim "+CocInstall -sync coc-snippets" +qall if [ "Y$OPT_FE" == "Yyes" ];then nvim "+CocInstall -sync coc-html coc-css coc-tsserver coc-emmet" +qall @@ -211,6 +209,18 @@ if [ "Y$OPT_VIM" == "Yyes" ];then nvim "+CocInstall -sync coc-vimlsp" +qall fi +if [ "Y$OPT_PHP" == "Yyes" ];then + nvim "+CocInstall -sync coc-phpls" +qall +fi + + +if [ "Y$OPT_BASH" == "Yyes" ];then + nvim "+CocInstall -sync coc-sh" +qall +fi + +nvim "+CocInstall -sync coc-snippets" +qall + + ! which ctags >/dev/null && \ git clone https://github.com/universal-ctags/ctags.git &&\ cd ctags && ./autogen.sh && ./configure && make && make install &&\ From 0498d6f11a53508690b409e71a500ee246128345 Mon Sep 17 00:00:00 2001 From: prozhou Date: Thu, 19 Aug 2021 20:29:23 +0800 Subject: [PATCH 20/21] remove sth --- tools/neovim/init.vim | 66 +++++++++++++++++-------------------- tools/neovim/ubuntu_init.sh | 4 --- 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/tools/neovim/init.vim b/tools/neovim/init.vim index 5feb036..c10de6c 100755 --- a/tools/neovim/init.vim +++ b/tools/neovim/init.vim @@ -1,54 +1,48 @@ call plug#begin('~/.local/share/nvim/plugged') -Plug 'honza/vim-snippets' + + Plug 'honza/vim-snippets' + Plug 'morhetz/gruvbox' - Plug 'puremourning/vimspector' + + Plug 'tpope/vim-commentary' + "complete - Plug 'neoclide/coc.nvim', {'branch': 'release'} - "outline + Plug 'neoclide/coc.nvim', {'branch': 'release'} + + Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' } + Plug 'kristijanhusak/defx-icons' + Plug 'kristijanhusak/defx-git' + + " explore + Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } + Plug 'junegunn/fzf.vim' + + Plug 'puremourning/vimspector' + Plug 'majutsushi/tagbar' + + "outline Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' - " explore - if has('nvim') - Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' } - else - Plug 'Shougo/defx.nvim' - Plug 'roxma/nvim-yarp' - Plug 'roxma/vim-hug-neovim-rpc' - endif - Plug 'kristijanhusak/defx-icons' - Plug 'kristijanhusak/defx-git' - Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } - Plug 'junegunn/fzf.vim' + Plug 'vim-scripts/ctags.vim' - Plug 'tpope/vim-commentary' "git Plug 'tpope/vim-fugitive' Plug 'airblade/vim-gitgutter' - " - " - "Plug 'gregsexton/gitv' - " transform + + + Plug 'wellle/targets.vim' + Plug 'jiangmiao/auto-pairs' Plug 'tpope/vim-abolish' Plug 'tpope/vim-surround' Plug 'tpope/vim-repeat' - " num rep - Plug 'glts/vim-magnum' - Plug 'glts/vim-radical' - " mru - Plug 'vim-scripts/mru.vim' - " select - Plug 'terryma/vim-expand-region' - " icon - Plug 'ryanoasis/vim-devicons' - "indent - Plug 'Yggdroot/indentLine' - "undo - Plug 'mbbill/undotree' - Plug 'wellle/targets.vim' - Plug 'jiangmiao/auto-pairs' + + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + + call plug#end() + " our will be the space key let mapleader="," set noswapfile diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index ab5ad64..79b6141 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -186,10 +186,6 @@ if [ "Y$OPT_PHP" == "Yyes" ];then ~/.local/share/nvim/plugged/vimspector/install_gadget.py --force-enable-php fi -if [ "Y$OPT_GO" == "Yyes" ];then - ~/.local/share/nvim/plugged/vimspector/install_gadget.py --enable-go -fi - if [ "Y$OPT_JAVA" == "Yyes" ];then nvim "+CocInstall -sync coc-java" +qall From 1e4cd163f07097b249dc08f405ddf42c69ff2eac Mon Sep 17 00:00:00 2001 From: prozhou Date: Fri, 20 Aug 2021 07:46:31 +0800 Subject: [PATCH 21/21] change leetcode --- tools/neovim/ubuntu_init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/neovim/ubuntu_init.sh b/tools/neovim/ubuntu_init.sh index 79b6141..0d16429 100755 --- a/tools/neovim/ubuntu_init.sh +++ b/tools/neovim/ubuntu_init.sh @@ -11,9 +11,9 @@ function sql_ins(){ function leetcode_ins(){ - ! (grep -F 'zhoupro/leetcode' ~/.config/nvim/init.vim &>/dev/null ) && \ + ! (grep -F 'ianding1/leetcode' ~/.config/nvim/init.vim &>/dev/null ) && \ pip3 install requests beautifulsoup4 && \ - sed -i "/plug#begin/aPlug 'zhoupro/leetcode.vim', { 'do': 'pip3 install -r requirements.txt' }" ~/.config/nvim/init.vim + sed -i "/plug#begin/aPlug 'ianding1/leetcode.vim', { 'do': 'pip3 install -r requirements.txt' }" ~/.config/nvim/init.vim ! ( grep -F "LeetCodeList" ~/.config/nvim/init.vim ) && \ cat >> ~/.config/nvim/init.vim <