junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
33.7k stars 1.9k forks source link

vim-plug possibly breaks vim's default [[ and ]] commands #1239

Closed chocopie closed 4 months ago

chocopie commented 1 year ago

Having vim-plug running seems to coincide with vim's default [[ and ]] (jump to start/end of file) commands not working, though gg and G still work fine.

I wasn't able to find any reference to this in the Issues or FAQ, but I feel I can't be the only one running into this problem.

How I tested this to make sure it wasn't another plugin like goyo.vim and limelight.vim:

  1. Verified with vim -u NONE to check that the default commands actually do work. They do.
  2. Removed references to goyo.vim and limelight.vim from my .vimrc, and tested against -u NONE. Running with the vim-plug calls in my .vimrc breaks[1] the default commands.
  3. Ran :PlugClean to delete the goyo.vim and limelight.vim files, and tested against -u NONE. Same results as #2.
  4. Removed vim-plug calls in .vimrc and tested against -u NONE. Default commands work in both.

Does vim-plug regard [ and ] as reserved characters? Does pressing it once trigger some special listening process that makes it not recognise the next keypress? Sorry, I'm not super technical, and am not sure how to go about diagnosing and fixing this from here, but I hope this info is useful to someone smarter? 🙏

In case it matters, I tested with Terminal Vim 9.0.1023 on OSX Monterey and Terminal Vim 9.0.1182 on Linux (Manjaro).

[1] Sometimes it works but you have to mash the parentheses key a few times, or press the key once and count to three before pressing again. Other times the keys don't register at all.

junegunn commented 4 months ago

vim's default [[ and ]] (jump to start/end of file)

[[ and ]] don't jump to start/end of the file, instead they jump the cursor to the previous/next "section". (See :help [[)

As noted in https://github.com/junegunn/vim-plug?tab=readme-ov-file#usage, vim-plug runs filetype plugin indent on and it effectively loads the definition of a "section" for each file type, and [[ and ]] starts working as expected (section-aware).