olimorris / persisted.nvim

💾 Simple session management for Neovim with git branching, autoloading and Telescope support
MIT License
437 stars 26 forks source link

fix: prevent autoloading when there are extra command line arguments passed to nvim #76

Closed uyha closed 1 year ago

uyha commented 1 year ago

When nvim is used as a man pager with export MANPAGER='nvim +Man! ', with autoload set to true, persisted.nvim still autoloads the current directory which is not desirable

olimorris commented 1 year ago

Amazing, thank you!

utkarshgupta137 commented 1 year ago

This has broken autoloading when using neovim with nix. This is how nix wraps neovim: exec -a "$0" "/nix/store/j7qzl35ha3bi0wpgll37ayfz9fisik3s-neovim-unwrapped-0.9.1/bin/nvim" --cmd "lua vim.g.node_host_prog='/nix/store/ya3l2i6bbadd278brh1j0cbpmqzyfml0-neovim-0.9.1/bin/nvim-node';vim.g.loaded_python_provider=0;vim.g.python 3_host_prog='/nix/store/ya3l2i6bbadd278brh1j0cbpmqzyfml0-neovim-0.9.1/bin/nvim-python3';vim.g.ruby_host_prog='/nix/store/ya3l2i6bbadd278brh1j0cbpmqzyfml0-neovim-0.9.1/bin/nvim-ruby'" "$@"

olimorris commented 1 year ago

@utkarshgupta137 thanks for pointing this out! I've reverted this fix for now.

@uyha - We'll need to think of another way for this to work

uyha commented 1 year ago

how about checking for either +Man! or -c Man! is in the vim.v.argv?

utkarshgupta137 commented 1 year ago

@utkarshgupta137 thanks for pointing this out! I've reverted this fix for now.

@uyha - We'll need to think of another way for this to work

I'd be happy to test any alternative versions.

zhengpd commented 6 months ago

Any update on this? I'm trying to figure out how to use MANPAGER and autoload together.

mbwilding commented 1 month ago

@zhengpd

autoload = not vim.tbl_contains(vim.v.argv, "+Man!")