3

I'm pretty new to Vim and vim-plug and I can't get the latter to install my plugins.

I think I've set everything up—see my files below. But when I start Vim and enter :PlugStatus, it shows a blank list. :PlugInstall returns No plugin to install.

Can somebody tell me what I'm doing wrong?

Context

  • Mac OS X 10.11.6
  • Vim 8.0.2
  • I don't know how vim-plug is versioned, but :PlugUpgrade returns vim-plug is already up-to-date
  • git 2.7.4 (Apple Git-66)
  • :ruby puts RUBY_VERSION: 2.3.1
  • :python import platform; print(platform.python_version()): 2.7.12

Files:

.vimrc:

(note the last line)

syntax on
filetype plugin indent on
set relativenumber
set number

" searching
set incsearch
set hlsearch
set ignorecase
set smartcase

" backspace over everything
set backspace=indent,eol,start

" number of spaces inserted by tab
set shiftwidth=4

" status line
hi User1 ctermbg=gray  ctermfg=black
hi User2 ctermbg=gray  ctermfg=red cterm=bold

set laststatus=2
set statusline=     "reset statusline
set statusline+=%1* "black on gray
set statusline+=%F      "full filename
" set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding
" set statusline+=%{&ff}] "file format
set statusline+=\ %y    "filetype
set statusline+=\ %h    "help file flag
set statusline+=\ %2*   "white on red
set statusline+=%m      "modified flag
set statusline+=%1* "black on gray
set statusline+=\ %r    "read only flag
set statusline+=%=      "left/right separator
set statusline+=%c,     "cursor column
set statusline+=%l/%L   "cursor line/total lines
set statusline+=\ \ %P  "percent through file

" load vim-plug
source ~/.vim/.plug.vim

.vim.plug:

" plug
" Config for vim-plug
" https://github.com/junegunn/vim-plug

" install vim-plug if we don't already have it
if empty(glob('~/.vim/autoload/plug.vim'))
    " ensure directories exist
    execute '!mkdir -p ~/.vim/autoload'
    execute '!mkdir -p ~/.vim/plugged'
    " download vim-plug
    silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    autocmd VimEnter * PlugInstall | source ~/.vim/.plug.vim
endif

call plug#begin('~/.vim/plugged')

" Defaults everyone can agree on
Plug 'tpope/vim-sensible'

" quoting/parenthesizing made simple
Plug 'tpope/vim-surround'

" syntax highlighting
Plug 'tomvanderlee/vim-kerboscript', { 'for': 'kerboscript' }

call plug#begin()
" ANSWER: ^^^^^  that should be `end`!
2
  • Oops, it's just that last line of .plug.vim. Copypasta error.
    – Jacktose
    Sep 15, 2016 at 21:49
  • Funny/embarrassing that this is my first Notable Question.
    – Jacktose
    Mar 7, 2019 at 21:04

1 Answer 1

2

@P1h3r1e3d13 Please try the following configuration

For .vim.plug:

" =============================================================================
" Plugin Manager Setup
" =============================================================================
"
filetype off

" Install the plugin manager if it doesn't exist
let s:plugin_manager=expand('~/.vim/autoload/plug.vim')
let s:plugin_url='https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'

if empty(glob(s:plugin_manager))
  echom 'vim-plug not found. Installing...'
  if executable('curl')
    silent exec '!curl -fLo ' . s:plugin_manager . ' --create-dirs ' .
          \ s:plugin_url
  elseif executable('wget')
    call mkdir(fnamemodify(s:plugin_manager, ':h'), 'p')
    silent exec '!wget --force-directories --no-check-certificate -O ' .
          \ expand(s:plugin_manager) . ' ' . s:plugin_url
  else
    echom 'Could not download plugin manager. No plugins were installed.'
    finish
  endif
  augroup vimplug
    autocmd!
    autocmd VimEnter * PlugInstall
  augroup END
endif

" Create a horizontal split at the bottom when installing plugins
let g:plug_window = 'botright new'

let g:plug_dir = expand('~/.vim/bundle')
call plug#begin(g:plug_dir)

" Defaults everyone can agree on
Plug 'tpope/vim-sensible'

" quoting/parenthesizing made simple
Plug 'tpope/vim-surround'

" syntax highlighting
Plug 'tomvanderlee/vim-kerboscript', { 'for': 'kerboscript' }

""" All of your Plugins must be added before the following line
" Add plugins to &runtimepath
call plug#end()   "required

And then try the following for your

.vimrc:

" load vim-plug
source ~/.vim/.plug.vim

syntax on
filetype plugin indent on
set relativenumber
set number

" searching
set incsearch
set hlsearch
set ignorecase
set smartcase

" backspace over everything
set backspace=indent,eol,start

" number of spaces inserted by tab
set shiftwidth=4

" status line
hi User1 ctermbg=gray  ctermfg=black
hi User2 ctermbg=gray  ctermfg=red cterm=bold

set laststatus=2
set statusline=     "reset statusline
set statusline+=%1* "black on gray
set statusline+=%F      "full filename
" set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding
" set statusline+=%{&ff}] "file format
set statusline+=\ %y    "filetype
set statusline+=\ %h    "help file flag
set statusline+=\ %2*   "white on red
set statusline+=%m      "modified flag
set statusline+=%1* "black on gray
set statusline+=\ %r    "read only flag
set statusline+=%=      "left/right separator
set statusline+=%c,     "cursor column
set statusline+=%l/%L   "cursor line/total lines
set statusline+=\ \ %P  "percent through file
2
  • Ah, comparing your file made me find my error. I just pasted plug#begin() to the end and never changed it to plug#end(). Fixing that did it. Thanks for the tips.
    – Jacktose
    Sep 15, 2016 at 21:30
  • @P1h3r1e3d13 your welcome
    – byaruhaf
    Sep 15, 2016 at 22:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.