Search code examples
vimvim-pluginmacvimnerdtree

Can't run NERDTree and lightline on MacOS Catalina using macvim 8.2.319


Am using macvim 8.2.319 (installed it by running the downloaded dmg file) on macOS Catalina (10.15.4).

Trying installing NERDTree and liteline through vim plug, but nothing seems to be working...


Using vim plug, I created the autoload dir inside:

~/.vim/autoload

And then issued the following command:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

My .gvimrc file:

set nu

syntax on

if has("gui_running")
  if has("gui_gtk2")
    set guifont=Inconsolata\ 12
  elseif has("gui_macvim")
    set guifont=JetBrains\ Mono\ Regular:h14
  elseif has("gui_win32")
    set guifont=Consolas:h11:cANSI
  endif
endif

colorscheme pencil

set background=light
let g:airline_theme = 'pencil'

call plug#begin('~/.vim/plugged')
Plug 'itchyny/lightline.vim'
Plug 'preservim/nerdtree'
call plug#end()

map <C-t> :NERDTreeToggle<CR>

When I try to load it using either:

. .gvimrc 

or

source .gvimrc

It outputs the following error:

-bash: .gvimrc: line 20: syntax error near unexpected token `('
-bash: .gvimrc: line 20: `call plug#begin('~/.vim/plugged')'

Also, opened up a new Terminal window and it still doesn't work...


When I run macvim by doing this:

gvim Hello.py

The line numbers are set but I can't see liteline anywhere (I did do a :PlugInstall and :PlugUpdate).

When I try to open NERDTree by clicking on control t, it states this:

E492: Not an editor command: NERDTreeToggle

By, the way, I don't have a .vimrc file created...

Why are the NERDTree and liteline plug-ins not working on macvim?


Solution

  • The people that answered this question actually answered via the vim_mac@googlegroups mailing list... The credit goes to an individual who responded to my post there. Will include the solution, nonetheless...

    Solution was to include everything in ~/.vimrc:

    set nu
    set ruler
    set rulerformat=%l\:%c  
    set autoindent
    syntax on
    set nocompatible 
    set t_Co=256
    set tabstop=4
    set laststatus=2
    set encoding=utf-8     
    
    if has("gui_running")
      if has("gui_gtk2")
        set guifont=Inconsolata\ 12
      elseif has("gui_macvim")
        set guifont=JetBrains\ Mono\ Regular:h14
      elseif has("gui_win32")
        set guifont=Consolas:h11:cANSI
      endif
    endif
    
    colorscheme pencil
    
    set background=light
    let g:airline_theme = 'pencil'
    
    call plug#begin('~/.vim/plugged')
    Plug 'itchyny/lightline.vim'
    Plug 'preservim/nerdtree'
    call plug#end()
    
    map <C-t> :NERDTreeToggle<CR>