From add52e47f17f615e793ad8e45a346035546f7885 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 29 May 2020 11:42:41 +0800 Subject: [PATCH 01/19] [feature] add i/I key to toggle inversed color --- config/zathura/zathurarc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/zathura/zathurarc b/config/zathura/zathurarc index 53e572e..4c56c8a 100644 --- a/config/zathura/zathurarc +++ b/config/zathura/zathurarc @@ -2,3 +2,5 @@ unmap q set recolor true set recolor-darkcolor "#dcdccc" set recolor-lightcolor "#1f1f1f" +map i set recolor false +map I set recolor true From b1c271c0e4c0aa2453a688f2fb3a7d873debb073 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Tue, 2 Jun 2020 15:55:57 +0800 Subject: [PATCH 02/19] [feature] aarch64 support and bugfix --- ubuntu/install-base.sh | 5 +++-- ubuntu/install-fish.sh | 3 +++ ubuntu/install-sources.sh | 12 ++++++------ ubuntu/install-tmux.sh | 16 ++++++++++------ ubuntu/install-vim.sh | 2 ++ ubuntu/setup.sh | 7 +++++++ ubuntu/sources.aarch64.list | 8 ++++++++ ubuntu/{sources.list => sources.x86_64.list} | 0 8 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 ubuntu/sources.aarch64.list rename ubuntu/{sources.list => sources.x86_64.list} (100%) diff --git a/ubuntu/install-base.sh b/ubuntu/install-base.sh index c3fc17a..1d22c43 100755 --- a/ubuntu/install-base.sh +++ b/ubuntu/install-base.sh @@ -1,5 +1,6 @@ #!/bin/bash +set -e sudo apt update -sudo apt upgrade --fix-missing -sudo apt install build-essential automake pkg-config software-properties-common curl -y +sudo apt upgrade --fix-missing -y -q +sudo apt install build-essential automake pkg-config software-properties-common curl -y -q diff --git a/ubuntu/install-fish.sh b/ubuntu/install-fish.sh index 5375321..9a89a87 100755 --- a/ubuntu/install-fish.sh +++ b/ubuntu/install-fish.sh @@ -1,3 +1,6 @@ +#!/bin/bash + +set -e sudo add-apt-repository ppa:fish-shell/release-3 -y sudo apt update sudo apt install fish -y diff --git a/ubuntu/install-sources.sh b/ubuntu/install-sources.sh index 3c40b89..30235e9 100755 --- a/ubuntu/install-sources.sh +++ b/ubuntu/install-sources.sh @@ -1,13 +1,13 @@ #!/bin/bash +set -e + +DIR=$(dirname "${BASH_SOURCE[0]}") +ARCH=$(lscpu | head -n 1 | awk '{print $2}') if [ ! -e /etc/apt/sources.bak ]; then sudo mv /etc/apt/sources.list /etc/apt/sources.bak CURRENT_CODENAME=$(lsb_release -c | cut -f2) - SOURCE_CODENAME=$(head -n 1 $DIR/sources.list | cut -d' ' -f3) - if [ "$CURRENT_CODENAME" != "$SOURCE_CODENAME" ]; then - sudo bash -c "cat $DIR/sources.list | sed s/$SOURCE_CODENAME/$CURRENT_CODENAME/g > /etc/apt/sources.list" - else - sudo cp $DIR/sources.list /etc/apt/ - fi + SOURCE_CODENAME=$(head -n 1 $DIR/sources.$ARCH.list | cut -d' ' -f3) + sudo bash -c "sed s/$SOURCE_CODENAME/$CURRENT_CODENAME/g $DIR/sources.$ARCH.list > /etc/apt/sources.list" fi diff --git a/ubuntu/install-tmux.sh b/ubuntu/install-tmux.sh index d34215a..8af1d96 100755 --- a/ubuntu/install-tmux.sh +++ b/ubuntu/install-tmux.sh @@ -1,14 +1,18 @@ #!/bin/bash +set -e + sudo apt install libevent-dev libncurses5-dev -y TMUX_VER=3.1b -curl -L https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz -o /tmp/tmux.tar.gz -cd /tmp/ -tar zxvf tmux.tar.gz -cd tmux-$TMUX_VER +#curl -L https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz -o /tmp/tmux.tar.gz +curl -L https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz -o /tmp/tmux.tar.gz +mkdir -p /tmp/tmux +tar zxvf /tmp/tmux.tar.gz -C /tmp/tmux +pushd /tmp/tmux +[ -f autogen.sh ] && sh autogen.sh ./configure && make sudo make install -cd -rm -rf /tmp/tmux-$TMUX_VER +rm -rf /tmp/tmux rm -rf /tmp/tmux.tar.gz +popd diff --git a/ubuntu/install-vim.sh b/ubuntu/install-vim.sh index 916b530..805857b 100755 --- a/ubuntu/install-vim.sh +++ b/ubuntu/install-vim.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + sudo add-apt-repository ppa:jonathonf/vim -y sudo apt update sudo apt install -y vim diff --git a/ubuntu/setup.sh b/ubuntu/setup.sh index b42f40f..f8bf637 100755 --- a/ubuntu/setup.sh +++ b/ubuntu/setup.sh @@ -1,9 +1,16 @@ #!/bin/bash +set -e + DIR=$(dirname "${BASH_SOURCE[0]}") +echo '=================== Replace sources.list ====================' $DIR/install-sources.sh +echo '=================== Installing basic packages ====================' $DIR/install-base.sh +echo '=================== Installing fish shell ====================' $DIR/install-fish.sh +echo '=================== Installing vim ====================' $DIR/install-vim.sh +echo '=================== Installing tmux ====================' $DIR/install-tmux.sh diff --git a/ubuntu/sources.aarch64.list b/ubuntu/sources.aarch64.list new file mode 100644 index 0000000..3b4bd45 --- /dev/null +++ b/ubuntu/sources.aarch64.list @@ -0,0 +1,8 @@ +deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe +deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe +deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe +deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe +deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe +deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe +deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe +deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe diff --git a/ubuntu/sources.list b/ubuntu/sources.x86_64.list similarity index 100% rename from ubuntu/sources.list rename to ubuntu/sources.x86_64.list From 2d4b6fc8191bd47949454623ecc3c3848a1b359f Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Tue, 2 Jun 2020 16:36:31 +0800 Subject: [PATCH 03/19] [bugfix] directory structure --- ubuntu/install-tmux.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ubuntu/install-tmux.sh b/ubuntu/install-tmux.sh index 8af1d96..e576ceb 100755 --- a/ubuntu/install-tmux.sh +++ b/ubuntu/install-tmux.sh @@ -6,13 +6,13 @@ sudo apt install libevent-dev libncurses5-dev -y TMUX_VER=3.1b #curl -L https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz -o /tmp/tmux.tar.gz -curl -L https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz -o /tmp/tmux.tar.gz +[ ! -f /tmp/tmux.tar.gz ] && curl -L https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz -o /tmp/tmux.tar.gz +rm -rf /tmp/tmux mkdir -p /tmp/tmux -tar zxvf /tmp/tmux.tar.gz -C /tmp/tmux +tar zxvf /tmp/tmux.tar.gz -C /tmp/tmux --strip 1 pushd /tmp/tmux [ -f autogen.sh ] && sh autogen.sh ./configure && make sudo make install -rm -rf /tmp/tmux -rm -rf /tmp/tmux.tar.gz popd +rm -rf /tmp/tmux* From e744a4965bc24a14720a6fede86fcb96d12f10de Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Tue, 2 Jun 2020 18:50:31 +0800 Subject: [PATCH 04/19] [feature] support cli mode --- bin/06-config-user.fish | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/bin/06-config-user.fish b/bin/06-config-user.fish index 3644539..a2a47e8 100755 --- a/bin/06-config-user.fish +++ b/bin/06-config-user.fish @@ -40,26 +40,31 @@ function link-dotfile run-cmd "ln -sf $DIR/$argv ~/.$argv" end +set -l argv +argparse 'c/cli-only' -- $argv + + link-dotfolder config link-dotfolder pip link-dotfile tmux.conf link-dotfile vimrc -link-dotfile xinitrc -link-dotfile Xresources -link-dotfile Xmodmap - - # install tpm git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm -# set zathura as default pdf viewer -xdg-mime default org.pwmt.zathura.desktop application/pdf +if [ -n "$_flag_c" ] + link-dotfile xinitrc + link-dotfile Xresources + link-dotfile Xmodmap + # set zathura as default pdf viewer + xdg-mime default org.pwmt.zathura.desktop application/pdf -# setup mpd -mkdir -p ~/.mpd/playlists -systemctl --user enable mpd -systemctl --user start mpd -# install ranger plugin -yay -S ttf-nerd-fonts-symbols -git clone https://github.com/alexanderjeurissen/ranger_devicons ~/.config/ranger/plugins/ranger_devicons + # setup mpd + mkdir -p ~/.mpd/playlists + systemctl --user enable mpd + systemctl --user start mpd + + # install ranger plugin + yay -S ttf-nerd-fonts-symbols + git clone https://github.com/alexanderjeurissen/ranger_devicons ~/.config/ranger/plugins/ranger_devicons +end From e4536935bb84356c1500bb64ffd8f3fd16acd04b Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Wed, 3 Jun 2020 09:52:34 +0800 Subject: [PATCH 05/19] [bugfix] should be using arm64 package for aarch64 --- .gitignore | 1 + config/fish/fish_variables | 36 ---------------------------------- config/fish/functions/nvm.fish | 2 +- 3 files changed, 2 insertions(+), 37 deletions(-) delete mode 100644 config/fish/fish_variables diff --git a/.gitignore b/.gitignore index efaaeb9..93043dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ config/mpv/watch_later/ config/fish/fishd.* +config/fish/fish_variables config/ranger/bookmarks config/ranger/history config/ranger/tagged diff --git a/config/fish/fish_variables b/config/fish/fish_variables deleted file mode 100644 index cc50299..0000000 --- a/config/fish/fish_variables +++ /dev/null @@ -1,36 +0,0 @@ -# This file contains fish universal variable definitions. -# VERSION: 3.0 -SETUVAR __fish_init_2_39_8:\x1d -SETUVAR __fish_init_2_3_0:\x1d -SETUVAR __fish_init_3_x:\x1d -SETUVAR __fish_initialized:3100 -SETUVAR fish_color_autosuggestion:555\x1ebrblack -SETUVAR fish_color_cancel:\x2dr -SETUVAR fish_color_command:005fd7 -SETUVAR fish_color_comment:990000 -SETUVAR fish_color_cwd:green -SETUVAR fish_color_cwd_root:red -SETUVAR fish_color_end:009900 -SETUVAR fish_color_error:ff0000 -SETUVAR fish_color_escape:00a6b2 -SETUVAR fish_color_history_current:\x2d\x2dbold -SETUVAR fish_color_host:normal -SETUVAR fish_color_host_remote:yellow -SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue -SETUVAR fish_color_normal:normal -SETUVAR fish_color_operator:00a6b2 -SETUVAR fish_color_param:00afff -SETUVAR fish_color_quote:999900 -SETUVAR fish_color_redirection:00afff -SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_status:red -SETUVAR fish_color_user:brgreen -SETUVAR fish_color_valid_path:\x2d\x2dunderline -SETUVAR fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell -SETUVAR fish_key_bindings:fish_default_key_bindings -SETUVAR fish_pager_color_completion:\x1d -SETUVAR fish_pager_color_description:B3A06D\x1eyellow -SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline -SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan -SETUVAR fish_user_paths:/home/klesh/\x2econfig/nvm/10\x2e20\x2e1/bin diff --git a/config/fish/functions/nvm.fish b/config/fish/functions/nvm.fish index d0d40d7..0eda488 100644 --- a/config/fish/functions/nvm.fish +++ b/config/fish/functions/nvm.fish @@ -169,7 +169,7 @@ function _nvm_use set arch armv6l case armv7 armv7l set arch armv7l - case armv8 armv8l + case armv8 armv8l aarch64 set arch arm64 case \* set arch x86 From 14a01e960bc7fbcf596e24b302c39e4d31c5b635 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Wed, 3 Jun 2020 11:43:14 +0800 Subject: [PATCH 06/19] [misc] use aliyun mirror instead --- ubuntu/sources.aarch64.list | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/ubuntu/sources.aarch64.list b/ubuntu/sources.aarch64.list index 3b4bd45..a6d71b8 100644 --- a/ubuntu/sources.aarch64.list +++ b/ubuntu/sources.aarch64.list @@ -1,8 +1,16 @@ -deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe -deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe -deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe -deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe -deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe -deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe -deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe -deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe + +deb http://mirrors.aliyun.com/ubuntu-ports/ xenial main +deb-src http://mirrors.aliyun.com/ubuntu-ports/ xenial main + +deb http://mirrors.aliyun.com/ubuntu-ports/ xenial-updates main +deb-src http://mirrors.aliyun.com/ubuntu-ports/ xenial-updates main + +deb http://mirrors.aliyun.com/ubuntu-ports/ xenial universe +deb-src http://mirrors.aliyun.com/ubuntu-ports/ xenial universe +deb http://mirrors.aliyun.com/ubuntu-ports/ xenial-updates universe +deb-src http://mirrors.aliyun.com/ubuntu-ports/ xenial-updates universe + +deb http://mirrors.aliyun.com/ubuntu-ports/ xenial-security main +deb-src http://mirrors.aliyun.com/ubuntu-ports/ xenial-security main +deb http://mirrors.aliyun.com/ubuntu-ports/ xenial-security universe +deb-src http://mirrors.aliyun.com/ubuntu-ports/ xenial-security universe From 5083ac04475a1f30c53cec3a6e40e5281a5cc058 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Wed, 10 Jun 2020 16:21:49 +0800 Subject: [PATCH 07/19] [misc] clean up vimrc --- config/fish/config.fish | 1 + tex.vimrc | 102 +++++++++ vimrc | 456 ++++++++++++---------------------------- 3 files changed, 237 insertions(+), 322 deletions(-) create mode 100644 tex.vimrc diff --git a/config/fish/config.fish b/config/fish/config.fish index f3f0de4..504511d 100644 --- a/config/fish/config.fish +++ b/config/fish/config.fish @@ -25,6 +25,7 @@ end source-file-if-exists /usr/share/autojump/autojump.fish source-file-if-exists /usr/local/share/autojump/autojump.fish append-path-if-exists ~/.local/bin +append-path-if-exists ~/Programs/bin append-path-if-exists ~/.yarn/bin source-file-if-exists ~/.cargo/env append-path-if-exists /usr/local/bin diff --git a/tex.vimrc b/tex.vimrc new file mode 100644 index 0000000..ef37679 --- /dev/null +++ b/tex.vimrc @@ -0,0 +1,102 @@ +function! MathAndLiquid() + "" Define certain regions + " Block math. Look for "$$[anything]$$" + syn region math start=/\$\$/ end=/\$\$/ + " inline math. Look for "$[not $][anything]$" + syn match math_block '\$[^$].\{-}\$' + + " Liquid single line. Look for "{%[anything]%}" + syn match liquid '{%.*%}' + " Liquid multiline. Look for "{%[anything]%}[anything]{%[anything]%}" + syn region highlight_block start='{% highlight .*%}' end='{%.*%}' + " Fenced code blocks, used in GitHub Flavored Markdown (GFM) + syn region highlight_block start='```' end='```' + + "" Actually highlight those regions. + hi link math Statement + hi link liquid Statement + hi link highlight_block Function + hi link math_block Function +endfunction + +" Call everytime we open a Markdown file +"autocmd BufRead,BufNewFile,BufEnter *.md,*.markdown call MathAndLiquid() + +" \vm 2 4\ +" \begin{vmatrix} +" <++> & <++> & <++> & <++> \\ +" <++> & <++> & <++> & <++ > \\ +" \end{vmatrix}<++> +" +function! Tex() + let mark = '\' + let sepr = ' ' + let tags = {'vm': 'vmatrix', 'bm': 'bmatrix', 'mt': 'matrix', 'cs': 'cases', 'ad': 'aligned', 'al': 'align', 'ar': 'array'} + let text = getline('.') + let end = col('.') + let start = strridx(text, mark, end) + if start > -1 + let params = strpart(text, start+1, end - start - 1) + let params = split(params, sepr) + let abbr = params[0] + if strlen(abbr) == 0 || !has_key(tags, abbr) + return + endif + let rc = params[1] + if !(rc>0) + return + endif + if len(params)>2 + let cc = params[2] + if !(cc>0) + return + endif + else + let cc = 1 + end + + let prefix = repeat(' ', start) + + let thecols = [] + let i = 0 + while i < cc + call add(thecols, '<++>') + let i += 1 + endwhile + let columnsText = prefix . ' '. join(thecols, ' & ') . ' \\' + + let lines = [] + let i = 0 + while i < rc + call add(lines, columnsText) + let i += 1 + endwhile + call add(lines, prefix . '\end{' . tags[abbr] . '}<++>') + + let leftPart = strpart(text, 0, start) + let rightPart = strpart(text, end) + if strlen(rightPart) > 0 + call add(lines, prefix . rightPart) + endif + call setline(line('.'), leftPart . '\begin{' . tags[abbr] . '}') + call append(line('.'), lines) + "call append(line('.'), lines) + endif +endfunction + +" autocmd FileType markdown +inoremap :call Tex()a +" Navigating with guides +inoremap /<++>"_c4l +vnoremap /<++>"_c4l +map /<++>"_c4l +nmap NERDCommenterToggle +vmap NERDCommenterTogglegv + +" Markdown setup +autocmd FileType markdown inoremap \cs \begin{cases}\end{cases}<++>F\i +autocmd FileType markdown inoremap \fr \frac{<++>}{<++>}<++>F\i +autocmd FileType markdown inoremap ` `$$`<++>F$i +autocmd FileType markdown inoremap $ $$$$<++>kO +autocmd FileType markdown inoremap \{ \{\}<++>F{a +autocmd FileType markdown vnoremap b c__"__ diff --git a/vimrc b/vimrc index 2417cfd..a28fb4b 100644 --- a/vimrc +++ b/vimrc @@ -37,50 +37,44 @@ else source $VIMRUNTIME/delmenu.vim source $VIMRUNTIME/menu.vim endif -Plug 'terryma/vim-multiple-cursors' -Plug 'jiangmiao/auto-pairs' -"Plug 'scrooloose/syntastic' -"Plug 'w0rp/ale' -Plug 'scrooloose/nerdtree' -Plug 'alvan/vim-closetag' -"Plug 'AndrewRadev/tagalong.vim' -Plug 'tpope/vim-repeat' -Plug 'tpope/vim-fugitive' " git 功能 -Plug 'tpope/vim-surround' -"Plug 'vim-airline/vim-airline' -"Plug 'vim-airline/vim-airline-themes' -Plug 'scrooloose/nerdcommenter' -Plug 'editorconfig/editorconfig-vim' + +" searching and formatting Plug 'mhinz/vim-grepper', { 'on': ['Grepper', '(GrepperOperator)'] } Plug 'ctrlpvim/ctrlp.vim' +Plug 'godlygeek/tabular' " align text by specified pattern :Tabularize / +Plug 'editorconfig/editorconfig-vim' +Plug 'tpope/vim-surround' +Plug 'tpope/vim-repeat' +Plug 'alvan/vim-closetag' +Plug 'jiangmiao/auto-pairs' + +" ide like +Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'mgedmin/coverage-highlight.vim' +"Plug 'klesh/vim-fakeclip' +Plug 'scrooloose/nerdcommenter' +Plug 'tpope/vim-fugitive' " git 功能 +Plug 'scrooloose/nerdtree' + +" color themes +Plug 'morhetz/gruvbox' + +" syntax +Plug 'peitalin/vim-jsx-typescript' +Plug 'pangloss/vim-javascript' Plug 'lunaru/vim-less' Plug 'posva/vim-vue' Plug 'othree/html5.vim' -Plug 'mtscout6/syntastic-local-eslint.vim' -Plug 'pangloss/vim-javascript' -Plug 'klesh/vim-fakeclip' Plug 'dag/vim-fish' -Plug 'digitaltoad/vim-pug' -"Plug 'ludovicchabant/vim-gutentags' -Plug 'godlygeek/tabular' -Plug 'plasticboy/vim-markdown' -Plug 'triglav/vim-visual-increment' -Plug 'jvirtanen/vim-octave' Plug 'vim-python/python-syntax' -Plug 'mgedmin/coverage-highlight.vim' -Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'neoclide/coc-python', {'do': 'yarn install --frozen-lockfile'} -Plug 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile'} -Plug 'morhetz/gruvbox' -Plug 'peitalin/vim-jsx-typescript' +Plug 'plasticboy/vim-markdown' +"Plug 'digitaltoad/vim-pug' + +" statusline +Plug 'liuchengxu/eleline.vim' call plug#end() -" coc configuration, may need to run `yarn` in ~/.vim/coc-python folder -" $ pip install --user python-language-server jedi rope - - - -" Remap keys for gotos +" ==== coc configuration ==== nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) @@ -89,9 +83,6 @@ nmap gr (coc-references) " Highlight symbol under cursor on CursorHold autocmd CursorHold * silent call CocActionAsync('highlight') -" Use K to show documentation in preview window -nnoremap K :call show_documentation() - " Remap for rename current word nmap rn (coc-rename) @@ -99,305 +90,45 @@ nmap rn (coc-rename) xmap f (coc-format-selected) nmap f (coc-format-selected) +" Use K to show documentation in preview window function! s:show_documentation() + " s:f makes function f local, use f() to call it, ! replaces existing + " function quitely if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') else call CocAction('doHover') endif endfunction +nnoremap K :call show_documentation() -" markdown +" ==== markdown configuration ==== let g:vim_markdown_folding_disabled = 1 let g:vim_markdown_math = 1 -" nerdtree + +" ==== nerdtree configuration ==== let NERDTreeDirArrowExpandable = "+" let NERDTreeDirArrowCollapsible = "-" +let NERDTreeIgnore = ['\.pyc$', '__pycache__'] -" python + +" ==== python configuration ==== let g:python_highlight_all = 1 -" airline -let g:airline_theme='bubblegum' -let g:airline_left_sep = '' -let g:airline_right_sep = '' -"let g:airline_left_sep = ' ' -"let g:airline_right_sep = ' ' -let g:airline_symbols#crypt = '🔒' -let g:airline_symbols#linenr = '¶' -let g:airline_symbols#maxlinenr = '☰' -let g:airline_symbols#branch = '' -"let g:airline_symbols#paste = 'ρ' -let g:airline_symbols#paste = 'Þ' -"let g:airline_symbols#paste = '∥' -"let g:airline_symbols#spell = 'Ꞩ' -"let g:airline_symbols#notexists = '∄' -"let g:airline_symbols#whitespace = 'Ξ' -" -"let g:airline_theme='luna' -" CtrlP +" ==== ctrlp configuration ==== let g:ctrlp_user_command = ['.git', 'git ls-files -co --exclude-standard'] -"let g:ctrlp_map = '' -" NERDTree -let NERDTreeIgnore = ['\.pyc$', '__pycache__'] -" syntastic -" let g:syntastic_javascript_checkers = ['eslint'] -"let g:ale_python_pylint_change_directory = 0 -let g:ale_linters = { - \ 'python': ['flake8'] - \} - -" vue-vim -" 解决跳到尾部时语法高亮不正常的问题 +" ==== vue configuration ==== +" syntax highlighting not working correctly occasionally for vue autocmd FileType vue syntax sync fromstart -" 利用现有的插件对语法进行高亮 -"autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html5.javascript.less autocmd BufRead,BufNewFile *.vue setlocal filetype=vue -" vim -set ts=4 -set sw=4 -set listchars=eol:$,tab:->,extends:>,precedes:<,space:., -set list -set nu -set expandtab -set hidden -set autoindent -set confirm -set noundofile -set nobackup -set ruler " 开启游标右下角行、列显示 -set noswapfile " 关闭临时文件 -set hlsearch -set lazyredraw -set noshowmatch -set laststatus=2 -let html_no_rendering=1 -set fillchars=vert:\ ,fold:- -"highlight VertSplit guibg=Orange guifg=Black ctermbg=None ctermfg=033 -hi StatusLine cterm=NONE -" keybindings -" 从系统剪贴板复制/粘贴 -"inoremap "+pa -"nnoremap "+p -"vnoremap "+p -"vnoremap "+y -vmap (fakeclip-y) -inoremap ::wa -nnoremap ::w - -"nnoremap :CtrlP -nnoremap n :NERDTreeToggle -nnoremap g :Grepper -tool git - -nnoremap :noh -nnoremap o :only -nnoremap w -nnoremap q :qall -vnoremap p "_dP -nnoremap e :%s/\s\+$//g -nnoremap s :syntax sync fromstart -nnoremap c ::set cursorcolumn! - -nnoremap h h -nnoremap j j -nnoremap k k -nnoremap l l -nnoremap m :vertical resize +5 -nnoremap , :vertical resize -5 -nnoremap . :resize +5 -nnoremap / :resize -5 -nnoremap d :vs -nnoremap [ :lprev -nnoremap ] :lnext - -vnoremap m c=trim(@") . '=' . trim(system('math ' . shellescape(@"))) - -" 行尾空格高亮 -highlight ExtraWhitespace ctermbg=red guibg=red -au ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red -au Syntax * match ExtraWhitespace /\s\+$/ - -" iterm2 插入模式时backspace不works -set backspace=indent,eol,start - -function! ReadClipboardWsl() - let text = system('powershell.exe -Command Get-Clipboard') - let text = substitute(text, "\r\n", '', 'g') - return text -endfunction - -function! TabNewFromClipboard() - exec ':tabnew ' . ReadClipboardWsl() -endfunction - -function! Jsonpp() - "exec ':%!python -m json.tool' - exec ':%!json_pp' -endfunction - -function! DecodeHtml() - exec ':%s/
/```\r/g'
-  exec ':%s/<\/pre>/\r```/g'
-  exec ':%s/<//g'
-  exec ':%s/&/\&/g'
-endfunction
-
-cnoremap  
-cnoremap  
-cnoremap  
-cnoremap  
-cnoremap  
-cnoremap  
-cnoremap  
-
-inoremap  
-inoremap  
-inoremap  
-inoremap  
-inoremap  
-inoremap  
-inoremap  
-
-noremap  
-noremap  
-noremap  
-noremap  
-noremap  
-noremap  
-
-function! MathAndLiquid()
-  "" Define certain regions
-  " Block math. Look for "$$[anything]$$"
-  syn region math start=/\$\$/ end=/\$\$/
-  " inline math. Look for "$[not $][anything]$"
-  syn match math_block '\$[^$].\{-}\$'
-
-  " Liquid single line. Look for "{%[anything]%}"
-  syn match liquid '{%.*%}'
-  " Liquid multiline. Look for "{%[anything]%}[anything]{%[anything]%}"
-  syn region highlight_block start='{% highlight .*%}' end='{%.*%}'
-  " Fenced code blocks, used in GitHub Flavored Markdown (GFM)
-  syn region highlight_block start='```' end='```'
-
-  "" Actually highlight those regions.
-  hi link math Statement
-  hi link liquid Statement
-  hi link highlight_block Function
-  hi link math_block Function
-endfunction
-
-" Call everytime we open a Markdown file
-"autocmd BufRead,BufNewFile,BufEnter *.md,*.markdown call MathAndLiquid()
-
-" \vm 2 4\
-" \begin{vmatrix}
-" <++> & <++> & <++> & <++> \\
-" <++> & <++> & <++> & <++ > \\
-" \end{vmatrix}<++>
-"
-function! Tex()
-  let mark = '\'
-  let sepr = ' '
-  let tags = {'vm': 'vmatrix', 'bm': 'bmatrix', 'mt': 'matrix', 'cs': 'cases', 'ad': 'aligned', 'al': 'align', 'ar': 'array'}
-  let text = getline('.')
-  let end = col('.')
-  let start = strridx(text, mark, end)
-  if start > -1
-    let params = strpart(text, start+1, end - start - 1)
-    let params = split(params, sepr)
-    let abbr = params[0]
-    if strlen(abbr) == 0 || !has_key(tags, abbr)
-      return
-    endif
-    let rc = params[1]
-    if !(rc>0)
-      return
-    endif
-    if len(params)>2
-      let cc = params[2]
-      if !(cc>0)
-        return
-      endif
-    else
-      let cc = 1
-    end
-
-    let prefix = repeat(' ', start)
-
-    let thecols = []
-    let i = 0
-    while i < cc
-      call add(thecols, '<++>')
-      let i += 1
-    endwhile
-    let columnsText = prefix . '  '. join(thecols, ' & ') . ' \\'
-
-    let lines = []
-    let i = 0
-    while i < rc
-      call add(lines, columnsText)
-      let i += 1
-    endwhile
-    call add(lines, prefix . '\end{' . tags[abbr] . '}<++>')
-
-    let leftPart = strpart(text, 0, start)
-    let rightPart = strpart(text, end)
-    if strlen(rightPart) > 0
-      call add(lines, prefix . rightPart)
-    endif
-    call setline(line('.'), leftPart . '\begin{' . tags[abbr] . '}')
-    call append(line('.'), lines)
-    "call append(line('.'), lines)
-  endif
-endfunction
-
-" autocmd FileType markdown
-inoremap  :call Tex()a
-" Navigating with guides
-inoremap  /<++>"_c4l
-vnoremap  /<++>"_c4l
-map  /<++>"_c4l
-nmap    NERDCommenterToggle
-vmap    NERDCommenterTogglegv
-
-" Markdown setup
-autocmd FileType markdown inoremap \cs \begin{cases}\end{cases}<++>F\i
-autocmd FileType markdown inoremap \fr \frac{<++>}{<++>}<++>F\i
-autocmd FileType markdown inoremap ` `$$`<++>F$i
-autocmd FileType markdown inoremap $ $$$$<++>kO
-autocmd FileType markdown inoremap \{ \{\}<++>F{a
-autocmd FileType markdown vnoremap b c__"__
-autocmd FileType json nnoremap f %!json_pp
-
-function! HTML5()
-  let html = []
-  call setline(1, '')
-  call add(html, '')
-  call add(html, ' ')
-  call add(html, '   ')
-  call add(html, '   <++>')
-  call add(html, ' ')
-  call add(html, ' ')
-  call add(html, ' <++>')
-  call add(html, ' ')
-  call add(html, '')
-  call append(1, html)
-endfunction
-
-color gruvbox
-set background=dark
-highlight Normal ctermbg=None
-
-" closetag
-" dict
+" ==== closetag configuration ====
 " Disables auto-close if not in a "valid" region (based on filetype)
 let g:closetag_regions = {
     \ 'typescript.tsx': 'jsxRegion,tsxRegion',
@@ -405,9 +136,10 @@ let g:closetag_regions = {
     \ }
 let g:closetag_shortcut = '>'
 let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.js,*.vue,*.tsx"
-"
-"let g:tagalong_additional_filetypes = ['typescript.tsx']
 
+
+" ==== nerdcommenter configuration ====
+" fixing vue commenting problem
 fu! NERDCommenter_before()
   if &ft == 'vue'
     let b:isvue = 1
@@ -427,13 +159,93 @@ fu! NERDCommenter_after()
     let b:isvue = 0
   endif
 endfu
-"
-
-"fu! NERDCommenter_before()
-  "setf javascript
-"endfu
 
 
-"fu! NERDCommenter_after()
-  "setf vue
-"endfu
+" ==== general configuration ====
+set ts=4
+set sw=4
+set listchars=eol:$,tab:->,extends:>,precedes:<,space:.,
+set list
+set nu
+set expandtab
+set hidden
+set autoindent
+set confirm
+set noundofile
+set nobackup
+set ruler                                                           " 开启游标右下角行、列显示
+set noswapfile                                                      " 关闭临时文件
+set hlsearch
+set lazyredraw
+set noshowmatch
+set laststatus=2
+let html_no_rendering=1
+set fillchars=vert:\ ,fold:-
+set showcmd
+hi StatusLine cterm=NONE
+
+" 行尾空格高亮
+highlight ExtraWhitespace ctermbg=red guibg=red
+au ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
+au Syntax * match ExtraWhitespace /\s\+$/
+
+" theme
+try
+    color gruvbox
+catch
+    color delek
+endtry
+set background=dark
+highlight Normal ctermbg=None
+
+" ==== keybinding configuration ====
+"vmap  (fakeclip-y)
+inoremap  ::wa
+nnoremap  ::w
+
+vnoremap p "_dP
+nnoremap  :noh
+nnoremap n :NERDTreeToggle
+nnoremap g :Grepper -tool git
+nnoremap o :only
+nnoremap q :qall
+nnoremap e :%s/\s\+$//g
+nnoremap s :syntax sync fromstart
+nnoremap c ::set cursorcolumn!
+autocmd FileType json nnoremap f %!json_pp
+
+"nnoremap m :vertical resize +5
+"nnoremap , :vertical resize -5
+"nnoremap . :resize +5
+"nnoremap / :resize -5
+"nnoremap d :vs
+"nnoremap [ :lprev
+"nnoremap ] :lnext
+"vnoremap  m c=trim(@") . '=' . trim(system('math ' . shellescape(@")))
+
+" iterm2 插入模式时backspace不works
+set backspace=indent,eol,start
+
+
+function! DecodeHtml()
+  exec ':%s/
/```\r/g'
+  exec ':%s/<\/pre>/\r```/g'
+  exec ':%s/<//g'
+  exec ':%s/&/\&/g'
+endfunction
+
+function! HTML5()
+  let html = []
+  call setline(1, '')
+  call add(html, '')
+  call add(html, ' ')
+  call add(html, '   ')
+  call add(html, '   <++>')
+  call add(html, ' ')
+  call add(html, ' ')
+  call add(html, ' <++>')
+  call add(html, ' ')
+  call add(html, '')
+  call append(1, html)
+endfunction

From 110f7595bebe87aa0571d82cfe7a4d6d96ed6b5d Mon Sep 17 00:00:00 2001
From: Klesh Wong 
Date: Wed, 10 Jun 2020 17:16:56 +0800
Subject: [PATCH 08/19] [feature] add emacs / fugitive keybindings

---
 vimrc | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/vimrc b/vimrc
index a28fb4b..963dc35 100644
--- a/vimrc
+++ b/vimrc
@@ -205,13 +205,17 @@ nnoremap  ::w
 
 vnoremap p "_dP
 nnoremap  :noh
-nnoremap n :NERDTreeToggle
-nnoremap g :Grepper -tool git
+nnoremap nt :NERDTreeToggle
+nnoremap fs :Grepper -tool git
 nnoremap o :only
 nnoremap q :qall
 nnoremap e :%s/\s\+$//g
 nnoremap s :syntax sync fromstart
 nnoremap c ::set cursorcolumn!
+nnoremap gs ::Gstatus
+nnoremap gc ::Gcommit
+nnoremap gp ::Gpush
+nnoremap gg ::Gpull
 autocmd FileType json nnoremap f %!json_pp
 
 "nnoremap m :vertical resize +5
@@ -222,6 +226,26 @@ autocmd FileType json nnoremap f %!json_pp
 "nnoremap [ :lprev
 "nnoremap ] :lnext
 "vnoremap  m c=trim(@") . '=' . trim(system('math ' . shellescape(@")))
+cnoremap  
+cnoremap  
+cnoremap  
+cnoremap  
+cnoremap  
+cnoremap  
+cnoremap  
+
+inoremap  
+inoremap  
+inoremap  
+inoremap  
+inoremap  
+inoremap  
+inoremap  
+
+noremap  
+noremap  
+noremap  
+noremap  
 
 " iterm2 插入模式时backspace不works
 set backspace=indent,eol,start

From 3e28b3e210073b382ef4000d713efae9e139ed6a Mon Sep 17 00:00:00 2001
From: Klesh Wong 
Date: Wed, 10 Jun 2020 18:42:45 +0800
Subject: [PATCH 09/19] [misc] add gd for Gitdiff

---
 vimrc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/vimrc b/vimrc
index 963dc35..6c5f093 100644
--- a/vimrc
+++ b/vimrc
@@ -216,6 +216,7 @@ nnoremap gs ::Gstatus
 nnoremap gc ::Gcommit
 nnoremap gp ::Gpush
 nnoremap gg ::Gpull
+nnoremap gd ::Gdiff
 autocmd FileType json nnoremap f %!json_pp
 
 "nnoremap m :vertical resize +5

From d03de306792a51350dc0395842f4e823fd3dd9e3 Mon Sep 17 00:00:00 2001
From: Klesh Wong 
Date: Thu, 11 Jun 2020 01:04:54 +0800
Subject: [PATCH 10/19] [feature] add nvim

---
 .gitignore                    |   3 +
 coc-settings.json             |   3 +
 config/nvim/coc-settings.json |   4 ++
 config/nvim/init.vim          | 105 ++++++++++++++++++++++++++++++++++
 vimrc                         |  27 ++++++---
 5 files changed, 133 insertions(+), 9 deletions(-)
 create mode 100644 coc-settings.json
 create mode 100644 config/nvim/coc-settings.json
 create mode 100644 config/nvim/init.vim

diff --git a/.gitignore b/.gitignore
index 93043dc..07cddbe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,6 @@ config/ranger/history
 config/ranger/tagged
 config/ranger/plugins
 config/Thunar/accels.scm
+config/nvim/autoload
+config/nvim/plugged
+config/nvim/.*
diff --git a/coc-settings.json b/coc-settings.json
new file mode 100644
index 0000000..3a56a22
--- /dev/null
+++ b/coc-settings.json
@@ -0,0 +1,3 @@
+{
+    "npm.binPath": "yarn"
+}
diff --git a/config/nvim/coc-settings.json b/config/nvim/coc-settings.json
new file mode 100644
index 0000000..a28de70
--- /dev/null
+++ b/config/nvim/coc-settings.json
@@ -0,0 +1,4 @@
+{
+    "npm.binPath": "yarn",
+    "python.linting.flake8Enabled": true
+}
diff --git a/config/nvim/init.vim b/config/nvim/init.vim
new file mode 100644
index 0000000..5315707
--- /dev/null
+++ b/config/nvim/init.vim
@@ -0,0 +1,105 @@
+" basic settings
+set ts=4
+set sw=4
+set cc=120
+set expandtab
+set nu
+set hidden
+set list
+set autoindent
+set confirm
+set noundofile
+set nobackup
+set hlsearch
+set noswapfile
+set ignorecase
+filetype plugin indent on
+syntax on
+cnoremap  
+cnoremap  
+cnoremap  
+cnoremap  
+cnoremap  
+cnoremap  
+cnoremap  
+
+inoremap  
+inoremap  
+inoremap  
+inoremap  
+inoremap  
+inoremap  
+inoremap  
+
+noremap  
+noremap  
+noremap  
+noremap  
+
+vnoremap p "_dP
+nnoremap q :qall
+
+
+" trailing spaces
+highlight ExtraWhitespace ctermbg=red guibg=red
+au ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
+au Syntax * match ExtraWhitespace /\s\+$/
+nnoremap es :%s/\s\+$//g
+
+" auto install vim-plug
+let vim_plug_path = expand("~/.config/nvim/autoload/plug.vim")
+let vim_plug_just_installed = 0
+if !filereadable(vim_plug_path)
+    echo "Installing vim-plug..."
+    :exe "!curl -fLo " . vim_plug_path . " --create-dirs https://gitee.com/klesh/vim-plug/raw/master/plug.vim"
+    let vim_plug_just_installed = 1
+    echo "vim-plug installed"
+endif
+
+call plug#begin()
+Plug 'editorconfig/editorconfig-vim'
+Plug 'tpope/vim-surround'
+"Plug 'jiangmiao/auto-pairs'
+Plug 'neoclide/coc.nvim', {'branch': 'release'}
+Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile'}
+Plug 'iamcco/coc-vimlsp', {'do': 'yarn install --frozen-lockfile'}
+Plug 'neoclide/coc-python', {'do': 'yarn install --frozen-lockfile'}
+Plug 'weirongxu/coc-explorer', {'do': 'yarn install --frozen-lockfile'}
+Plug 'liuchengxu/eleline.vim'
+Plug 'tpope/vim-fugitive'                                         " git 功能
+Plug 'scrooloose/nerdcommenter'
+Plug 'ctrlpvim/ctrlp.vim'
+Plug 'mhinz/vim-grepper', { 'on': ['Grepper', '(GrepperOperator)'] }
+call plug#end()
+
+
+" ==== coc configuration ====
+nmap  gd (coc-definition)
+nmap  gy (coc-type-definition)
+nmap  gi (coc-implementation)
+nmap  gr (coc-references)
+
+xmap  fs (coc-format-selected)
+nmap  fs (coc-format-selected)
+nmap  fb (coc-format)
+nmap  sd :call CocAction('doHover')
+nmap  rn (coc-rename)
+nmap  ne (coc-diagnostic-next-error)
+nmap  pe (coc-diagnostic-prev-error)
+nmap  fe :CocCommand explorer --toggle
+nmap  if :CocInfo
+nmap  cl :CocList
+nmap  ol (coc-openlink)
+nnoremap sg :Grepper -tool git
+nnoremap sc :Grepper -tool grep
+
+
+" ==== fugitive configuration ====
+nnoremap gs :Gstatus
+nnoremap gc :Gcommit
+nnoremap gp :Gpush
+nnoremap gg :Gpull
+nnoremap gd :Gdiff
+
+" ==== ctrlp configuration ====
+let g:ctrlp_user_command = ['.git', 'git ls-files -co --exclude-standard']
diff --git a/vimrc b/vimrc
index 6c5f093..484607a 100644
--- a/vimrc
+++ b/vimrc
@@ -50,11 +50,14 @@ Plug 'jiangmiao/auto-pairs'
 
 " ide like
 Plug 'neoclide/coc.nvim', {'branch': 'release'}
-Plug 'mgedmin/coverage-highlight.vim'
-"Plug 'klesh/vim-fakeclip'
+Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile'}
+Plug 'neoclide/coc-python', {'do': 'yarn install --frozen-lockfile'}
+Plug 'weirongxu/coc-explorer', {'do': 'yarn install --frozen-lockfile'}
 Plug 'scrooloose/nerdcommenter'
 Plug 'tpope/vim-fugitive'                                         " git 功能
-Plug 'scrooloose/nerdtree'
+"Plug 'scrooloose/nerdtree'
+"Plug 'mgedmin/coverage-highlight.vim'
+"Plug 'klesh/vim-fakeclip'
 
 " color themes
 Plug 'morhetz/gruvbox'
@@ -66,7 +69,7 @@ Plug 'lunaru/vim-less'
 Plug 'posva/vim-vue'
 Plug 'othree/html5.vim'
 Plug 'dag/vim-fish'
-Plug 'vim-python/python-syntax'
+"Plug 'vim-python/python-syntax'
 Plug 'plasticboy/vim-markdown'
 "Plug 'digitaltoad/vim-pug'
 
@@ -80,15 +83,21 @@ nmap  gy (coc-type-definition)
 nmap  gi (coc-implementation)
 nmap  gr (coc-references)
 
+xmap  fs (coc-format-selected)
+nmap  fs (coc-format-selected)
+nmap  fb (coc-format)
+nmap  rn (coc-rename)
+nmap  ne (coc-diagnostic-next-error)
+nmap  pe (coc-diagnostic-prev-error)
+nmap  fe :CocCommand explorer --toggle
+nmap  if :CocInfo
+nmap  cl :CocList
+nmap  ol (coc-openlink)
+
 " Highlight symbol under cursor on CursorHold
 autocmd CursorHold * silent call CocActionAsync('highlight')
 
-" Remap for rename current word
-nmap rn (coc-rename)
 
-" Remap for format selected region
-xmap f  (coc-format-selected)
-nmap f  (coc-format-selected)
 
 " Use K to show documentation in preview window
 function! s:show_documentation()

From 450ac30a23069920841f3236e982c399851a96ad Mon Sep 17 00:00:00 2001
From: Klesh Wong 
Date: Thu, 11 Jun 2020 11:20:12 +0800
Subject: [PATCH 11/19] [feature] add gruvbox colortheme

---
 config/nvim/coc-settings.json |  3 ++-
 config/nvim/init.vim          | 11 ++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/config/nvim/coc-settings.json b/config/nvim/coc-settings.json
index a28de70..f5abb30 100644
--- a/config/nvim/coc-settings.json
+++ b/config/nvim/coc-settings.json
@@ -1,4 +1,5 @@
 {
     "npm.binPath": "yarn",
-    "python.linting.flake8Enabled": true
+    "python.linting.flake8Enabled": true,
+    "explorer.icon.enableNerdfont": true
 }
diff --git a/config/nvim/init.vim b/config/nvim/init.vim
index 5315707..f2eba55 100644
--- a/config/nvim/init.vim
+++ b/config/nvim/init.vim
@@ -13,6 +13,7 @@ set nobackup
 set hlsearch
 set noswapfile
 set ignorecase
+set fillchars=vert:\ ,fold:-
 filetype plugin indent on
 syntax on
 cnoremap  
@@ -70,6 +71,7 @@ Plug 'tpope/vim-fugitive'                                         " git 功能
 Plug 'scrooloose/nerdcommenter'
 Plug 'ctrlpvim/ctrlp.vim'
 Plug 'mhinz/vim-grepper', { 'on': ['Grepper', '(GrepperOperator)'] }
+Plug 'morhetz/gruvbox'
 call plug#end()
 
 
@@ -82,13 +84,14 @@ nmap  gr (coc-references)
 xmap  fs (coc-format-selected)
 nmap  fs (coc-format-selected)
 nmap  fb (coc-format)
-nmap  sd :call CocAction('doHover')
 nmap  rn (coc-rename)
 nmap  ne (coc-diagnostic-next-error)
 nmap  pe (coc-diagnostic-prev-error)
 nmap  fe :CocCommand explorer --toggle
 nmap  if :CocInfo
 nmap  cl :CocList
+nmap  sd :call CocAction('doHover')
+nmap  ss :call CocAction('showSignatureHelp')
 nmap  ol (coc-openlink)
 nnoremap sg :Grepper -tool git
 nnoremap sc :Grepper -tool grep
@@ -103,3 +106,9 @@ nnoremap gd :Gdiff
 
 " ==== ctrlp configuration ====
 let g:ctrlp_user_command = ['.git', 'git ls-files -co --exclude-standard']
+
+
+" ==== gruvbox configuration ====
+color gruvbox
+set background=dark
+highlight Normal ctermbg=None

From 13dd70352fbfc686d6450cd513e4f33f3ad62363 Mon Sep 17 00:00:00 2001
From: Klesh Wong 
Date: Thu, 11 Jun 2020 11:22:27 +0800
Subject: [PATCH 12/19] [feature] enable autopair

---
 config/nvim/init.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/nvim/init.vim b/config/nvim/init.vim
index f2eba55..0d87c92 100644
--- a/config/nvim/init.vim
+++ b/config/nvim/init.vim
@@ -60,7 +60,7 @@ endif
 call plug#begin()
 Plug 'editorconfig/editorconfig-vim'
 Plug 'tpope/vim-surround'
-"Plug 'jiangmiao/auto-pairs'
+Plug 'jiangmiao/auto-pairs'
 Plug 'neoclide/coc.nvim', {'branch': 'release'}
 Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile'}
 Plug 'iamcco/coc-vimlsp', {'do': 'yarn install --frozen-lockfile'}

From 77c5727537af8f1b25c6653669393a72fe94e8e7 Mon Sep 17 00:00:00 2001
From: Klesh Wong 
Date: Thu, 11 Jun 2020 12:00:49 +0800
Subject: [PATCH 13/19] [feature] replace vim with neovim

---
 bin/02-install-base-pkgs.fish |  2 +-
 ubuntu/install-vim.sh         | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/bin/02-install-base-pkgs.fish b/bin/02-install-base-pkgs.fish
index a8f29a8..84a65b6 100755
--- a/bin/02-install-base-pkgs.fish
+++ b/bin/02-install-base-pkgs.fish
@@ -5,7 +5,7 @@ set DIR (dirname (dirname (readlink -f (status --current-filename))))
 # cli basic tooling
 pacman -S \
   base-devel \
-  vim \
+  neovim \
   tmux bc \
   unzip p7zip \
   openssh \
diff --git a/ubuntu/install-vim.sh b/ubuntu/install-vim.sh
index 805857b..3cf41f7 100755
--- a/ubuntu/install-vim.sh
+++ b/ubuntu/install-vim.sh
@@ -2,6 +2,10 @@
 
 set -e
 
-sudo add-apt-repository ppa:jonathonf/vim -y
-sudo apt update
-sudo apt install -y vim
+#sudo add-apt-repository ppa:jonathonf/vim -y
+#sudo apt update
+#sudo apt install -y vim
+
+sudo add-apt-repository ppa:neovim-ppa/stable -y
+sudo apt-get update
+sudo apt install -y neovim

From baa8727f1fc58acc945b28d3a83521dc881ab464 Mon Sep 17 00:00:00 2001
From: Klesh Wong 
Date: Thu, 11 Jun 2020 14:57:01 +0800
Subject: [PATCH 14/19] [feature] nvim+tmux will crash over ssh on ubuntu

---
 bin/02-install-base-pkgs.fish | 2 +-
 bin/06-config-user.fish       | 6 +++++-
 config/nvim/init.vim          | 9 ++++++++-
 ubuntu/install-vim.sh         | 8 +++-----
 4 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/bin/02-install-base-pkgs.fish b/bin/02-install-base-pkgs.fish
index 84a65b6..55e2c43 100755
--- a/bin/02-install-base-pkgs.fish
+++ b/bin/02-install-base-pkgs.fish
@@ -5,7 +5,7 @@ set DIR (dirname (dirname (readlink -f (status --current-filename))))
 # cli basic tooling
 pacman -S \
   base-devel \
-  neovim \
+  vim neovim \
   tmux bc \
   unzip p7zip \
   openssh \
diff --git a/bin/06-config-user.fish b/bin/06-config-user.fish
index a2a47e8..983bb1a 100755
--- a/bin/06-config-user.fish
+++ b/bin/06-config-user.fish
@@ -47,7 +47,11 @@ argparse 'c/cli-only' -- $argv
 link-dotfolder config
 link-dotfolder pip
 link-dotfile tmux.conf
-link-dotfile vimrc
+#link-dotfile vimrc
+rm -rf ~/.vimrc ~/.vim/coc-settings.json
+ln -s $DIR/config/nvim/init.vim ~/.vimrc
+mkdir -p ~/.vim
+ln -s $DIR/config/nvim/coc-settings.json ~/.vim/coc-settings.json
 # install tpm
 git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
 
diff --git a/config/nvim/init.vim b/config/nvim/init.vim
index 0d87c92..ab8074a 100644
--- a/config/nvim/init.vim
+++ b/config/nvim/init.vim
@@ -13,6 +13,7 @@ set nobackup
 set hlsearch
 set noswapfile
 set ignorecase
+set laststatus=2
 set fillchars=vert:\ ,fold:-
 filetype plugin indent on
 syntax on
@@ -40,6 +41,8 @@ noremap  
 vnoremap p "_dP
 nnoremap q :qall
 
+nnoremap 1 :b1
+
 
 " trailing spaces
 highlight ExtraWhitespace ctermbg=red guibg=red
@@ -48,7 +51,11 @@ au Syntax * match ExtraWhitespace /\s\+$/
 nnoremap es :%s/\s\+$//g
 
 " auto install vim-plug
-let vim_plug_path = expand("~/.config/nvim/autoload/plug.vim")
+if has('nvim')
+    let vim_plug_path = expand("~/.config/nvim/autoload/plug.vim")
+else
+    let vim_plug_path = expand("~/.vim/autoload/plug.vim")
+endif
 let vim_plug_just_installed = 0
 if !filereadable(vim_plug_path)
     echo "Installing vim-plug..."
diff --git a/ubuntu/install-vim.sh b/ubuntu/install-vim.sh
index 3cf41f7..e891025 100755
--- a/ubuntu/install-vim.sh
+++ b/ubuntu/install-vim.sh
@@ -2,10 +2,8 @@
 
 set -e
 
-#sudo add-apt-repository ppa:jonathonf/vim -y
-#sudo apt update
-#sudo apt install -y vim
-
+sudo add-apt-repository ppa:jonathonf/vim -y
 sudo add-apt-repository ppa:neovim-ppa/stable -y
-sudo apt-get update
+#sudo apt update
+sudo apt install -y vim
 sudo apt install -y neovim

From ddf19b87f553f7eb7ebc3a27ad6b1ad207b1305b Mon Sep 17 00:00:00 2001
From: Klesh Wong 
Date: Wed, 17 Jun 2020 11:13:26 +0800
Subject: [PATCH 15/19] [misc] ...

---
 config/nvim/coc-settings.json | 3 ++-
 config/nvim/init.vim          | 5 ++++-
 tmux.conf                     | 3 ++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/config/nvim/coc-settings.json b/config/nvim/coc-settings.json
index f5abb30..46c7926 100644
--- a/config/nvim/coc-settings.json
+++ b/config/nvim/coc-settings.json
@@ -1,5 +1,6 @@
 {
     "npm.binPath": "yarn",
     "python.linting.flake8Enabled": true,
-    "explorer.icon.enableNerdfont": true
+    "explorer.icon.enableNerdfont": true,
+    "explorer.width": 30
 }
diff --git a/config/nvim/init.vim b/config/nvim/init.vim
index ab8074a..6b362a7 100644
--- a/config/nvim/init.vim
+++ b/config/nvim/init.vim
@@ -15,8 +15,11 @@ set noswapfile
 set ignorecase
 set laststatus=2
 set fillchars=vert:\ ,fold:-
+set clipboard+=unnamedplus
 filetype plugin indent on
 syntax on
+au! BufWritePost $MYVIMRC source %
+
 cnoremap  
 cnoremap  
 cnoremap  
@@ -98,7 +101,7 @@ nmap  fe :CocCommand explorer --toggle
 nmap  if :CocInfo
 nmap  cl :CocList
 nmap  sd :call CocAction('doHover')
-nmap  ss :call CocAction('showSignatureHelp')
+nmap  ss :syntax sync fromstart
 nmap  ol (coc-openlink)
 nnoremap sg :Grepper -tool git
 nnoremap sc :Grepper -tool grep
diff --git a/tmux.conf b/tmux.conf
index b4671bf..ca70a2c 100644
--- a/tmux.conf
+++ b/tmux.conf
@@ -1,6 +1,7 @@
 ############################
 # general
 ############################
+set -g set-clipboard on
 set -g default-terminal "xterm-256color"
 set -s escape-time 0
 set -g base-index 1
@@ -65,7 +66,7 @@ set -g @yank_action 'copy-pipe'
 # tmux source ~/.tmux.conf
 # prefix + I
 # plugins dir: ~/.tmux/plugins/
-set -g @plugin 'tmux-plugins/tmux-yank'
+#set -g @plugin 'tmux-plugins/tmux-yank'
 set -g @plugin 'kristijanhusak/tmux-simple-git-status'
 set -g @plugin 'klesh/tmux-open'
 set -g @plugin 'tmux-plugins/tmux-copycat'

From aa6135e5dc2723ef44b403972e621344a20fa1e6 Mon Sep 17 00:00:00 2001
From: Klesh Wong 
Date: Wed, 17 Jun 2020 11:16:17 +0800
Subject: [PATCH 16/19] [misc] ...

---
 tmux.conf | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tmux.conf b/tmux.conf
index ca70a2c..bc9426e 100644
--- a/tmux.conf
+++ b/tmux.conf
@@ -56,6 +56,7 @@ bind m \
 bind M \
     set-option -g mouse off \;\
     display 'Mouse: OFF'
+bind -t vi-copy y copy-pipe "xclip -sel clip -i"
 
 ############################
 # plugins

From c1d98d3a73e92169d4ca5420eb37e24c0436dbde Mon Sep 17 00:00:00 2001
From: Klesh Wong 
Date: Wed, 17 Jun 2020 12:16:05 +0800
Subject: [PATCH 17/19] [misc] ...

---
 config/nvim/init.vim | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/config/nvim/init.vim b/config/nvim/init.vim
index 6b362a7..ce6368a 100644
--- a/config/nvim/init.vim
+++ b/config/nvim/init.vim
@@ -10,9 +10,15 @@ set autoindent
 set confirm
 set noundofile
 set nobackup
+set nowritebackup
 set hlsearch
 set noswapfile
 set ignorecase
+set smarttab
+set smartindent
+set cursorline
+set incsearch
+set signcolumn=yes
 set laststatus=2
 set fillchars=vert:\ ,fold:-
 set clipboard+=unnamedplus

From 09c60621f6e89e0394295d2eb58bf543b6e3f656 Mon Sep 17 00:00:00 2001
From: Klesh Wong 
Date: Sat, 20 Jun 2020 10:32:33 +0800
Subject: [PATCH 18/19] ...

---
 config/nvim/coc-settings.json |  1 +
 config/nvim/init.vim          | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/config/nvim/coc-settings.json b/config/nvim/coc-settings.json
index 46c7926..48e1fa0 100644
--- a/config/nvim/coc-settings.json
+++ b/config/nvim/coc-settings.json
@@ -1,5 +1,6 @@
 {
     "npm.binPath": "yarn",
+    "python.linting.enable": true,
     "python.linting.flake8Enabled": true,
     "explorer.icon.enableNerdfont": true,
     "explorer.width": 30
diff --git a/config/nvim/init.vim b/config/nvim/init.vim
index ce6368a..a6772bd 100644
--- a/config/nvim/init.vim
+++ b/config/nvim/init.vim
@@ -50,7 +50,15 @@ noremap  
 vnoremap p "_dP
 nnoremap q :qall
 
-nnoremap 1 :b1
+nnoremap 1 :b1
+nnoremap 2 :b2
+nnoremap 3 :b3
+nnoremap 4 :b4
+nnoremap 5 :b5
+nnoremap w :w
+nnoremap  :noh
+
+inoremap  
 
 
 " trailing spaces

From 7e3de7d552606635778587c8a71cc06158672850 Mon Sep 17 00:00:00 2001
From: Klesh Wong 
Date: Sat, 20 Jun 2020 10:37:10 +0800
Subject: [PATCH 19/19] ..

---
 tmux.conf | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tmux.conf b/tmux.conf
index bc9426e..ca70a2c 100644
--- a/tmux.conf
+++ b/tmux.conf
@@ -56,7 +56,6 @@ bind m \
 bind M \
     set-option -g mouse off \;\
     display 'Mouse: OFF'
-bind -t vi-copy y copy-pipe "xclip -sel clip -i"
 
 ############################
 # plugins