Live data from Hacker News

Vim Git Gutter

github.com

31–40 of 119 posts

Re: Vim Git Gutter

#32

An aside question; what's the deal with "pathogen"? I've been using the "/bin/cp" command for years installing vim plugins and it's worked remarkably well; requiring just about 1 invocation on average... What problem does that thing solve?

To elaborate on the response others have offered about everything being in one folder, I'll further note that it allows you to keep track of the plugin through git, so you can very easily grab updates when desired.

Re: Vim Git Gutter

#33
post #22
post #18

Awesome work! Cheers airblade. One nitpicky thing though, why do you use "_" and not "-" for removed lines? Can't see why you wouldn't want it vertically centered!

Removed lines happen between existing lines, so using an underscore makes it look like that. Compare: 25 - def foo(): 26 baz() With: 25 _ def foo(): 26 baz() (Where there used to be a bar() call before baz().) The first version makes it look like the `def foo():` was somehow removed.

Valid point! Can't believe it didn't occur to me ;)

Re: Vim Git Gutter

#34

An aside question; what's the deal with "pathogen"? I've been using the "/bin/cp" command for years installing vim plugins and it's worked remarkably well; requiring just about 1 invocation on average... What problem does that thing solve?

Three killer uses:

- removal - git submodules - conditional loading of plugins

Re: Vim Git Gutter

#35

Great stuff, I was using svndiff before this but it was more of a miss than a hit, this seems to work nicely so far.

It works fine, but I am unsure of what advantage it has over svndiff, which also works fine.

Re: Vim Git Gutter

#36

I've also got a similar plugin https://bitbucket.org/sirpengi/iwilldiffer that works with hg as well as git. Mine uses python though, nice to see an implementation that's all in viml. Neither of our plugins are async though (so vim ui will block while the diff is running), which is the biggest hurdle I want to cross.

As far as I know Vim is single-threaded; you can't run operations asynchronously.

Yes, but there is a way to work around that with a ton of hacks (by spawning a separate process, and polling CursorHold events). See https://github.com/troydm/shellasync.vim and a bunch of linting plugins do this too (but I can't remember them off the top of my head).

Re: Vim Git Gutter

#39

Earlier quoted context omitted.

As far as I know Vim is single-threaded; you can't run operations asynchronously.

Yes, but there is a way to work around that with a ton of hacks (by spawning a separate process, and polling CursorHold events). See https://github.com/troydm/shellasync.vim and a bunch of linting plugins do this too (but I can't remember them off the top of my head).

Or you could, e.g., use the Lua scripting extension, load one of the native threading libraries for Lua (Lua Lanes, for example) and fire away a few background tasks. Whatever actions the background tasks need to perform with the buffers you'd have to serialize, but that shouldn't be all that difficult.

Re: Vim Git Gutter

#40
post #39

Earlier quoted context omitted.

Yes, but there is a way to work around that with a ton of hacks (by spawning a separate process, and polling CursorHold events). See https://github.com/troydm/shellasync.vim and a bunch of linting plugins do this too (but I can't remember them off the top of my head).

Or you could, e.g., use the Lua scripting extension, load one of the native threading libraries for Lua (Lua Lanes, for example) and fire away a few background tasks. Whatever actions the background tasks need to perform with the buffers you'd have to serialize, but that shouldn't be all that difficult.

So long as any plugin script is running, vim will block waiting for it. And if you fire off a background process and exit from your main script, any reference to the vim environment within your child process becomes useless, so you can't modify anything in vim from within there anymore. I'm not entirely familiar with the lua scripting extension, but this was my experience attempting the same thing in python. I mean, at the end of it, vim is single threaded, and after your primary script exits its state is being used elsewhere - if you could modify it from your child process that'd be major cause for crashage.

That and who has lua on their system (I mean, i do for Love but that's irrelevant) or wants to install it just to use a git/hg plugin?

Post reply on HN