I'm trying to improve my neovim with plugins and the best plugin that I found is Easymotion. However, it do not start automatically. I need to do :source ~/.vimrc every time that I launch a file. How can I fix this? Other plugins need to be read only once.

Plugin manager - VimPlug. OS - RHEL8

here is my .vimrc file, and yes, I symlinked to init.vim in NeoVim. Actually, I had this problem both in Vim and Neovim.

 1 set number
 2 set expandtab
 3 set tabstop=2
 4 set incsearch
 5 call plug#begin('~/.config/nvim/plugged')
 6 Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
 7 Plug 'morhetz/gruvbox'
 8 Plug 'Valloric/YouCompleteMe'
 9 Plug 'jiangmiao/auto-pairs'
10 Plug 'tpope/vim-fugitive'
11 Plug 'airblade/vim-gitgutter'
12 Plug 'ctrlpvim/ctrlp.vim'
13 Plug 'easymotion/vim-easymotion'
14 Plug 'rking/ag.vim'
15 call plug#end()
16 map <C-n> :NERDTreeToggle<CR>
17 map <Leader> <Plug>(easymotion-prefix)
18 let g:mapleader=','
19 syntax on
20 colorscheme gruvbox
21 set background=dark
22 set rtp^=/usr/share/vim/vimfiles/

The issue you're having is that you're redefining the mapleader to , after you create a mapping using <Leader>. So your mapping is created with the default mapleader, which is \.

When you source vimrc for the second time, it will recreate that mapping, but now use the updated mapleader of , which was set on the first run of the vimrc file.

To solve the issue, simply invert the order of these two lines:

let g:mapleader=','
map <Leader> <Plug>(easymotion-prefix)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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