eclipse
eclipse

Reputation: 1

EasyMotion plugin doesn't load automatically on Vim startup in WSL Ubuntu

I am using Windows with WSL (Windows Subsystem for Linux) running Ubuntu. In my Vim setup, I have the EasyMotion plugin installed. However, the plugin does not load automatically when I start Vim. I have to manually run :PlugUpdate each time to get it working.

Here is my .vimrc file:

" Disable compatibility with vi, required
set nocompatible

" Required for plugins
filetype off

" Set leader key
let mapleader = " "

" Initialize Vim-Plug
call plug#begin('~/.vim/plugged')

" Plugins
Plug 'mileszs/ack.vim'
Plug 'dense-analysis/ale'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'sjl/gundo.vim'
Plug 'haya14busa/incsearch.vim'
Plug 'preservim/nerdtree'
Plug 'FooSoft/vim-argwrap'
Plug 'jeetsukumaran/vim-buffergator'
Plug 'easymotion/vim-easymotion'
Plug 'haya14busa/incsearch.vim'
Plug 'haya14busa/incsearch-easymotion.vim'
Plug 'tpope/vim-fugitive'
Plug 'jiangmiao/auto-pairs'  " 自动补全括号
Plug 'crusoexia/vim-monokai'
Plug 'vim-airline/vim-airline' " 状态栏显示
Plug 'junegunn/vim-easy-align' " 快速对齐

" Initialize Vim-Plug
call plug#end()

" Enable file type detection and plugins
filetype plugin indent on

" Syntax highlighting
syntax on

" CtrlP configuration
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'

" Syntax and indent
set showmatch " Show matching braces when text indicator is over them

" Highlight current line, but only in active window
augroup CursorLineOnlyInActiveWindow
    autocmd!
    autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
    autocmd WinLeave * setlocal nocursorline
augroup END

" 256 colors configuration
if has('gui_running')
    colorscheme monokai
    let g:lightline = {'colorscheme': 'monokai'}
elseif &t_Co < 256
    colorscheme monokai
    set nocursorline " Looks bad in this mode
endif

set background=dark
colorscheme monokai

" Basic editing config
set shortmess+=I " Disable startup message
set nu " Number lines
set rnu " Relative line numbering
set numberwidth=5
set virtualedit=onemore
set incsearch " Incremental search (as string is being typed)
set hls " Highlight search
set listchars=tab:>>,nbsp:~ " Set list to see tabs and non-breakable spaces
set lbr " Line break
set scrolloff=5 " Show lines above and below cursor (when possible)
set noshowmode " Hide mode
set laststatus=2
set backspace=indent,eol,start " Allow backspacing over everything
set timeout timeoutlen=1000 ttimeoutlen=100 " Fix slow O inserts
set lazyredraw " Skip redrawing screen in some cases
set autochdir " Automatically set current directory to directory of last opened file
set hidden " Allow auto-hiding of edited buffers
set history=8192 " More history
set nojoinspaces " Suppress inserting two spaces between sentences
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set ignorecase
set smartcase
set wildmode=longest,list
set wildmenu
set mouse+=a " Enable mouse mode (scrolling, selection, etc)
if &term =~ '^screen'
    set ttymouse=xterm2
endif
set nofoldenable " Disable folding by default

" Misc configurations
map <C-a> <Nop>
map <C-x> <Nop>
nmap Q <Nop>

set noerrorbells visualbell t_vb=

set splitbelow
set splitright

nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l

nnoremap <silent> <Leader>d :call ToggleMovementByDisplayLines()<CR>
function SetMovementByDisplayLines()
    noremap <buffer> <silent> <expr> k v:count ? 'k' : 'gk'
    noremap <buffer> <silent> <expr> j v:count ? 'j' : 'gj'
    noremap <buffer> 0 g0
    noremap <buffer> $ g$
endfunction
function ToggleMovementByDisplayLines()
    if !exists('b:movement_by_display_lines')
        let b:movement_by_display_lines = 0
    endif
    if b:movement_by_display_lines
        let b:movement_by_display_lines = 0
        silent! nunmap <buffer> k
        silent! nunmap <buffer> j
        silent! nunmap <buffer> 0
        silent! nunmap <buffer> $
    else
        let b:movement_by_display_lines = 1
        call SetMovementByDisplayLines()
    endif
endfunction

nnoremap <C-n> :set rnu!<CR>

command -nargs=0 Sudow w !sudo tee % >/dev/null

" Plugin configuration
nnoremap <Leader>n :NERDTreeToggle<CR>
nnoremap <Leader>f :NERDTreeFind<CR>

let g:buffergator_suppress_keymaps = 1
nnoremap <Leader>b :BuffergatorToggle<CR>

nnoremap <Leader>u :GundoToggle<CR>
if has('python3')
    let g:gundo_prefer_python3 = 1
endif

nnoremap ; :CtrlPBuffer<CR>
let g:ctrlp_switch_buffer = 0
let g:ctrlp_show_hidden = 1

command -nargs=+ Gag Gcd | Ack! <args>
nnoremap K :Gag "\b<C-R><C-W>\b"<CR>:cw<CR>
if executable('ag')
    let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
    let g:ackprg = 'ag --vimgrep'
endif

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_mode_map = {
    \ 'mode': 'passive',
    \ 'active_filetypes': [],
    \ 'passive_filetypes': []
\}
nnoremap <Leader>s :SyntasticCheck<CR>
nnoremap <Leader>r :SyntasticReset<CR>
nnoremap <Leader>i :SyntasticInfo<CR>
nnoremap <Leader>m :SyntasticToggleMode<CR>

nnoremap <Leader>w :ArgWrap<CR>

noremap <Leader>x :OverCommandLine<CR>

let g:markdown_fenced_languages = [
    \ 'asm',
    \ 'bash=sh',
    \ 'c',
    \ 'coffee',
    \ 'erb=eruby',
    \ 'javascript',
    \ 'json',
    \ 'perl',
    \ 'python',
    \ 'ruby',
    \ 'yaml',
    \ 'go',
    \ 'racket',
    \ 'haskell',
    \ 'rust',
\]
let g:markdown_syntax_conceal = 0
let g:markdown_folding = 1

set tags^=.git/tags;~

" Local customizations
let $LOCALFILE=expand("~/.vimrc_local")
if filereadable($LOCALFILE)
    source $LOCALFILE
endif

set laststatus=2
set statusline=%f\ %y\ %m
set statusline+=%{mode()}

let g:EasyMotion_do_mapping = 1
map <Leader>f <Plug>(easymotion-bd-f)
nmap <Leader>f <Plug>(easymotion-overwin-f)
nmap s <Plug>(easymotion-overwin-f2)
nmap ss <Plug>(easymotion-s2)
map <Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader>L <Plug>(easymotion-overwin-line)
map <Leader>w <Plug>(easymotion-bd-w)
nmap <Leader>w <Plug>(easymotion-overwin-w)

autocmd cursorhold * set nohlsearch

noremap n :set hlsearch<cr>n
noremap N :set hlsearch<cr>N
noremap / :set hlsearch<cr>/
noremap ? :set hlsearch<cr>?
noremap * *:set hlsearch<cr>N
map z/ <Plug>(incsearch-easymotion-/)
map z? <Plug>(incsearch-easymotion-?)
map zg/ <Plug>(incsearch-easymotion-stay)

It will cause an error if I try to use some motions.

enter image description here

I am new to Linux and Vim, and find it quite difficult to deal with it. Thanks in advance!

Upvotes: 0

Views: 36

Answers (0)

Related Questions