lucc / nvimpager

Use nvim as a pager to view manpages, diffs, etc with nvim's syntax highlighting
Other
372 stars 20 forks source link

Problems with vim plug #8

Closed GordianDziwis closed 5 years ago

GordianDziwis commented 5 years ago

Should not nvimpager use its own config?

Error detected while processing /home/XXX/.config/nvim/init.vim:
line    5:
E117: Unknown function: plug#begin
line    7:
lucc commented 5 years ago

Which version of nvimpager are you using? What is in the config file ~/.config/nvimpager/init.vim? Is it a symlink?

GordianDziwis commented 5 years ago

NVIM is v0.3.2-dev and nvimpager is current develop. The config file does not exist.

lucc commented 5 years ago

Yes nvimpager should use its own config file. What do you see if you execute bash -x ./nvimpager some-file?

olalonde commented 5 years ago

Having same issue.

lucc commented 5 years ago

Then I have the same questions (and more) for you:

cjbassi commented 5 years ago

I'm guessing that we need to source the vim-plug file, and more generally, any file in vim's autoload folder. For me vim-plug is location is at: ~/.local/share/nvim/site/autoload/plug.vim

lucc commented 5 years ago

@cjbassi I think I found your issue. Can you try the branch fix/issue-8? You will have to clone the repository but you can run nvimpager directly from there: PAGER=~/where/ever/nvimpager.

I assume the errors will go away with this but nvimpager might not yet load you default nvim settings because: You said you symlinked ~/.config/nvim/init.vim to itself, that sounds strange. And the debug output suggests that there is no file /home/cjbassi/.config/nvimpager/init.vim because of these two lines

+ [[ ! -r /home/cjbassi/.config/nvimpager/init.vim ]]
+ rc=

compare https://github.com/lucc/nvimpager/blob/3bb4f16d8faca76715d4c39d8bc8eb5199476c39/nvimpager#L64-L65

If you really want to use the default nvim settings with nvimpager (I don't do it because I do not need all these plugins in nvimpager) you should probably symlink ~/.config/nvimpager to ~/.config/nvim and not just the init file itself.

lucc commented 5 years ago

@BonaBeavis the branch fix/issue-8 might also solve the problem for you. Can you try it?

cjbassi commented 5 years ago

Thanks for the quick response. Few things:

Running nvimpager from the fix/issue-8 branch doesn't error anymore, but it loads with default neovim settings I think.

Symlinking ~/.config/nvimpager to ~/.config/nvim causes the errors to appear again when running nvimpager from the fix/issue-8 branch.

Also, my init.vim file isn't symlinked to itself, although it may look like it, because there's a dot in front of the config folder in the first path but not the second :D

Thanks!

lucc commented 5 years ago

@cjbassi Sorry I missed that dot. I have the following questions/assumptions, maybe you can answer and confirm or reject them:

  1. You do not have a file ~/.config/nvimpager/init.vim
  2. Do you want nvimpager to load it's own (some special) config or your default init.vim or the neovim defaults?
  3. The fact that nvimpager can not find the vim-plug functions when you symlink the whole directory is strange. I am wondering where these are installed and how you add them to the &rtp. If I symlink the whole folder I don't get errors (and I also use vim-plug). So:
  4. Where is the vim plug file installed and how do you load it in your ~/.config/nvim/init.vim?
  5. Do you have $IMINIT or $EXINIT set in your environment? To what value?
cjbassi commented 5 years ago
  1. Correct.
  2. That's a good question. Personally, I would like to end up using my default init.vim but I'm not sure if nvimpager should default to that or not.
  3. vim-plug is installed to ~/.local/share/nvim/site/autoload/plug.vim. I don't do anything explicit in my init.vim to load it. I assume it's loaded automatically by neovim since it's located in the autoload folder.
  4. Neither of those are set in my environment.

Do you have vim-plug installed to the same place as me?

lucc commented 5 years ago
  1. Nvimpager will not default to the same init.vim file as nvim. That is a design desicion and will not change.
  2. (arg markdown lists with automatic numbering)
  3. nvimpager replaces all the user .../nvim/... folders with a .../nvimpager/... counterpart. So if you symlink both ~/.config/nvimpager -> ~/.config/nvim and ~/.local/share/nvimpager/site -> ~/.local/share/nvim/site it should work. Can you confirm that?
  4. no I have installed it to ~/.local/share/nvim/plugins/vim-plug where all the other plugins are. I add this folder to the &rtp in my init.vim.
lucc commented 5 years ago

I just checked the man page and it already documents these folders. Was the manpage of any help or should it be rewritten?

cjbassi commented 5 years ago

Cool that makes sense. So I symlinked both the .config and the .local/share folder and now it loads my settings, so things are working as expected now! Thanks!

The man page looks good, if you want you could maybe mention how to load the the default init.vim file by setting up symlinks since that might be a common thing.

So I've run into a new issue where running nvimpager on a file that is too long to print to stdout causes neovim to load the file and display it correctly, but it becomes unresponsive as soon as I press either the j or k keys and I have to force quit the application. All other movement commands work fine, but not those two. If you want I could make an new Issue for this.

cjbassi commented 5 years ago

So it turns out that having

nmap <silent> j gj
nmap <silent> k gk

was causing the issue, although I'm not sure why.

Edit: changing nmap to nnoremap fixed it!

lucc commented 5 years ago

I think this is resolved by 836962f. If anybody has trouble when trying to use the default nvim config files please read https://github.com/lucc/nvimpager/blob/develop/nvimpager.md#CONFIGURATION before reporting.