bogado / file-line

Plugin for vim to enabling opening a file in a given line
http://www.vim.org/scripts/script.php?script_id=2184
299 stars 61 forks source link

keep other autocmds, 'autocmd! -> autocmd' #60

Closed robinro closed 8 years ago

robinro commented 8 years ago

Maybe I'm missing something that needs autocmd!, but in my setup it's not needed and will fix the bug in #47

joe-skb7 commented 8 years ago

+1. Should be merged. It allows me to fix (with another additional patch) the issue #61.

robinro commented 8 years ago

@joe-skb7 glad this helps you! What other patch is needed?

joe-skb7 commented 8 years ago

@robinro Thanks for your patches! They fixed almost all issues I was suffering from. The last issue I have is described at #61.

Basically I tend to check some quick ideas quite often. To do that I'm creating new main.c file and put some code in it. I don't want to write boilerplate code each time though, so I created ~/.vim/skeleton/template.c file with boilerplate, like that:

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    return EXIT_SUCCESS;
}

And added next line into my ~/.vimrc:

au BufNewFile main.c silent! 0r ~/.vim/skeleton/template.c

Now when I'm creating new main.c file with vim, like that:

vim main.c

I have template code added to it instantaneously.

But the problem is that this trick doesn't work when file-line plugin is in use. I managed to workaround this issue with your patch plus my hacky change to the plugin. The change is described at #61 as well. I even forked this project and added 2 of your patches and my workaround: https://github.com/joe-skb7/file-line . And my workaround is here: https://github.com/joe-skb7/file-line/commit/6108b56cec1c2c1d75dc0080e6757c2d393016c6

I'm not really good with vim script language, so this hack is only thing I came up with, sorry :( If you could find a proper solution to this issue and write production-ready patch -- I would be really happy, though :)

It would be also great if you can pull your pending changes to your forked file-line project, so everybody can use it instead of this original one (seems like it's dead in the water, probably author abandoned it).

Thanks!

UPDATE

@robinro I see your patches are merged now. Thanks @bogado !

robinro commented 8 years ago

@joe-skb7 sorry for closing #61 too quickly. I'll put #62 on my agenda for next week.

Thanks @bogado for merging.