From dcf32ddc7f578c6453bdbf8d6cb9afe581245bd7 Mon Sep 17 00:00:00 2001 From: Hirofumi Wakasugi Date: Thu, 14 Jun 2018 19:04:18 +0900 Subject: [PATCH] Make python3 default requirement --- .vimrc | 149 +++++++++++++------------------------------ .vimrc.preset.sample | 4 -- README.md | 48 ++++++-------- 3 files changed, 66 insertions(+), 135 deletions(-) diff --git a/.vimrc b/.vimrc index a417003..807869c 100644 --- a/.vimrc +++ b/.vimrc @@ -125,9 +125,19 @@ endif " Requires plug.vim installed in the autoload directory. " See https://github.com/junegunn/vim-plug for details. + +function! DoUpdateRemotePlugins(arg) + if has('nvim') + UpdateRemotePlugins + end +endfunction + call plug#begin('~/.vim/plugged') Plug 'Shougo/vimproc.vim', { 'do': 'make' } +Plug 'Shougo/denite.nvim', { 'do': function('DoUpdateRemotePlugins') } +Plug 'Shougo/deoplete.nvim', { 'do': function('DoUpdateRemotePlugins') } +Plug '5t111111/denite-rails' Plug 'Shougo/neomru.vim' Plug 'Shougo/unite.vim' Plug 'Shougo/neosnippet' @@ -187,15 +197,6 @@ if get(g:, 'load_vimwiki') Plug 'vimwiki/vimwiki' endif -if get(g:, 'load_denite') - if !has('nvim') - Plug 'Shougo/denite.nvim' - Plug '5t111111/denite-rails' - endif -else - Plug 'basyura/unite-rails' -endif - " Colorschemes Plug 'tomasr/molokai' Plug 'sjl/badwolf' @@ -203,22 +204,10 @@ Plug 'altercation/vim-colors-solarized' Plug 'dracula/vim', { 'as': 'dracula' } Plug 'NLKNguyen/papercolor-theme' -" Vim/Neovim specific plugins -if has('nvim') - function! DoRemote(arg) - UpdateRemotePlugins - endfunction - - Plug 'Shougo/deoplete.nvim', { 'do': function('DoRemote') } - - if get(g:, 'load_denite') - Plug 'Shougo/denite.nvim', { 'do': function('DoRemote') } - Plug '5t111111/denite-rails' - endif -else - if has('lua') - Plug 'Shougo/neocomplete.vim' - endif +" nvim-yarp and vim-hug-neovim-rpc are required for deoplete.nvim in Vim8. +if !has('nvim') + Plug 'roxma/nvim-yarp' + Plug 'roxma/vim-hug-neovim-rpc' endif call plug#end() @@ -232,79 +221,45 @@ call plug#end() " Unite.vim nnoremap [unite] nmap u [unite] -nnoremap [unite]f :Unitefile -nnoremap [unite]n :Unitefile/new -nnoremap [unite]r :Unitefile_mru -nnoremap [unite]b :Unitebuffer -nnoremap [unite]fp :callunite_do_in_project('file_rec/async:') -nnoremap [unite]gp :callunite_do_in_project('grep:') let g:unite_enable_start_insert = 1 -" unite do from project's root directory -function! s:unite_do_in_project(source) - let l:project_root = unite#util#path2project_directory(expand('%')) - execute 'Unite ' . a:source . l:project_root -endfunction +" Denite.vim +nnoremap [unite]r :Denitefile_mru +nnoremap [unite]b :Denitebuffer +nnoremap [unite]fp :Denitefile_rec +nnoremap [unite]gp :Denitegrep +nnoremap [unite]l :Deniteline +nnoremap [unite]u :Denite-resume + +call denite#custom#map('insert', '', '', 'noremap') +call denite#custom#map('insert', '', '', 'noremap') +call denite#custom#map('insert', '', '', 'noremap') " Use 'ag' instead of 'grep' if available if executable('ag') - let g:unite_source_grep_command = 'ag' - let g:unite_source_grep_default_opts = '--nogroup --nocolor --column' - let g:unite_source_grep_recursive_opt = '' + call denite#custom#var('grep', 'command', ['ag']) + call denite#custom#var('grep', 'default_opts', + \ ['-i', '--vimgrep']) + call denite#custom#var('grep', 'recursive_opts', []) + call denite#custom#var('grep', 'pattern_opt', []) + call denite#custom#var('grep', 'separator', ['--']) + call denite#custom#var('grep', 'final_opts', []) endif -" unite-rails +" denite-rails nnoremap [rails] nmap r [rails] -nnoremap [rails]r :Uniterails/ -nnoremap [rails]m :Uniterails/model -nnoremap [rails]c :Uniterails/controller -nnoremap [rails]v :Uniterails/view -nnoremap [rails]h :Uniterails/helper - -" unite-outline -nnoremap [unite]o :Unite-vertical-no-quit-direction=botright-winwidth=35outline - -" Denite.vim -if get(g:, 'load_denite') - nnoremap [unite]r :Denitefile_mru - nnoremap [unite]b :Denitebuffer - nnoremap [unite]fp :Denitefile_rec - nnoremap [unite]gp :Denitegrep - nnoremap [unite]l :Deniteline - nnoremap [unite]u :Denite-resume - - call denite#custom#map('insert', '', '', 'noremap') - call denite#custom#map('insert', '', '', 'noremap') - call denite#custom#map('insert', '', '', 'noremap') - - " Use 'ag' instead of 'grep' if available - if executable('ag') - call denite#custom#var('grep', 'command', ['ag']) - call denite#custom#var('grep', 'default_opts', - \ ['-i', '--vimgrep']) - call denite#custom#var('grep', 'recursive_opts', []) - call denite#custom#var('grep', 'pattern_opt', []) - call denite#custom#var('grep', 'separator', ['--']) - call denite#custom#var('grep', 'final_opts', []) - endif - - " denite-rails - nnoremap [rails] - nmap r [rails] - nnoremap [rails]r :Deniterails: - nnoremap [rails]r :Deniterails:dwim - nnoremap [rails]m :Deniterails:model - nnoremap [rails]c :Deniterails:controller - nnoremap [rails]v :Deniterails:view - nnoremap [rails]h :Deniterails:helper - nnoremap [rails]t :Deniterails:test - - " unite-outline (to call it via denite) - nnoremap [unite]o :Denite unite:outline -endif - +nnoremap [rails]r :Deniterails: +nnoremap [rails]r :Deniterails:dwim +nnoremap [rails]m :Deniterails:model +nnoremap [rails]c :Deniterails:controller +nnoremap [rails]v :Deniterails:view +nnoremap [rails]h :Deniterails:helper +nnoremap [rails]t :Deniterails:test + +" unite-outline (to call it via denite) +nnoremap [unite]o :Denite unite:outline " Neosnippet imap (neosnippet_expand_or_jump) smap (neosnippet_expand_or_jump) @@ -318,11 +273,7 @@ nnoremap nt :NERDTreeToggle " CtrlP if get(g:, 'load_cpsm') let g:ctrlp_match_func = { 'match': 'cpsm#CtrlPMatch' } - - " Denite.vim integration - if get(g:, 'load_denite') - call denite#custom#source('file_rec', 'matchers', ['matcher_cpsm']) - endif + call denite#custom#source('file_rec', 'matchers', ['matcher_cpsm']) endif let g:ctrlp_user_command = { @@ -362,16 +313,8 @@ xnoremap s :'<,'>OverCommandLine " vim-migemo nmap g/ (migemo-migemosearch) -" Vim/Neovim specific plugin settings -if has('nvim') - " deoplete.nvim - let g:deoplete#enable_at_startup = 1 -else - if has('lua') - " neocomplete.vim - let g:neocomplete#enable_at_startup = 1 - endif -endif +" deoplete.nvim +let g:deoplete#enable_at_startup = 1 " vim-js-pretty-template autocmd FileType javascript JsPreTmpl html diff --git a/.vimrc.preset.sample b/.vimrc.preset.sample index 86999e0..31a2248 100644 --- a/.vimrc.preset.sample +++ b/.vimrc.preset.sample @@ -5,9 +5,5 @@ " (cpsm requires Vim compiled with the +python flag and C++ compiler supporting C++11) " let g:load_cpsm = 1 -" if you want to use Denite, uncomment this line -" (Some features using Unite are overwritten, but others remain active) -" let g:load_denite = 1 - " if you want to use vimwiki, uncomment this line " let g:load_vimwiki = 1 diff --git a/README.md b/README.md index 090db75..8c5894d 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,24 @@ This is a Ruby/Rails-community-driven vimrc and aimed to help you to experience - Adorable key-bindings - Providing Plugin set and basic ways to use them +## Prerequisites + +This vimrc works only on Neovim/Vim8.0+ built with Python 3 interface (`if_python3`). + +If you are using macOS and want to intall Vim with `if_python3`, it is super easy using Homebrew: + +``` +$ brew install vim --with-python3 +``` + +You can check if Vim is built with `if_python3` by `:echo has("python3")`. If it returns 1, then you're OK. + +Also, since some plugins (e.g. deoplete.nvim) require Neovim Python client, you might have to install it: + +``` +$ pip3 install neovim +``` + ## Installation Clone this repository in anywhere you like: @@ -117,28 +135,7 @@ You can find the full list ofg themes on https://github.com/vim-airline/vim-airl The unite is a plugin which can search and display information from arbitrary sources like files, buffers or recently used files. -A few things at least you have to know about Unite are: - -- `ur` : to "unite" recently opened files -- `ub` : to "unite" buffers -- `ufp` : to "unite" find files in the project (e.g. for files in git repository) -- `ugp` : to "unite" grep files in the project (e.g. from files in git repository) - - ag will be used as grep source if available - -For more information, visit https://github.com/Shougo/unite.vim or `:help unite`. - -### unite-rails - -unite-rails is a unite plugin for rails. - -A few things at least you have to know about unite-rails are: - -- `rm` : to "unite" models -- `rc` : to "unite" controllers -- `rv` : to "unite" views -- `rh` : to "unite" helpers - -For more information, visit https://github.com/basyura/unite-rails or `:help unite-rails`. +However, Unite will be replaced with Denite in near future because the plugin author of Unite states that active development of Unite has stopped, so there exists Unite only for backward compatibility. ### unite-outline @@ -158,12 +155,7 @@ For more information, visit https://github.com/mtsmfm/unite-turnip . ### Denite.nvim -Denite.nvim is to unite all interfaces for NeoVim/Vim. Maybe Unite will be replaced with Denite in near future -because the plugin author of Unite states that active development of Unite has stopped. - -However, for the moment Denite.vim is an optional choice as it does not have enough sources (like unite-rails) -and maybe still has many breaking changes, so you have to explicitly configure your `~/.vimrc.preset` by -uncommenting `let g:load_denite = 1`. +Denite.nvim is to unite all interfaces for NeoVim/Vim. A few things at least you have to know about Denite are: