change plugin manager from vundle to vim-plug
This commit is contained in:
@@ -99,7 +99,7 @@
|
|||||||
|
|
||||||
" Vim UI {
|
" Vim UI {
|
||||||
|
|
||||||
if filereadable(expand("~/.vim/bundle/vim-colors-solarized/colors/solarized.vim"))
|
if filereadable(expand("~/.vim/plugged/vim-colors-solarized/colors/solarized.vim"))
|
||||||
let g:solarized_termcolors=256
|
let g:solarized_termcolors=256
|
||||||
let g:solarized_termtrans=1
|
let g:solarized_termtrans=1
|
||||||
let g:solarized_contrast="normal"
|
let g:solarized_contrast="normal"
|
||||||
@@ -268,71 +268,17 @@
|
|||||||
|
|
||||||
" Plugins {
|
" Plugins {
|
||||||
|
|
||||||
" Misc {
|
|
||||||
if isdirectory(expand("~/.vim/bundle/nerdtree"))
|
|
||||||
let g:NERDShutUp=1
|
|
||||||
endif
|
|
||||||
if isdirectory(expand("~/.vim/bundle/matchit.zip"))
|
|
||||||
let b:match_ignorecase = 1
|
|
||||||
endif
|
|
||||||
" }
|
|
||||||
|
|
||||||
" AutoCloseTag {
|
" AutoCloseTag {
|
||||||
" Make it so AutoCloseTag works for xml and xhtml files as well
|
" Make it so AutoCloseTag works for xml and xhtml files as well
|
||||||
au FileType xhtml,xml ru ftplugin/html/autoclosetag.vim
|
au FileType xhtml,xml ru ftplugin/html/autoclosetag.vim
|
||||||
nmap <Leader>ac <Plug>ToggleAutoCloseMappings
|
nmap <Leader>ac <Plug>ToggleAutoCloseMappings
|
||||||
" }
|
" }
|
||||||
|
|
||||||
" NerdTree {
|
|
||||||
if isdirectory(expand("~/.vim/bundle/nerdtree"))
|
|
||||||
nnoremap <C-e> :NERDTreeToggle<CR>
|
|
||||||
" map <leader>e :NERDTreeFind<CR>
|
|
||||||
nmap <leader>nt :NERDTreeFind<CR>
|
|
||||||
|
|
||||||
let NERDTreeShowBookmarks=1
|
|
||||||
let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
|
|
||||||
let NERDTreeChDirMode=0
|
|
||||||
let NERDTreeQuitOnOpen=1
|
|
||||||
let NERDTreeMouseMode=2
|
|
||||||
let NERDTreeShowHidden=1
|
|
||||||
let NERDTreeKeepTreeInNewTab=1
|
|
||||||
endif
|
|
||||||
" }
|
|
||||||
" JSON {
|
" JSON {
|
||||||
nmap <leader>jt <Esc>:%!python -m json.tool<CR><Esc>:set filetype=json<CR>
|
nmap <leader>jt <Esc>:%!python -m json.tool<CR><Esc>:set filetype=json<CR>
|
||||||
let g:vim_json_syntax_conceal = 0
|
let g:vim_json_syntax_conceal = 0
|
||||||
" }
|
" }
|
||||||
|
|
||||||
" indent_guides {
|
|
||||||
if isdirectory(expand("~/.vim/bundle/vim-indent-guides/"))
|
|
||||||
let g:indent_guides_start_level = 2
|
|
||||||
let g:indent_guides_guide_size = 1
|
|
||||||
let g:indent_guides_enable_on_vim_startup = 0
|
|
||||||
map <leader>f :IndentGuidesToggle<CR>
|
|
||||||
|
|
||||||
endif
|
|
||||||
" }
|
|
||||||
" vim-airline {
|
|
||||||
" Set configuration options for the statusline plugin vim-airline.
|
|
||||||
" Use the powerline theme and optionally enable powerline symbols.
|
|
||||||
" To use the symbols , , , , , , and .in the statusline
|
|
||||||
" segments add the following to your .vimrc.before.local file:
|
|
||||||
" let g:airline_powerline_fonts=1
|
|
||||||
" If the previous symbols do not render for you then install a
|
|
||||||
" powerline enabled font.
|
|
||||||
|
|
||||||
" See `:echo g:airline_theme_map` for some more choices
|
|
||||||
" Default in terminal vim is 'dark'
|
|
||||||
let g:airline_section_z = ''
|
|
||||||
let g:airline_section_y = ''
|
|
||||||
|
|
||||||
if isdirectory(expand("~/.vim/bundle/vim-airline-themes/"))
|
|
||||||
if !exists('g:airline_theme')
|
|
||||||
let g:airline_theme = 'solarized'
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" }
|
|
||||||
|
|
||||||
" }
|
" }
|
||||||
|
|
||||||
@@ -478,7 +424,7 @@
|
|||||||
" space-d jump to definition if coc is installed
|
" space-d jump to definition if coc is installed
|
||||||
"nnoremap <silent><nowait> <space>d :call CocAction('jumpDefinition', v: false)<CR>
|
"nnoremap <silent><nowait> <space>d :call CocAction('jumpDefinition', v: false)<CR>
|
||||||
"nnoremap <silent><nowait> <space>r :call CocAction('jumpReferences', v: false)<CR>
|
"nnoremap <silent><nowait> <space>r :call CocAction('jumpReferences', v: false)<CR>
|
||||||
if filereadable(expand("~/.vim-config/.exp-coc-config"))
|
if filereadable(expand("~/.dotfile/.exp-coc-config"))
|
||||||
source ~/.vim-config/.exp-coc-config
|
source ~/.vim-config/.exp-coc-config
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
+100
-115
@@ -1,136 +1,121 @@
|
|||||||
" Modeline and Notes {
|
|
||||||
" vim: set sw=4 ts=4 sts=4 et tw=78 foldmarker={,} foldlevel=0 foldmethod=marker spell:
|
|
||||||
"
|
|
||||||
" This file imports the various plugins of spf13.
|
|
||||||
" }
|
|
||||||
|
|
||||||
" Environment {
|
" Environment {
|
||||||
|
|
||||||
" Basics {
|
" Basics {
|
||||||
set nocompatible " Must be first line
|
set nocompatible " Must be first line
|
||||||
set background=dark " Assume a dark background
|
|
||||||
" }
|
" }
|
||||||
|
|
||||||
" Setup Bundle Support {
|
|
||||||
" The next three lines ensure that the ~/.vim/bundle/ system works
|
|
||||||
filetype off
|
|
||||||
set rtp+=~/.vim/bundle/vundle
|
|
||||||
call vundle#rc()
|
|
||||||
" }
|
|
||||||
|
|
||||||
" Add an UnBundle command {
|
|
||||||
function! UnBundle(arg, ...)
|
|
||||||
let bundle = vundle#config#init_bundle(a:arg, a:000)
|
|
||||||
call filter(g:vundle#bundles, 'v:val["name_spec"] != "' . a:arg . '"')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
com! -nargs=+ UnBundle
|
|
||||||
\ call UnBundle(<args>)
|
|
||||||
" }
|
|
||||||
|
|
||||||
" }
|
" }
|
||||||
|
|
||||||
" Bundles {
|
|
||||||
|
|
||||||
" Deps {
|
" Deps {
|
||||||
Bundle 'gmarik/vundle'
|
"Plug 'MarcWeber/vim-addon-mw-utils'
|
||||||
Bundle 'MarcWeber/vim-addon-mw-utils'
|
"Plug 'tomtom/tlib_vim'
|
||||||
Bundle 'tomtom/tlib_vim'
|
|
||||||
if executable('ag')
|
|
||||||
Bundle 'mileszs/ack.vim'
|
|
||||||
let g:ackprg = 'ag --nogroup --nocolor --column --smart-case'
|
|
||||||
elseif executable('ack-grep')
|
|
||||||
let g:ackprg="ack-grep -H --nocolor --nogroup --column"
|
|
||||||
Bundle 'mileszs/ack.vim'
|
|
||||||
elseif executable('ack')
|
|
||||||
Bundle 'mileszs/ack.vim'
|
|
||||||
endif
|
|
||||||
" }
|
" }
|
||||||
|
"
|
||||||
|
" Plugin directory
|
||||||
|
let plugin_dir = '~/.vim/plugged/'
|
||||||
|
call plug#begin(plugin_dir)
|
||||||
|
|
||||||
" In your .vimrc.before.local file
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||||
" list only the plugin groups you will use
|
" add desired extensions to the following global variable
|
||||||
if !exists('g:spf13_bundle_groups')
|
" coc-tsserver: javascript
|
||||||
let g:spf13_bundle_groups=['my_bundle', 'general']
|
" coc-pyright: python
|
||||||
endif
|
" coc-clangd: c/c++, may need to install clangd seperatly
|
||||||
|
let g:coc_global_extensions = ['coc-pyright', 'coc-rls']
|
||||||
|
Plug 'rust-lang/rust.vim'
|
||||||
|
" syntax highlighting(and more) for typescript
|
||||||
|
" {
|
||||||
|
Plug 'leafgarland/typescript-vim'
|
||||||
|
" }
|
||||||
|
" {
|
||||||
|
Plug 'alvan/vim-closetag'
|
||||||
|
let g:closetag_filenames = '*.html,*.xhtml,*.phtml, *.js'
|
||||||
|
" }
|
||||||
|
Plug 'altercation/vim-colors-solarized'
|
||||||
|
"Plug 'lifepillar/vim-solarized8'
|
||||||
|
"Plug 'spf13/vim-colors'
|
||||||
|
Plug 'scrooloose/nerdtree'
|
||||||
|
|
||||||
" To override all the included bundles, add the following to your
|
" for markdown{
|
||||||
" .vimrc.bundles.local file:
|
Plug 'godlygeek/tabular'
|
||||||
" let g:override_spf13_bundles = 1
|
Plug 'preservim/vim-markdown'
|
||||||
if !exists("g:override_spf13_bundles")
|
"}
|
||||||
|
" for window resize{
|
||||||
|
Plug 'simeji/winresizer'
|
||||||
" my bundles {
|
|
||||||
if count(g:spf13_bundle_groups, 'my_bundle')
|
|
||||||
" {
|
|
||||||
"Bundle 'codota/tabnine-vim'
|
|
||||||
Bundle 'neoclide/coc.nvim'
|
|
||||||
Bundle 'rust-lang/rust.vim'
|
|
||||||
" add desired extensions to the following global variable
|
|
||||||
" coc-tsserver: javascript
|
|
||||||
" coc-pyright: python
|
|
||||||
" coc-clangd: c/c++, may need to install clangd seperatly
|
|
||||||
let g:coc_global_extensions = ['coc-pyright', 'coc-rls']
|
|
||||||
" syntax highlighting(and more) for typescript
|
|
||||||
" {
|
|
||||||
Bundle 'leafgarland/typescript-vim'
|
|
||||||
" }
|
|
||||||
" {
|
|
||||||
Bundle 'alvan/vim-closetag'
|
|
||||||
let g:closetag_filenames = '*.html,*.xhtml,*.phtml, *.js'
|
|
||||||
" }
|
|
||||||
endif
|
|
||||||
" }]
|
|
||||||
" General {
|
|
||||||
if count(g:spf13_bundle_groups, 'general')
|
|
||||||
Bundle 'altercation/vim-colors-solarized'
|
|
||||||
"Bundle 'lifepillar/vim-solarized8'
|
|
||||||
"Bundle 'spf13/vim-colors'
|
|
||||||
Bundle 'scrooloose/nerdtree'
|
|
||||||
|
|
||||||
" for markdown{
|
|
||||||
Bundle 'godlygeek/tabular'
|
|
||||||
Bundle 'preservim/vim-markdown'
|
|
||||||
"}
|
|
||||||
" for window resize{
|
|
||||||
Bundle 'simeji/winresizer'
|
|
||||||
let g:winresizer_start_key = '<C-r>'
|
let g:winresizer_start_key = '<C-r>'
|
||||||
let g:winresizer_vert_resize = 2
|
let g:winresizer_vert_resize = 2
|
||||||
let g:winresizer_horiz_resize = 2
|
let g:winresizer_horiz_resize = 2
|
||||||
" }
|
" }
|
||||||
|
|
||||||
Bundle 'tpope/vim-surround'
|
Plug 'tpope/vim-surround'
|
||||||
Bundle 'rhysd/conflict-marker.vim'
|
Plug 'rhysd/conflict-marker.vim'
|
||||||
" {
|
" {
|
||||||
Bundle 'jiangmiao/auto-pairs'
|
Plug 'jiangmiao/auto-pairs'
|
||||||
"let g:AutoPairsFlyMode = 1
|
"let g:AutoPairsFlyMode = 1
|
||||||
|
|
||||||
" }
|
" }
|
||||||
" {
|
" {
|
||||||
Bundle 'mg979/vim-visual-multi'
|
Plug 'mg979/vim-visual-multi'
|
||||||
" }
|
" }
|
||||||
Bundle 'matchit.zip'
|
Plug 'vim-airline/vim-airline'
|
||||||
Bundle 'vim-airline/vim-airline'
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
Bundle 'vim-airline/vim-airline-themes'
|
|
||||||
|
|
||||||
" For nvim-bufferline
|
" For nvim-bufferline
|
||||||
" {
|
" {
|
||||||
"Bundle 'kyazdani42/nvim-web-devicons'
|
"Plug 'kyazdani42/nvim-web-devicons'
|
||||||
"Bundle 'akinsho/nvim-bufferline.lua'
|
"Plug 'akinsho/nvim-bufferline.lua'
|
||||||
" }
|
" }
|
||||||
Bundle 'bling/vim-bufferline'
|
Plug 'bling/vim-bufferline'
|
||||||
Bundle 'easymotion/vim-easymotion'
|
Plug 'easymotion/vim-easymotion'
|
||||||
Bundle 'nathanaelkane/vim-indent-guides'
|
Plug 'nathanaelkane/vim-indent-guides'
|
||||||
if !exists('g:spf13_no_views')
|
Plug 'vim-scripts/restore_view.vim'
|
||||||
Bundle 'vim-scripts/restore_view.vim'
|
call plug#end()
|
||||||
endif
|
|
||||||
|
" Plugin Preferences
|
||||||
|
"
|
||||||
|
" NerdTree {
|
||||||
|
if isdirectory(expand(plugin_dir . "/nerdtree"))
|
||||||
|
let g:NERDShutUp=1
|
||||||
|
nnoremap <C-e> :NERDTreeToggle<CR>
|
||||||
|
" map <leader>e :NERDTreeFind<CR>
|
||||||
|
nmap <leader>nt :NERDTreeFind<CR>
|
||||||
|
|
||||||
|
let NERDTreeShowBookmarks=1
|
||||||
|
"let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
|
||||||
|
let NERDTreeChDirMode=0
|
||||||
|
let NERDTreeQuitOnOpen=1
|
||||||
|
let NERDTreeMouseMode=2
|
||||||
|
let NERDTreeShowHidden=1
|
||||||
|
let NERDTreeKeepTreeInNewTab=1
|
||||||
endif
|
endif
|
||||||
" }
|
" }
|
||||||
endif
|
" indent_guides {
|
||||||
|
if isdirectory(expand(plugin_dir . "/vim-indent-guides/"))
|
||||||
|
let g:indent_guides_start_level = 2
|
||||||
|
let g:indent_guides_guide_size = 1
|
||||||
|
let g:indent_guides_enable_on_vim_startup = 0
|
||||||
|
map <leader>f :IndentGuidesToggle<CR>
|
||||||
|
|
||||||
|
endif
|
||||||
|
" }
|
||||||
|
" vim-airline {
|
||||||
|
" Set configuration options for the statusline plugin vim-airline.
|
||||||
|
" Use the powerline theme and optionally enable powerline symbols.
|
||||||
|
" To use the symbols , , , , , , and .in the statusline
|
||||||
|
" segments add the following to your .vimrc.before.local file:
|
||||||
|
" let g:airline_powerline_fonts=1
|
||||||
|
" If the previous symbols do not render for you then install a
|
||||||
|
" powerline enabled font.
|
||||||
|
|
||||||
" Custome script {
|
" See `:echo g:airline_theme_map` for some more choices
|
||||||
|
" Default in terminal vim is 'dark'
|
||||||
if filereadable(expand("~/.vim-config/buffer_arrange.vim"))
|
let g:airline_section_z = ''
|
||||||
source ~/.vim-config/buffer_arrange.vim
|
let g:airline_section_y = ''
|
||||||
endif
|
|
||||||
|
if isdirectory(expand(plugin_dir . "/vim-airline-themes/"))
|
||||||
|
if !exists('g:airline_theme')
|
||||||
|
let g:airline_theme = 'solarized'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
" }
|
" }
|
||||||
|
|||||||
+25
-20
@@ -15,12 +15,10 @@ msg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
success() {
|
success() {
|
||||||
if [ "$ret" -eq '0' ]; then
|
msg "\33[32m[✔]\33[0m ${1}${2}"
|
||||||
msg "\33[32m[✔]\33[0m ${1}${2}"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
error() {
|
function fatal_error() {
|
||||||
msg "\33[31m[✘]\33[0m ${1}${2}"
|
msg "\33[31m[✘]\33[0m ${1}${2}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@@ -41,13 +39,14 @@ program_must_exist() {
|
|||||||
|
|
||||||
# throw error on non-zero return value
|
# throw error on non-zero return value
|
||||||
if [ "$?" -ne 0 ]; then
|
if [ "$?" -ne 0 ]; then
|
||||||
error "You must have '$1' installed to continue."
|
fatal_error "You must have '$1' installed to continue."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
env_set() {
|
env_set() {
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
error "You must have your $1 environmental variable set to continue."
|
fatal_error "You must have your $1 environmental variable set to continue."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,15 +64,19 @@ try_symlink() {
|
|||||||
############################ SETUP FUNCTIONS
|
############################ SETUP FUNCTIONS
|
||||||
|
|
||||||
backup_file() {
|
backup_file() {
|
||||||
original_file=$1
|
local original_file=$1
|
||||||
if [ -e "$original_file" ]; then
|
if [ -f "$original_file" ] && [ ! -L "$original_file" ]; then
|
||||||
today=`date +%Y%m%d_%s`
|
today=`date +%Y%m%d_%s`
|
||||||
[ -e "$i" ] && [ ! -L "$i" ] && mv -v "$original_file" "$original_file.$today";
|
mv -v "$original_file" "$original_file.$today";
|
||||||
ret="$?"
|
|
||||||
success "Your file $original_file has been backed up as $original_file.$today"
|
success "Your file $original_file has been backed up as $original_file.$today"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Usage: sync_repo path url
|
||||||
|
#
|
||||||
|
# This function try to clone git repo host in @url
|
||||||
|
# to @path. If @path alreay exsits, it will simply
|
||||||
|
# update the repo
|
||||||
sync_repo() {
|
sync_repo() {
|
||||||
local repo_path="$1"
|
local repo_path="$1"
|
||||||
local repo_uri="$2"
|
local repo_uri="$2"
|
||||||
@@ -96,19 +99,21 @@ sync_repo() {
|
|||||||
|
|
||||||
setup_vundle() {
|
setup_vundle() {
|
||||||
|
|
||||||
local VUNDLE_URI="https://github.com/gmarik/vundle.git"
|
# setup for vim
|
||||||
sync_repo "$HOME/.vim/bundle/vundle" \
|
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||||
"$VUNDLE_URI" \
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim > /dev/null 2>&1
|
||||||
"master" \
|
|
||||||
"vundle"
|
# setup for neovim
|
||||||
|
#sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
|
||||||
|
# https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||||
|
|
||||||
local system_shell="$SHELL"
|
local system_shell="$SHELL"
|
||||||
export SHELL='/bin/sh'
|
export SHELL='/bin/sh'
|
||||||
|
|
||||||
vim \
|
vim \
|
||||||
"+set nomore" \
|
"+set nomore" \
|
||||||
"+BundleInstall!" \
|
"+PlugInstall!" \
|
||||||
"+BundleClean" \
|
"+PlugClean" \
|
||||||
"+qall"
|
"+qall"
|
||||||
|
|
||||||
export SHELL="$system_shell"
|
export SHELL="$system_shell"
|
||||||
@@ -134,7 +139,7 @@ source ~/.vimrc" > $nvim_config
|
|||||||
|
|
||||||
set_up_tmux() {
|
set_up_tmux() {
|
||||||
if program_exists "tmux"; then
|
if program_exists "tmux"; then
|
||||||
backup_file "$APP_PATH/.tmux.conf"
|
backup_file "$HOME/.tmux.conf"
|
||||||
try_symlink "$APP_PATH/.tmux.conf" "$HOME/.tmux.conf" && \
|
try_symlink "$APP_PATH/.tmux.conf" "$HOME/.tmux.conf" && \
|
||||||
success "tmux config setup successed"
|
success "tmux config setup successed"
|
||||||
else
|
else
|
||||||
@@ -152,8 +157,8 @@ set_up_vim() {
|
|||||||
"$REPO_BRANCH" \
|
"$REPO_BRANCH" \
|
||||||
"$app_name"
|
"$app_name"
|
||||||
|
|
||||||
backup_file "$APP_PATH/.vimrc"
|
backup_file "$HOME/.vimrc"
|
||||||
backup_file "$APP_PATH/.vimrc.bundles"
|
backup_file "$HOME/.vimrc.bundles"
|
||||||
|
|
||||||
try_symlink "$APP_PATH/.vimrc" "$HOME/.vimrc"
|
try_symlink "$APP_PATH/.vimrc" "$HOME/.vimrc"
|
||||||
try_symlink "$APP_PATH/.vimrc.bundles" "$HOME/.vimrc.bundles"
|
try_symlink "$APP_PATH/.vimrc.bundles" "$HOME/.vimrc.bundles"
|
||||||
|
|||||||
Reference in New Issue
Block a user