itchyny / vim-cursorword

Underlines the word under the cursor
http://www.vim.org/scripts/script.php?script_id=5100
MIT License
611 stars 36 forks source link

The plugin does not work without plugin manager. #33

Closed real-bird-kun closed 1 year ago

real-bird-kun commented 1 year ago

Hi, recently I found this useful plugin and try to use it. Thank you for this amazing work.

But I had a little problem. When I installed the plugin with plugin manager, it works normally. But when I try to install and use this plugin with my .vimrc as follows, the plugin does not work and report error. I have already moved the "cursorword.vim" to the plugin folder manually.

source ~/.vim/plugin/cursorword.vim
let g:cursorword = 1 
let g:cursorword_highlight = 0 
let g:cursorword_delay = 0 
hi CursorWord0 ctermbg=lightgrey guibg=lightgrey term=none cterm=none gui=none
hi CursorWord1 ctermbg=lightgrey guibg=lightgrey term=none cterm=none gui=none

The error info is:

Error detected while processing CursorMoved Autocommands for "*":                                                                                    
E117: Unknown function: cursorword#cursormoved

Would you please help me out? Thank you ;)

itchyny commented 1 year ago

The autoload/cursorword.vim file is also required.

real-bird-kun commented 1 year ago

Hi, thank you for your reply.

I already have moved the autoload/cursorword.vim file to the corresponding folder and add source ~/.vim/autoload/cursorword.vim to my .vimrc.

And the plugin can work as expected. However, when I edit files with vim, there is error info as follows:

error detect while processing autoload/cursorword.vim:
line 66: E121: undefined variable: s:save_cpo
E15: invalid expression:s:save_cpo
Press Enter or type command to continue
itchyny commented 1 year ago

Do not source the plugin files. The files under ~/.vim/ are loaded automatically. Please learn the runtime path (:h runtimepath)

real-bird-kun commented 1 year ago

Thanks a lot. Everything works normally right now ; )