I'm using Neovim and have the following line in my .init.vim:
command! FZF FloatermNew fzf
It only takes effect if I source $MYVIMRC file every time at startup with :so $MYVIMRC command otherwise it doesn't work.
.init.vim
call plug#begin('~/.config/nvim/plugged')
" Plugins will go here in the middle."
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'junegunn/fzf.vim'
Plug 'voldikss/vim-floaterm'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'arcticicestudio/nord-vim'
Plug 'scrooloose/nerdtree'
Plug 'itchyny/lightline.vim'
Plug 'fatih/vim-go'
"Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clangd-completer' }
Plug 'Raimondi/delimitMate'
Plug 'sonph/onehalf', {'rtp': 'vim/'}
call plug#end()
source $HOME/.config/nvim/plug-config/floaterm.vim
command! FZF FloatermNew fzf
" now commands are not case-sensitive and write them and hit the tab for
" completion
set ignorecase
"theme
colorscheme nord
set termguicolors
let g:lightline = {'colorscheme': 'deus'}
syntax on
if !exists("g:syntax_on")
syntax enable
endif
" Plugins settings
let g:go_fmt_command = "goimports"
let g:go_list_type = "quickfix"
"Golang
let g:go_auto_type_info = 1
let g:go_gocode_unimported_packages = 1
set updatetime=100
let g:go_gopls_complete_unimported = 1
"set completeopt-=preview
"let g:ycm_autoclose_preview_window_after_completion = 1
" ######### Coc Configs #########
" ######### Airline Configs #########
let g:airline_theme='deus'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
" ######### FZF Configs #########
"line number
set number
"Auto-save before make command
set autowrite
"Custom key maps
map <F4> :w<CR>:!make<CR>
"without defining run target in Makefile
"map <F4> :w<CR>:!make && make run<CR>
"How can I open a NERDTree automatically when vim starts up?
"autocmd vimenter * NERDTree
"How can I close vim if the only window left open is a NERDTree?
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"focus on right window instead of nerdtree
au VimEnter * wincmd l
map <C-f> :NERDTreeFocus<CR>
"remove tilde for empty lines.
set fcs=eob:\
set tabstop=4
set softtabstop=4
set shiftwidth=4
set noexpandtab
"show a vertical line in the right side of page to indicate a limit for total characters in a line.
"set colorcolumn=110
"highlight ColorColumn ctermbg=darkgray
"Auto-completion
"let g:ycm_global_ycm_extra_conf = '~/Users/admin/.config/nvim/plugged/YouCompleteMe/.ycm_extra_conf.py'
"to improve source code navigation, add something like this to your nvim configuration:
"au FileType c,cpp nnoremap <buffer> <c-]> :YcmCompleter GoTo<CR>
"let g:ycm_server_keep_logfiles = 1
"let g:ycm_server_log_level = 'debug'
Thanks in advance!
There's something called in vim after-directory which is helpful for this situation where you put .vim files and pass the path to :runtimepath command.
I'm using neovim so after-directory in my workflow in a macOS system is like below:
~/.config/nvim/after/plugin/commands.vim
so I command! FZF FloatermNew fzf in that file and then give file path to the :runtimepath so this file will be sourced after all other :scriptnames files sourced.
When I press 0 in Normal mode, the cursor goes to the second column and not the first one.
This is not the normal behavior stated in vim's :help 0.
I have tried disabling the remaps to move between wrapped lines from my config (below) and the behavior is the same.
Is there any way to change this? Maybe a package it's interfering with the regular behavior but I cannot see which one.
Here is my .vimrc config file
set backspace=indent,eol,start " backspace over everything in insert mode
set nocompatible " be improved, required
filetype off " required
" vim-plug manager
" Plugins will be downloaded under the specified directory.
call plug#begin('~/.vim/plugged')
Plug 'lervag/vimtex'
let g:tex_flavor='latex'
let g:vimtex_view_method='zathura'
let g:vimtex_quickfix_mode=0
set conceallevel=1
let g:tex_conceal='abdmg'
Plug 'sirver/ultisnips'
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
Plug 'itchyny/lightline.vim'
Plug 'sainnhe/gruvbox-material'
Plug 'scrooloose/nerdcommenter'
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
syntax enable
"colorscheme monokai
set number
set ts=4
set expandtab
set autoindent
set wildmenu
set showmatch
set showmatch
set incsearch
set nohlsearch
set linebreak
set ttimeoutlen=0
set laststatus=2
set noshowmode
" Lets you edit another file without saving the current
set hidden
" GUI enhancements
" Set nice colors for 256 terminal
if !has('gui_running')
set t_Co=256
endif
" Set the airline colorscheme
let g:lightline = {'colorscheme' : 'gruvbox_material'}
" Set colorscheme
set termguicolors
set background=dark
let g:gruvbox_material_background = 'medium'
colorscheme gruvbox-material
" REMAPS
" Inserting a real Tab when pressing Shift + Tab
:inoremap <S-Tab> <C-V>Tab>
" Move between wrapped lines
noremap <silent> k gk
noremap <silent> j gj
noremap <silent> 0 g0
noremap <silent> $ g$
I'm a VIM user and recently started using Reason for React dev. I use ALE and LanguageClient for different languages, i.e.:
autozimu/LanguageClient-neovim
rust
ocaml
reason
w0rp/ale
python
javascript
reason
Note the overlap with Reason.
I seem to be in this weird place where I'm using half of the functionality of each. Specifically, ALE is running refmt for formatting code, but it's not performing linting. The LanguageClient is performing linting. I've confirmed this by commenting out refmt in ALE (breaks formatting) and commenting out the LanguageClient line for reason (breaks linting). I prefer ALE's linting over LanguageClient due to its use of quickfix (:lopen to see all the issues) and async error checking on leaving insert mode. I also seem to have redundant capabilities across both plugins right now, which just bugs my internal perfectionist.
Questions:
Is there any point in having both of these plugins, or is the functionality entirely duplicated between ALE and LanguageClient?
Why isn't linting working in ALE? Works in every other language, and OLS shows as a valid option in my :ALEInfo.
.vimrc...
Thoughts?
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General NVIM
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("nvim")
let g:python_host_prog = '/Users/nathan/.pyenv/versions/neovim2/bin/python'
let g:python3_host_prog = '/Users/nathan/.pyenv/versions/neovim3/bin/python'
endif
if has("nvim") || (v:version > 8)
set termguicolors
set guicursor=a:blinkon0
endif
colorscheme dark
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugins
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
filetype off
call plug#begin('~/.vim/plugged')
" Linting
Plug 'w0rp/ale'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
" Completion
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/neco-syntax'
Plug 'wokalski/autocomplete-flow', { 'for': 'javascript' }
Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern', 'for': 'javascript' }
Plug 'Shougo/neosnippet'
Plug 'zchee/deoplete-jedi'
Plug 'Shougo/neosnippet-snippets'
" General
Plug 'chriskempson/base16-vim' "Color Scheme
Plug 'ctrlpvim/ctrlp.vim' "Fuzzy Find
Plug 'dkprice/vim-easygrep' "Instant grep across files
Plug 'easymotion/vim-easymotion' "Fast movement
Plug 'jeetsukumaran/vim-buffergator' "Buffer management
Plug 'jiangmiao/auto-pairs' "Close pairs
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } "NerdTree
Plug 'tpope/vim-commentary' "File-specific commenting
Plug 'tpope/vim-surround' "Handle surrounds
Plug 'vim-airline/vim-airline' "Airline bar
Plug 'vim-airline/vim-airline-themes' "Make airline pretty
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim' "Fuzzy finder
" Plug 'vim-scripts/paredit.vim', {'for': 'clojure'} "Lisp balance
" Javascript - need to be in order
Plug 'pangloss/vim-javascript', {'for': ['javascript', 'reason']}
Plug 'reasonml-editor/vim-reason-plus', {'for': ['reason']}
Plug 'mxw/vim-jsx', {'for': ['javascript', 'reason']}
Plug 'alvan/vim-closetag', {'for': ['html', 'vue', 'javascript', 'reason']}
" Filetype Plugins
Plug 'fatih/vim-go', {'for': 'go'}
Plug 'hdima/python-syntax', {'for': 'python'}
Plug 'jparise/vim-graphql', {'for': 'graphql'}
Plug 'neovimhaskell/haskell-vim', {'for': 'haskell'}
Plug 'rust-lang/rust.vim', {'for': 'rust'}
" Plug 'derekwyatt/vim-scala', {'for': 'scala'}
" Plug 'elixir-lang/vim-elixir', {'for': 'elixir'}
" Plug 'keith/swift.vim', {'for': 'swift'}
" Plug 'udalov/kotlin-vim', {'for': 'kotlin'}
" Plug 'guns/vim-clojure-static', {'for': 'clojure'}
call plug#end()
filetype plugin indent on
syntax on
" END Plug
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set autoindent "Enable automatic indentation
set backspace=indent,eol,start "Adaptive backspace
set cb=unnamed "Use global clipboard
set cc=0 "Color column (off by default, 80 for python, etc)
set copyindent "Copy indentation
set expandtab "Use spaces for tabs
set hlsearch "Highlight search
set ignorecase "Case insensitive search
set laststatus=2 "Always show airline
set mouse=a "Respond to mouse
set noerrorbells "Don't beep
set nostartofline "Keep cursor in place when switching buffers
set novisualbell "No annoying flashing
set ruler "Adds line numbers and distance to airline
set shiftround "Tab half-indented to the next tabstop
set shiftwidth=2 "Default indentation
set shortmess+=c "Avoid unnecessary messages
set sidescrolloff=0 "Don't scroll horizontally
set smartcase "Use case in search if caps is used
set smarttab "Use semantic tabs
set softtabstop=2 "Pretend spaces are tabs
set t_vb= "Disable visual bell
set tabstop=2 "Default tab width
set vb "Disable visual bell
set wildignore=.DS_Store,node_modules,bower_components "Ignore for CtrlP
set wrap "Wrap long lines
set backupcopy=yes " Fix for bucklescript
" Fix some shiftwidths
autocmd Filetype haskell set shiftwidth=4
autocmd Filetype go set shiftwidth=4
"Variables
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Ale (linting and error checking)
let g:ale_javascript_eslint_executable = 'eslint_d' "Faster implementation
let g:ale_lint_on_text_changed="normal" "Lint on normal mode
let g:ale_reason_ols_executable = '/usr/local/bin/reason-language-server'
let g:ale_linters = {
\ 'javascript': ['flow', 'eslint'],
\ 'python': ['pyflakes'],
\ 'reason': ['ols'],
\}
let g:ale_fixers = {
\ 'javascript': ['eslint', 'prettier'],
\ 'reason': ['refmt'],
\ 'python': ['autopep8'],
\}
let g:ale_fix_on_save = 1
" Airline
let g:airline_theme='bubblegum'
let g:airline#extensions#ale#enabled = 1
" Buffergator
let g:buffergator_display_regime = "parentdir"
let g:buffergator_expand_on_split = 0
" vim-javascript conceal
let g:javascript_conceal_function = "ƒ"
let g:javascript_conceal_null = "ø"
let g:javascript_conceal_this = "#"
let g:javascript_conceal_return = "⇚"
let g:javascript_conceal_arrow_function = "⇒"
let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.js,*.jsx,*.re,*.xml,*.vue"
let g:haskell_indent_in = 0
let g:NERDTreeQuitOnOpen = 1
let g:jsx_ext_required = 0
let g:javascript_plugin_flow = 1
" Match Tag Always (close HTML tags)
let g:mta_filetypes = {
\ 'html' : 1,
\ 'xhtml' : 1,
\ 'xml' : 1,
\ 'jinja' : 1,
\ 'javascript' : 1,
\ 'reason' : 1,
\ 'javascript.jsx' : 1,
\}
let g:LanguageClient_serverCommands = {
\ 'ocaml': ['ocaml-language-server', '--stdio'],
\ 'rust': ['rustup', 'run', 'nightly', 'rls'],
\ 'reason': ['/usr/local/bin/reason-language-server'],
\ }
"'python': ['/usr/local/bin/pyls'],
"'javascript': ['javascript-typescript-stdio'],
" Use Platinum Searcher Grep, CtrlP, etc
if executable('pt')
" Use pt over grep
set grepprg=pt\ --nogroup\ --nocolor
" Use pt in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'pt %s -l --nocolor -g ""'
" pt is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Keyboard mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader = "\<Space>"
nnoremap <Leader>[ :BuffergatorMruCyclePrev<CR>
nnoremap <Leader>] :BuffergatorMruCycleNext<CR>
nnoremap <Leader>b :BuffergatorOpen<CR>
nnoremap <Leader>c :ALEToggle<CR>
nnoremap <Leader>d :NERDTreeToggle<CR>
nnoremap <Leader>f :Grep<space>
nnoremap <Leader>g :CtrlPBuffer<CR>
nnoremap <Leader>h :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=1"<CR>
nnoremap <Leader>j :ALENextWrap<CR>
nnoremap <Leader>k :ALEPreviousWrap<CR>
nnoremap <Leader>o :CtrlP<CR>
"nnoremap <Leader>p "+p
nnoremap <Leader>q :q<CR>
nnoremap <Leader>r :ALEFix<CR>
nnoremap <Leader>s :w<CR>
nnoremap <Leader>w <C-W><C-W>
"vnoremap <Leader>y "+y
imap jk <Esc>
" Language Client
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
" Autocomplete
let g:deoplete#enable_at_startup = 1
let g:neosnippet#enable_completed_snippet = 1
inoremap <expr><Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Fixes
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" https://github.com/jiangmiao/auto-pairs/issues/187
autocmd VimEnter,BufEnter,BufWinEnter * silent! iunmap <buffer> <M-">
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"GUI stuffs
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("gui_vimr")
nnoremap <D-S-}> :tabnext<CR>
nnoremap <D-S-{> :tabprevious<CR>
endif
Figured it out.
This line in my .vimrc wasn't working:
let g:ale_reason_ols_executable = '/usr/local/bin/reason-language-server'
ALE tacks on the --stdio option, which ocaml-language-server requires. This isn't accepted by reason-language-server. It's not just ignored, but the language server doesn't run at all. I was able to get it working by creating a shell script to call reason-language-server that ignored the extra parameter. Essentially this:
#!/bin/bash
reason-language-server
With that change, ALE now lints properly, and I've removed the extra LanguageClient plugin. To the best of my knowledge ALE interacting with the reason-language-server (or ocaml-language-server) and LanguageClient provide the exact same information. They both provide whatever the language-server tells them. I don't mean to misrepresent either project, but the detail and capabilities on both plugins seems to be identical--they're just provided through a slightly different UI. Once I move rust over to ALE, I should have the same UI, hotkeys, etc, across all languages.
On the off chance either developer ever sees this SO, both projects are fantastic, and I appreciate the effort in making VIM an effective, full-featured IDE.
When I run vim . to open up a folder I get the following error:
Error detected while processing VimEnter Auto commands for "*":
E492: Not an editor command: NERDTree .
Press ENTER or type command to continue
I don't understand where this is coming from since everything was working fine. I then tried adding other plugins and then the error was thrown. However I have NERDTree in my ~/.vimrc file. Here is what the file looks like.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:plug_shallow = 0 " disable shallow cloning
call plug#begin()
Plug 'airblade/vim-gitgutter' " shows a git diff in the gutter
Plug 'altercation/vim-colors-solarized' " precision colorscheme
Plug 'godlygeek/tabular' " text filtering and alignment
Plug 'janko-m/vim-test' " test runner
Plug 'phallstrom/vim-sailfish'
Plug 'scrooloose/nerdtree' " tree explorer
Plug 'sjl/gundo.vim' " graph your vim undo tree
Plug 'tpope/vim-commentary' " comment stuff out
Plug 'tpope/vim-endwise' " wisely add 'end' in ruby, endfunction/endif/more in vim script, etc
Plug 'tpope/vim-fugitive' " git wrapper
Plug 'tpope/vim-rails', { 'for': ['ruby'] } " ruby on rails power tools
Plug 'vim-ruby/vim-ruby', { 'for': ['ruby'] } " vim/ruby configuration
Plug 'tpope/vim-projectionist' " project configuration (file jumping)
Plug 'kana/vim-textobj-user' " create your own text objects
Plug 'nelstrom/vim-textobj-rubyblock' " custom text object for selecting ruby blocks
Plug 'tpope/vim-surround' " quoting/parenthesizing made simple
Plug 'chriskempson/base16-vim' " color schemes, https://chriskempson.github.io/base16/
Plug 'w0rp/ale' " asynchronous lint engine
Plug 'editorconfig/editorconfig-vim' " editorConfig plugin
Plug 'vim-airline/vim-airline' " status/tabline
Plug 'vim-airline/vim-airline-themes' " status/tabline themes
Plug 'pangloss/vim-javascript' " Javascript syntax
Plug 'mxw/vim-jsx' " react jsx syntax
Plug 'posva/vim-vue', { 'for': ['vue'] } " Vue.js syntax
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim' " A command-line fuzzy finder written in Go
Plug 'kien/rainbow_parentheses.vim', { 'for': ['clojure'] } " Better Rainbow Parentheses
Plug 'guns/vim-clojure-static', { 'for': ['clojure'] } " Meikel Brandmeyer's excellent Clojure runtime files
Plug 'tpope/vim-unimpaired' " pairs of handy bracket mappings
Plug 'tpope/vim-abolish' " easily search for, substitute, and abbreviate multiple variants of a word
Plug 'mechatroner/rainbow_csv' " highlighting columns in csv/tsv files
Plug 'slim-template/vim-slim' " slim syntax highlighting for vim
call plug#end()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set t_Co=256
set nocompatible " We're running Vim, not Vi!
set synmaxcol=500 " don't try to highlight long lines
compiler ruby " Enable compiler support for ruby
filetype plugin on
set background=dark
colorscheme default
set backspace=2
set expandtab
set tabstop=2 shiftwidth=2 softtabstop=2
set autoindent
set nowrap
set nrformats=
set backupdir=$HOME/.vimbackup,.
set directory=$HOME/.vimswap,.
au FocusLost * :wa
set ignorecase
set smartcase
set scrolloff=2
set ttyfast
set hidden
set wildmenu
set wildmode=list:longest
nnoremap <leader>nt :NERDTreeToggle<enter>
source $VIMRUNTIME/macros/matchit.vim
" fzf
nnoremap <silent> <C-p> :Files<CR>
nnoremap <silent> <Leader>b :Buffers<CR>
" https://github.com/tpope/vim-commentary/commit/4dcfc318e0b02fdbb0c2d9ff77cf3562b46eea25
xmap \\ <Plug>Commentary
nmap \\ <Plug>Commentary
set updatetime=250
nmap <silent> <leader>s :TestNearest<CR>
nmap <silent> <leader>t :TestFile<CR>
nmap <silent> <leader>T :TestSuite<CR>
set mouse=a
vnoremap <Leader>c "*y
noremap <Leader>v "*p
set nofixeol
set formatoptions+=j " Delete comment character when joining commented lines
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g'\"" | endif
let g:omni_sql_no_default_maps = 1 " disable SQL autocompletion entirely
" To ensure that EditorConfig plugin works well with Tim Pope's fugitive
let g:EditorConfig_exclude_patterns = ['fugitive://.*']
" ALE - Asynchronous Lint Engine
let g:ale_lint_on_enter = 0 " no checks on open
let g:ale_lint_on_save = 1 " check on save
let g:ale_lint_on_text_changed = 1 " check on text change
let g:ale_lint_delay = 300 " millisecond delay before checking
" Airline
let g:airline_theme = 'base16' " theme
set laststatus=2 " always show airline
set noshowmode " hide default mode indicator
let g:airline_powerline_fonts = 1 " use powerline font
let g:airline#extensions#wordcount#enabled = 0 " disable word counting
let g:airline#extensions#whitespace#enabled = 0 " disable detection of whitespace errors
" Rubocop
let g:vimrubocop_config = '/path/to/rubocop.yml'
if filereadable($HOME."/.vimrc_local")
source $HOME/.vimrc_local
endif
let g:jsx_ext_required = 0 " JSX syntax in .js files
" open file splits in vsplit by default
:nnoremap <C-W>f :vertical wincmd f<CR>
" https://github.com/posva/vim-vue#how-can-i-use-existing-configurationplugins-in-vue-files
" autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css
au FileType clojure exe "RainbowParenthesesLoadRound" | RainbowParenthesesActivate
" open NERDTree automatically when vim starts up on opening a directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
" https://github.com/slim-template/vim-slim/issues/38#issuecomment-23760100
autocmd BufNewFile,BufRead *.slim setlocal filetype=slim
I re-installed NERDTree but however I still that error.
This question already has answers here:
error while running "source .vimrc"
(2 answers)
Closed 4 years ago.
I'm trying to configured Vim. However when I try to source .vimrc after having edit the file I get the following error:
$ source ~/.vimrc
-bash: let g:plug_shallow = 0 : command not found
-bash: /Users/stevenaguilar/.vimrc: line 4: syntax error near unexpected token ('
-bash: /Users/stevenaguilar/.vimrc: line 4:call plug#begin()'
I don't understand where is this error coming from. It throws the error on line call plug#begin() which is closed. Here is the full .vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:plug_shallow = 0 " disable shallow cloning
call plug#begin()
Plug 'airblade/vim-gitgutter' " shows a git diff in the gutter
Plug 'altercation/vim-colors-solarized' " precision colorscheme
Plug 'godlygeek/tabular' " text filtering and alignment
Plug 'janko-m/vim-test' " test runner
Plug 'phallstrom/vim-sailfish'
Plug 'scrooloose/nerdtree' " tree explorer
Plug 'sjl/gundo.vim' " graph your vim undo tree
Plug 'tpope/vim-commentary' " comment stuff out
Plug 'tpope/vim-endwise' " wisely add 'end' in ruby, endfunction/endif/more in vim script, etc
Plug 'tpope/vim-fugitive' " git wrapper
Plug 'tpope/vim-rails', { 'for': ['ruby'] } " ruby on rails power tools
Plug 'vim-ruby/vim-ruby', { 'for': ['ruby'] } " vim/ruby configuration
Plug 'tpope/vim-projectionist' " project configuration (file jumping)
Plug 'kana/vim-textobj-user' " create your own text objects
Plug 'nelstrom/vim-textobj-rubyblock' " custom text object for selecting ruby blocks
Plug 'tpope/vim-surround' " quoting/parenthesizing made simple
Plug 'chriskempson/base16-vim' " color schemes, https://chriskempson.github.io/base16/
Plug 'w0rp/ale' " asynchronous lint engine
Plug 'editorconfig/editorconfig-vim' " editorConfig plugin
Plug 'vim-airline/vim-airline' " status/tabline
Plug 'vim-airline/vim-airline-themes' " status/tabline themes
Plug 'pangloss/vim-javascript' " Javascript syntax
Plug 'mxw/vim-jsx' " react jsx syntax
Plug 'posva/vim-vue', { 'for': ['vue'] } " Vue.js syntax
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim' " A command-line fuzzy finder written in Go
Plug 'kien/rainbow_parentheses.vim', { 'for': ['clojure'] } " Better Rainbow Parentheses
Plug 'guns/vim-clojure-static', { 'for': ['clojure'] } " Meikel Brandmeyer's excellent Clojure runtime files
Plug 'tpope/vim-unimpaired' " pairs of handy bracket mappings
Plug 'tpope/vim-abolish' " easily search for, substitute, and abbreviate multiple variants of a word
Plug 'mechatroner/rainbow_csv' " highlighting columns in csv/tsv files
Plug 'slim-template/vim-slim' " slim syntax highlighting for vim
call plug#end()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set t_Co=256
set nocompatible " We're running Vim, not Vi!
set synmaxcol=500 " don't try to highlight long lines
compiler ruby " Enable compiler support for ruby
filetype plugin on
set background=dark
colorscheme base16-oceanicnext
set backspace=2
set expandtab
set tabstop=2 shiftwidth=2 softtabstop=2
set autoindent
set nowrap
set nrformats=
set backupdir=$HOME/.vimbackup,.
set directory=$HOME/.vimswap,.
au FocusLost * :wa
set ignorecase
set smartcase
set scrolloff=2
set ttyfast
set hidden
set wildmenu
set wildmode=list:longest
nnoremap <leader>nt :NERDTreeToggle<enter>
source $VIMRUNTIME/macros/matchit.vim
" fzf
nnoremap <silent> <C-p> :Files<CR>
nnoremap <silent> <Leader>b :Buffers<CR>
" https://github.com/tpope/vim-commentary/commit/4dcfc318e0b02fdbb0c2d9ff77cf3562b46eea25
xmap \\ <Plug>Commentary
nmap \\ <Plug>Commentary
set updatetime=250
nmap <silent> <leader>s :TestNearest<CR>
nmap <silent> <leader>t :TestFile<CR>
nmap <silent> <leader>T :TestSuite<CR>
set mouse=a
vnoremap <Leader>c "*y
noremap <Leader>v "*p
set nofixeol
set formatoptions+=j " Delete comment character when joining commented lines
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g'\"" | endif
let g:omni_sql_no_default_maps = 1 " disable SQL autocompletion entirely
" To ensure that EditorConfig plugin works well with Tim Pope's fugitive
let g:EditorConfig_exclude_patterns = ['fugitive://.*']
" ALE - Asynchronous Lint Engine
let g:ale_lint_on_enter = 0 " no checks on open
let g:ale_lint_on_save = 1 " check on save
let g:ale_lint_on_text_changed = 1 " check on text change
let g:ale_lint_delay = 300 " millisecond delay before checking
" Airline
let g:airline_theme = 'base16' " theme
set laststatus=2 " always show airline
set noshowmode " hide default mode indicator
let g:airline_powerline_fonts = 1 " use powerline font
let g:airline#extensions#wordcount#enabled = 0 " disable word counting
let g:airline#extensions#whitespace#enabled = 0 " disable detection of whitespace errors
if filereadable($HOME."/.vimrc_local")
source $HOME/.vimrc_local
endif
let g:jsx_ext_required = 0 " JSX syntax in .js files
" open file splits in vsplit by default
:nnoremap <C-W>f :vertical wincmd f<CR>
" https://github.com/posva/vim-vue#how-can-i-use-existing-configurationplugins-in-vue-files
" autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css
au FileType clojure exe "RainbowParenthesesLoadRound" | RainbowParenthesesActivate
" open NERDTree automatically when vim starts up on opening a directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
" https://github.com/slim-template/vim-slim/issues/38#issuecomment-23760100
autocmd BufNewFile,BufRead *.slim setlocal filetype=slim
It looks like you're sourcing your .vimrc from bash. It's not a bash script. Instead, you should source it from inside Vim:
:source ~/.vimrc
:source $MYVIMRC
Or just restart Vim.
It looks like you are trying to source your .vimrc from bash as you would your .bashrc, but this is a vim-specific settings file. vim will naturally source your .vimrc when you run it, if it is in the right place in your path (which it seems to be based on the error message).
If you are already in vim and have made some changes to the .vimrc or wish to load another one, you can source it from within vim by going into command mode and calling source
:source ~/.vimrc