{"action":"created","issue":{"url":"https://api.github.com/repos/junegunn/vim-plug/issues/327","labels_url":"https://api.github.com/repos/junegunn/vim-plug/issues/327/labels{/name}","comments_url":"https://api.github.com/repos/junegunn/vim-plug/issues/327/comments","events_url":"https://api.github.com/repos/junegunn/vim-plug/issues/327/events","html_url":"https://github.com/junegunn/vim-plug/issues/327","id":118869047,"number":327,"title":"plug#load(\"some-plugin\") fires BufReadPost event","user":{"login":"khalidchawtany","id":1681606,"avatar_url":"https://avatars.githubusercontent.com/u/1681606?v=3","gravatar_id":"","url":"https://api.github.com/users/khalidchawtany","html_url":"https://github.com/khalidchawtany","followers_url":"https://api.github.com/users/khalidchawtany/followers","following_url":"https://api.github.com/users/khalidchawtany/following{/other_user}","gists_url":"https://api.github.com/users/khalidchawtany/gists{/gist_id}","starred_url":"https://api.github.com/users/khalidchawtany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khalidchawtany/subscriptions","organizations_url":"https://api.github.com/users/khalidchawtany/orgs","repos_url":"https://api.github.com/users/khalidchawtany/repos","events_url":"https://api.github.com/users/khalidchawtany/events{/privacy}","received_events_url":"https://api.github.com/users/khalidchawtany/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/junegunn/vim-plug/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-11-25T16:08:11Z","updated_at":"2015-11-27T16:52:37Z","closed_at":null,"body":"Calling load manually fires **BufReadPost** event. This alone may not be a problem. However, combined with the following it is. It may fire other events I may not be aware of, since sometimes the cursor moves to places that are not defined by the ```'\"``` register.\r\n\r\nI have the following in my **init.vim**\r\n``` vim\r\n\"restore cursor position\r\nau BufReadPost *\r\n      \\ if line(\"'\\\"\") > 0 && line(\"'\\\"\") <= line(\"$\") |\r\n      \\     execute 'normal! g`\"zvzz' |\r\n      \\ endif\r\n```\r\n\r\nIs this intentional? How can I prevent this?\r\n\r\n\r\nminimal **init.vim** to reproduce\r\n```vim\r\ncall plug#begin('~/.config/nvim/plugged')\r\n\r\n  Plug 'kana/vim-textobj-user'   \" Any plugin\r\n  \"Plug 'kana/vim-textobj-user', {'on': []} \"The same as above\r\n\r\ncall plug#end()\r\nau BufReadPost * echo \"BufReadPost Fired\"\r\n```\r\nJust execute the following:\r\n```:call plug#load('vim-textobj-user')```"},"comment":{"url":"https://api.github.com/repos/junegunn/vim-plug/issues/comments/160174323","html_url":"https://github.com/junegunn/vim-plug/issues/327#issuecomment-160174323","issue_url":"https://api.github.com/repos/junegunn/vim-plug/issues/327","id":160174323,"user":{"login":"junegunn","id":700826,"avatar_url":"https://avatars.githubusercontent.com/u/700826?v=3","gravatar_id":"","url":"https://api.github.com/users/junegunn","html_url":"https://github.com/junegunn","followers_url":"https://api.github.com/users/junegunn/followers","following_url":"https://api.github.com/users/junegunn/following{/other_user}","gists_url":"https://api.github.com/users/junegunn/gists{/gist_id}","starred_url":"https://api.github.com/users/junegunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/junegunn/subscriptions","organizations_url":"https://api.github.com/users/junegunn/orgs","repos_url":"https://api.github.com/users/junegunn/repos","events_url":"https://api.github.com/users/junegunn/events{/privacy}","received_events_url":"https://api.github.com/users/junegunn/received_events","type":"User","site_admin":false},"created_at":"2015-11-27T16:52:37Z","updated_at":"2015-11-27T16:52:37Z","body":"@vheon is correct. File type detection by convention is performed on `BufRead` event. So if we don't fire it, filetype-specific plugin that we load with the function will not be activated immediately for the current buffer, until we \"reopen\" it with something like `:e` command.\r\n\r\nIf you see the output of `:autocmd BufRead`, you'll also notice that `BufRead` event is usually used for setting up the plugin state for the current buffer. e.g. fugitive, signify, etc. So I figured that it would be beneficial for most users that `plug#load` triggers the event, though the approach is a little crude and can have unwanted side effects like you experienced.\r\n\r\nYou can suppress the event with `:silent noautocmd call plug#load('vim-textobj-user')`."}}