From 768bcbd402cbd8b705d5b21423724af43b9ee543 Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Sun, 12 Dec 2021 14:29:06 +0800 Subject: Purge vim-plug --- .vim/.gitignore | 2 - .vim/filetype.vim | 4 ++ .vim/plugin/init.vim | 153 --------------------------------------------------- .vim/plugin/misc.vim | 5 ++ .vim/plugin/nnn.vim | 1 - .vimrc | 9 +-- bin/vim-pack | 46 +++++++++++++++- 7 files changed, 55 insertions(+), 165 deletions(-) delete mode 100644 .vim/plugin/init.vim create mode 100644 .vim/plugin/misc.vim delete mode 100644 .vim/plugin/nnn.vim diff --git a/.vim/.gitignore b/.vim/.gitignore index 61c6b82..e455cfb 100644 --- a/.vim/.gitignore +++ b/.vim/.gitignore @@ -1,5 +1,3 @@ -plugged -autoload .swp .netrwhist pack/vendor diff --git a/.vim/filetype.vim b/.vim/filetype.vim index 82fa01c..c29f97e 100644 --- a/.vim/filetype.vim +++ b/.vim/filetype.vim @@ -4,3 +4,7 @@ augroup filetypedetect autocmd BufRead,BufNewFile /etc/nginx*.conf setfiletype nginx autocmd BufRead,BufNewFile *mutt-* setfiletype mail augroup end + +autocmd FileType html setlocal shiftwidth=2 softtabstop=2 expandtab +autocmd FileType css setlocal shiftwidth=2 softtabstop=2 expandtab +autocmd FileType javascript setlocal shiftwidth=2 softtabstop=2 expandtab diff --git a/.vim/plugin/init.vim b/.vim/plugin/init.vim deleted file mode 100644 index 7a01616..0000000 --- a/.vim/plugin/init.vim +++ /dev/null @@ -1,153 +0,0 @@ -if empty(glob('~/.vim/autoload/plug.vim')) - silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC -endif - -let s:settings = split(expand('~/.vim/plugin/*.vim')) - -function! s:load_settings() - for setting in s:settings - if setting !~ 'init.vim' - exec "source " . setting - endif - endfor -endfunction - -function! BuildYCM(info) - let ycm_install_options=' --clangd-completer' - - if !empty(glob("/usr/bin/go")) || !empty(glob("/usr/local/bin/go")) - let ycm_install_options = ycm_install_options . ' --go-completer' - endif - - exec '!python3 ./install.py' . ycm_install_options -endfunction - -call plug#begin('~/.vim/plugged') - -" General -Plug 'Valloric/YouCompleteMe', { - \ 'do': function('BuildYCM'), - \ } -Plug 'SirVer/ultisnips' -Plug 'honza/vim-snippets' -Plug 'prabirshrestha/vim-lsp' -Plug 'mbbill/undotree' - -Plug 'dense-analysis/ale' -Plug 'junegunn/fzf' -Plug 'junegunn/fzf.vim' -Plug 'tpope/vim-eunuch' -Plug 'tpope/vim-sleuth' " Automatically adjust indent -Plug 'godlygeek/tabular' -Plug 'airblade/vim-rooter' -Plug 'ludovicchabant/vim-gutentags' - -Plug 'vim-airline/vim-airline' -Plug 'vim-airline/vim-airline-themes' - -let g:airline#extensions#tabline#enabled = 1 -Plug 'tpope/vim-fugitive' -Plug 'junegunn/gv.vim' - -Plug 'easymotion/vim-easymotion' - -map (easymotion-prefix) - -Plug 'editorconfig/editorconfig-vim' - -" Language specific -Plug 'habamax/vim-godot', {'for': 'gdscript'} -Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} -Plug 'ledger/vim-ledger', {'for': 'ledger'} - -Plug 'iamcco/markdown-preview.nvim', { - \ 'do': {-> mkdp#util#install()}, - \ 'for': ['markdown', 'vim-plug'] - \ } - -Plug 'mhinz/vim-signify' -Plug 'tpope/vim-unimpaired' -Plug 'voldikss/vim-floaterm' " Use :FloatermNew to open floating terminal - -Plug 'joshdick/onedark.vim' -Plug 'liuchengxu/vista.vim' - -let g:vista_default_executive = 'ctags' - -let g:vista_executive_for = { - \ 'go': 'vim_lsp', - \ } - -Plug 'puremourning/vimspector', { 'on': 'VimspectorContinue' } - -let g:vimspector_install_gadgets = ['debugpy'] - -nmap dc VimspectorContinue -nmap dq VimspectorStop -nmap db VimspectorToggleBreakpoint -nmap dn VimspectorStepOver -nmap ds VimspectorStepInto -nmap df VimspectorStepOut -nmap di VimspectorBalloonEval -xmap di VimspectorBalloonEval - -let s:mapped = {} - -function! s:set_debug_keymaps() abort - if has_key(s:mapped, string(bufnr())) - return - endif - - " nmap c VimspectorContinue - " nmap q VimspectorStop - " nmap b VimspectorToggleBreakpoint - nmap m VimspectorStepOver - " nmap s VimspectorStepInto - " nmap f VimspectorStepOut - " nmap i VimspectorBalloonEval - " xmap i VimspectorBalloonEval - - let s:mapped[string(bufnr())] = {'modifiable': &modifiable} - - setlocal nomodifiable -endfunction - -function! s:unset_debug_keymaps() abort - let original_buf = bufnr() - let hidden = &hidden - - try - set hidden - for bufnr in keys(s:mapped) - try - execute 'noautocmd buffer' bufnr - " silent! nunmap c - " silent! nunmap q - " silent! nunmap b - silent! nunmap m - " silent! nunmap s - " silent! nunmap f - " silent! nunmap i - " silent! xunmap i - - let &l:modifiable = s:mapped[bufnr]['modifiable'] - endtry - endfor - finally - execute 'noautocmd buffer' original_buf - let &hidden = hidden - endtry - - let s:mapped = {} -endfunction - -augroup CustomMappings - au! - autocmd User VimspectorJumpedToFrame call s:set_debug_keymaps() - autocmd User VimspectorDebugEnded call s:unset_debug_keymaps() -augroup end -call plug#end() - -call s:load_settings() diff --git a/.vim/plugin/misc.vim b/.vim/plugin/misc.vim new file mode 100644 index 0000000..f8c5d9d --- /dev/null +++ b/.vim/plugin/misc.vim @@ -0,0 +1,5 @@ +packadd! onedark.vim +silent colorscheme onedark + +let g:airline#extensions#tabline#enabled = 1 +map (easymotion-prefix) diff --git a/.vim/plugin/nnn.vim b/.vim/plugin/nnn.vim deleted file mode 100644 index 071e694..0000000 --- a/.vim/plugin/nnn.vim +++ /dev/null @@ -1 +0,0 @@ -command! NnnPicker packadd nnn.vim | NnnPicker diff --git a/.vimrc b/.vimrc index b15394a..e1138b4 100644 --- a/.vimrc +++ b/.vimrc @@ -8,6 +8,7 @@ set fileencodings=ucs=bom,utf-8,utf-16,gbk,big5,gb18030,latin1 set showcmd set autoread set mouse=a +filetype on filetype indent on set modeline set textwidth=72 @@ -63,10 +64,6 @@ set shiftwidth=4 set expandtab set softtabstop=4 -autocmd FileType html setlocal shiftwidth=2 softtabstop=2 expandtab -autocmd FileType css setlocal shiftwidth=2 softtabstop=2 expandtab -autocmd FileType javascript setlocal shiftwidth=2 softtabstop=2 expandtab - set wrap "set nowrap "set wrapmargin=4 @@ -103,15 +100,13 @@ set tags=./.tags;,.tags let mapleader=',' " change the key nnoremap cd :cd %:p:h :pwd -source ~/.vim/plugin/init.vim source ~/.vim/keybindings.vim source ~/.vim/notes.vim -silent colorscheme onedark - highlight Pmenu ctermbg=grey set exrc if !empty(glob('~/.vim_local')) source ~/.vim_local endif + diff --git a/bin/vim-pack b/bin/vim-pack index 0a6240e..f03cfa0 100755 --- a/bin/vim-pack +++ b/bin/vim-pack @@ -7,19 +7,28 @@ package_dirs=() update_package () { name=$1 remote_url=$2 - load_type=$3 + + load_type='start' + [ $# -ge 3 ] && load_type=$3 package_dir="$HOME/.vim/pack/vendor/$load_type/$name" package_dirs+=($package_dir) if [ ! -d $package_dir ]; then echo "$name : Installing ... " mkdir -p $package_dir + cd $package_dir git clone --depth 1 $remote_url $package_dir && echo "$name : Done" || echo "$name : FAIL" else cd $package_dir echo "$name : Updating ... " git pull && echo "$name : Done" || echo "$name : FAIL" fi + + git submodule update --init --recursive --depth 1 + + if [ $# -ge 4 ]; then + $4 + fi } clean () { @@ -37,6 +46,39 @@ clean () { done } -update_package "nnn.vim" "git@github.com:mcchrish/nnn.vim.git" "opt" +install_ycm () { + opts=' --clangd-completer' + + if [ -f /usr/bin/go -o -f /usr/local/bin/go ]; then + opts="$opts --go-completer" + fi + + python3 ./install.py $opts +} + +update_package 'YouCompleteMe' 'git@github.com:ycm-core/YouCompleteMe.git' 'start' 'install_ycm' +update_package "nnn.vim" "git@github.com:mcchrish/nnn.vim.git" +update_package 'vim-fugitive' 'git@github.com:tpope/vim-fugitive.git' +update_package 'fzf' 'git@github.com:junegunn/fzf.git' +update_package 'fzf.vim' 'git@github.com:junegunn/fzf.vim.git' +update_package 'ultisnips' 'git@github.com:SirVer/ultisnips.git' +update_package 'vim-snippets' 'git@github.com:honza/vim-snippets.git' +update_package 'onedark.vim' 'git@github.com:joshdick/onedark.vim.git' 'opt' +update_package vim-lsp git@github.com:prabirshrestha/vim-lsp.git +update_package undotree git@github.com:mbbill/undotree.git +update_package ale git@github.com:dense-analysis/ale.git +update_package vim-eunuch git@github.com:tpope/vim-eunuch.git +update_package vim-sleuth git@github.com:tpope/vim-sleuth.git +update_package tabular git@github.com:godlygeek/tabular.git +update_package vim-rooter git@github.com:airblade/vim-rooter.git +update_package vim-gutentags git@github.com:ludovicchabant/vim-gutentags.git +update_package vim-airline git@github.com:vim-airline/vim-airline.git +update_package vim-airline-themes git@github.com:vim-airline/vim-airline-themes.git +update_package vim-easymotion git@github.com:easymotion/vim-easymotion.git +update_package editorconfig-vim git@github.com:editorconfig/editorconfig-vim.git +update_package vim-godot git@github.com:habamax/vim-godot.git +update_package vim-ledger git@github.com:ledger/vim-ledger.git +update_package vim-signify git@github.com:mhinz/vim-signify.git +update_package vim-unimpaired git@github.com:tpope/vim-unimpaired.git clean -- cgit v1.2.3