Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
Last active December 24, 2016 05:27
Show Gist options
  • Save prabirshrestha/c58d929cf071aed461ce to your computer and use it in GitHub Desktop.
Save prabirshrestha/c58d929cf071aed461ce to your computer and use it in GitHub Desktop.
bootstrap vim plugin managers
" to use existing vim configuration as neovim configuration
" ln -s ~/.vimrc ~/.config/nvim/init.vim
let mapleader = ' '
" vimrc {{{
nnoremap <leader>ev :e $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" }}}
let s:settings = {}
let s:settings.is_win = has('win32') || has('win64')
if s:settings.is_win
set shellslash
endif
let s:settings.cache_dir = expand('~/.config/nvim/cache')
let s:settings.dein_dir = s:settings.cache_dir . '/dein'
let s:settings.dein_repo_dir = s:settings.dein_dir . '/repos/github.com/Shougo/dein.vim'
if &runtimepath !~# '/dein.vim'
if !isdirectory(s:settings.dein_repo_dir)
execute '!git clone --depth 1 https://github.com/Shougo/dein.vim ' . s:settings.dein_repo_dir
endif
execute 'set rtp^=' . fnamemodify(s:settings.dein_repo_dir, ':p')
endif
if dein#load_state(s:settings.dein_dir)
call dein#begin(s:settings.dein_dir)
call dein#add('haya14busa/dein-command.vim', { 'on_cmd': 'Dein' })
" colorschemes {{{
call dein#add('iCyMind/NeoSolarized')
call dein#add('mhartington/oceanic-next')
" }}}
call dein#add('Shougo/denite.nvim', { 'on_cmd': 'Denite' })
" deoplete {{{
call dein#add('Shougo/deoplete.nvim', { 'on_if': 'has("nvim") && has("python3")' })
call dein#add('Shougo/neco-vim', { 'depends': ['deoplete.nvim'] })
" }}}
call dein#end()
call dein#save_state()
endif
if dein#check_install()
call dein#install()
endif
if has('termguicolors')
set termguicolors
endif
set background=dark
if dein#tap('NeoSolarized')
" silent! colorscheme NeoSolarized
endif
" plugin configurations {{{
" deoplete config {{{
let g:deoplete#enable_at_startup=1
let g:deoplete#enable_smart_case=1
let g:deoplete#enable_camel_case=1
let g:deoplete#auto_complete_start_length=1
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ deoplete#mappings#manual_complete()
function! s:check_back_space() abort "{{{
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction"}}}
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" }}}
"}}}
" vim: set sw=2 ts=2 sts=2 et tw=78 foldmarker={{{,}}} foldlevel=0 foldmethod=marker spell:
" curl -Lk https://gist.githubusercontent.com/prabirshrestha/c58d929cf071aed461ce/raw/init.vim%2520from%2520vim-plug -o ~/.vimrc
" to use existing vim configuration as neovim configuration
" ln -s ~/.vimrc ~/.config/nvim/init.vim
let mapleader = ' '
" vimrc {{{
nnoremap <leader>ev :e $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" }}}
let s:settings = {}
let s:settings.is_win = has('win32') || has('win64')
if s:settings.is_win
set shellslash
endif
let s:settings.rtp = expand('~/.config/nvim')
let s:settings.cache = s:settings.rtp . '/cache'
let s:settings.plugins = s:settings.cache . '/plugins'
if has('vim_starting')
execute 'set rtp^=' . fnamemodify(s:settings.rtp, ':p')
endif
if !executable('curl')
echom 'curl required'
endif
if !executable('git')
echom 'git required'
endif
if !has('nvim') && has('vim_starting')
execute 'set rtp^=' . fnamemodify(s:settings.rtp, ':p')
endif
if !filereadable(s:settings.rtp . '/autoload/plug.vim')
let s:settings.plug_dot_vim = expand(s:settings.rtp . '/autoload/plug.vim')
if s:settings.is_win
let s:settings.plug_dot_vim = substitute(s:settings.plug_dot_vim, '/', '\\', 'g')
endif
execute 'silent !curl -fkLo ' . s:settings.plug_dot_vim ' --create-dirs'
\ ' https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall
endif
call plug#begin(s:settings.plugins)
Plug 'mhartington/oceanic-next'
Plug 'iCyMind/NeoSolarized'
Plug 'altercation/vim-colors-solarized'
call plug#end()
if has('termguicolors')
set termguicolors
endif
set background=dark
" silent! colorscheme NeoSolarized
" set guifont=* to select fonts
" set guifont? to get the name of the current font
" set guifont=Consolas\ for\ Powerline\ FixedD:h11
if has('gui_macvim')
set guifont=Ubuntu\ Mono\ Nerd\ Font\ Complete\ Mono\ Windows\ Compatible:h15
else
set guifont=UbuntuMono_NF:h12:cANSI:qDRAFT
endif
if has('clipboard')
if has('unnamedplus') " When possible use + register for copy-paste
set clipboard=unnamed,unnamedplus
else " On mac and Windows, use * register for copy-paste
set clipboard=unnamed
endif
endif
" vim: set sw=2 ts=2 sts=2 et tw=78 foldmarker={{{,}}} foldlevel=0 foldmethod=marker spell:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment