Skip to content

Commit

Permalink
Make python3 default requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
5t111111 committed Jun 14, 2018
1 parent 87506d6 commit dcf32dd
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 135 deletions.
149 changes: 46 additions & 103 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -187,38 +197,17 @@ 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'
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()
Expand All @@ -232,79 +221,45 @@ call plug#end()
" Unite.vim
nnoremap [unite] <Nop>
nmap <Leader>u [unite]
nnoremap <silent> [unite]f :<C-u>Unite<Space>file<Return>
nnoremap <silent> [unite]n :<C-u>Unite<Space>file/new<Return>
nnoremap <silent> [unite]r :<C-u>Unite<Space>file_mru<Return>
nnoremap <silent> [unite]b :<C-u>Unite<Space>buffer<Return>
nnoremap <silent> [unite]fp :<C-u>call<Space><SID>unite_do_in_project('file_rec/async:')<Return>
nnoremap <silent> [unite]gp :<C-u>call<Space><SID>unite_do_in_project('grep:')<Return>
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 <silent> [unite]r :<C-u>Denite<Space>file_mru<Return>
nnoremap <silent> [unite]b :<C-u>Denite<Space>buffer<Return>
nnoremap <silent> [unite]fp :<C-u>Denite<Space>file_rec<Return>
nnoremap <silent> [unite]gp :<C-u>Denite<Space>grep<Return>
nnoremap <silent> [unite]l :<C-u>Denite<Space>line<Return>
nnoremap <silent> [unite]u :<C-u>Denite<Space>-resume<Return>
call denite#custom#map('insert', '<C-j>', '<denite:move_to_next_line>', 'noremap')
call denite#custom#map('insert', '<C-k>', '<denite:move_to_previous_line>', 'noremap')
call denite#custom#map('insert', '<C-x>', '<denite:input_command_line>', '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] <Nop>
nmap <Leader>r [rails]
nnoremap [rails]r :Unite<Space>rails/
nnoremap <silent> [rails]m :<C-u>Unite<Space>rails/model<Return>
nnoremap <silent> [rails]c :<C-u>Unite<Space>rails/controller<Return>
nnoremap <silent> [rails]v :<C-u>Unite<Space>rails/view<Return>
nnoremap <silent> [rails]h :<C-u>Unite<Space>rails/helper<Return>
" unite-outline
nnoremap <silent> [unite]o :<C-u>Unite<Space>-vertical<Space>-no-quit<Space>-direction=botright<Space>-winwidth=35<Space>outline<Return>
" Denite.vim
if get(g:, 'load_denite')
nnoremap <silent> [unite]r :<C-u>Denite<Space>file_mru<Return>
nnoremap <silent> [unite]b :<C-u>Denite<Space>buffer<Return>
nnoremap <silent> [unite]fp :<C-u>Denite<Space>file_rec<Return>
nnoremap <silent> [unite]gp :<C-u>Denite<Space>grep<Return>
nnoremap <silent> [unite]l :<C-u>Denite<Space>line<Return>
nnoremap <silent> [unite]u :<C-u>Denite<Space>-resume<Return>
call denite#custom#map('insert', '<C-j>', '<denite:move_to_next_line>', 'noremap')
call denite#custom#map('insert', '<C-k>', '<denite:move_to_previous_line>', 'noremap')
call denite#custom#map('insert', '<C-x>', '<denite:input_command_line>', '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] <Nop>
nmap <Leader>r [rails]
nnoremap [rails]r :Denite<Space>rails:
nnoremap <silent> [rails]r :<C-u>Denite<Space>rails:dwim<Return>
nnoremap <silent> [rails]m :<C-u>Denite<Space>rails:model<Return>
nnoremap <silent> [rails]c :<C-u>Denite<Space>rails:controller<Return>
nnoremap <silent> [rails]v :<C-u>Denite<Space>rails:view<Return>
nnoremap <silent> [rails]h :<C-u>Denite<Space>rails:helper<Return>
nnoremap <silent> [rails]t :<C-u>Denite<Space>rails:test<Return>
" unite-outline (to call it via denite)
nnoremap <silent> [unite]o :<C-u>Denite unite:outline<Return>
endif

nnoremap [rails]r :Denite<Space>rails:
nnoremap <silent> [rails]r :<C-u>Denite<Space>rails:dwim<Return>
nnoremap <silent> [rails]m :<C-u>Denite<Space>rails:model<Return>
nnoremap <silent> [rails]c :<C-u>Denite<Space>rails:controller<Return>
nnoremap <silent> [rails]v :<C-u>Denite<Space>rails:view<Return>
nnoremap <silent> [rails]h :<C-u>Denite<Space>rails:helper<Return>
nnoremap <silent> [rails]t :<C-u>Denite<Space>rails:test<Return>
" unite-outline (to call it via denite)
nnoremap <silent> [unite]o :<C-u>Denite unite:outline<Return>
" Neosnippet
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
Expand All @@ -318,11 +273,7 @@ nnoremap <silent> <Leader>nt :<C-u>NERDTreeToggle<Return>
" 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 = {
Expand Down Expand Up @@ -362,16 +313,8 @@ xnoremap <silent> <Leader>s :<C-u>'<,'>OverCommandLine<Return>
" vim-migemo
nmap <silent> g/ <Plug>(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
Expand Down
4 changes: 0 additions & 4 deletions .vimrc.preset.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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
48 changes: 20 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:

- `<Leader>ur` : to "unite" recently opened files
- `<Leader>ub` : to "unite" buffers
- `<Leader>ufp` : to "unite" find files in the project (e.g. for files in git repository)
- `<Leader>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:

- `<Leader>rm` : to "unite" models
- `<Leader>rc` : to "unite" controllers
- `<Leader>rv` : to "unite" views
- `<Leader>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

Expand All @@ -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:

Expand Down

0 comments on commit dcf32dd

Please sign in to comment.