未加星标

Switching to vim-plug

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二04 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

Recently I decided to switch my vim package manager once again, and this time the choice fell on vim-plug . (A couple of years ago I switched from Janus to Vundle )

The main part of this article consist of information found in the vim-plug README

Features Single file. No boilerplate code required. Concise, intuitive syntax Super-fast parallel installation/update (with any of +job , +python , +python3 , +ruby , or Neovim ) Creates shallow clones to minimize disk space usage and download time On-demand loading for faster startup time Can review and rollback updates Branch/tag/commit support Post-update hooks Support for externally managed plugins Installation

Download plug.vim and put it in the “autoload” directory.

Vim curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim Neovim curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim Commands

These are some of the commands that vim-plug provide.

PlugUpdate

Install or update plugins


Switching to vim-plug
PlugDiff

Examine changes from the previous update and the pending changes


Switching to vim-plug
PlugClean[!]

Remove unused directories (bang version will clean without prompt)


Switching to vim-plug
On-demand loading of plugins

On of the main reasons for using vim-plug is its support for on-demand loading of plugins.

" NERD tree will be loaded on the first invocation of NERDTreeToggle command Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } " Multiple commands Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] } " Loaded when clojure file is opened Plug 'tpope/vim-fireplace', { 'for': 'clojure' } " Multiple file types Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] } " On-demand loading on both conditions Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' } " Code to execute when the plugin is lazily loaded on demand Plug 'junegunn/goyo.vim', { 'for': 'markdown' } autocmd! User goyo.vim echom 'Goyo is now loaded!' Configuration examples

A small sensible Vim configuration

call plug#begin() Plug 'tpope/vim-sensible' call plug#end()

Minimal version of my Go development configuration

call plug#begin('~/.vim/plugged') Plug 'tpope/vim-sensible' Plug 'SirVer/ultisnips' Plug 'ervandew/supertab' Plug 'honza/vim-snippets' Plug 'peterhellberg/snippets' Plug 'itchyny/lightline.vim' Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'fatih/vim-go' Plug 'nanotech/jellybeans.vim' call plug#end() let mapleader=',' color jellybeans set completeopt-=preview set modelines=3 set nobackup set noshowmode set noswapfile set nowrap set nowritebackup set number set shiftwidth=2 set tabstop=2 set termguicolors set virtualedit=block " Open new buffers nmap <leader>s<left> :leftabove vnew<cr> nmap <leader>s<right> :rightbelow vnew<cr> nmap <leader>s<up> :leftabove new<cr> nmap <leader>s<down> :rightbelow new<cr> " Tab between buffers noremap <tab> <c-w>w noremap <S-tab> <c-w>W " Switch between last two buffers nnoremap <leader><leader> <C-^> " NERDTree nmap <leader>n :NERDTreeToggle<CR> " SuperTab let g:SuperTabDefaultCompletionType = "context" " UltiSnips let g:UltiSnipsExpandTrigger="<tab>" " Go programming au BufRead,BufNewFile *.go setl filetype=go nolist noexpandtab syntax=go au FileType go nmap <Leader>d <Plug>(go-def-vertical) au FileType go nmap <Leader>do <Plug>(go-doc-vertical) au FileType go nmap <Leader>ds <Plug>(go-def-split) au FileType go nmap <Leader>i <Plug>(go-info) au FileType go nmap <leader>c <Plug>(go-callers) let g:go_disable_autoinstall = 1 let g:go_highlight_functions = 1 let g:go_highlight_methods = 1 let g:go_highlight_operators = 1 let g:go_highlight_structs = 1 let g:go_fmt_command = "goimports" augroup go autocmd! autocmd Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit') autocmd Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit') autocmd Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split') augroup END

My full .vimrc is available in my dotfiles repository.

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: mapleADM
分页:12
转载请注明
本文标题:Switching to vim-plug
本站链接:http://www.codesec.net/view/530404.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(44)