News for hackers. Stuff that matters.
Re:Two weeks with Vim by jhrobert on Monday November 15, 2010 @07:56PM (#1908608)
I am a wordstar guy, I started with CP/M...

For years I enjoyed Borland products, they used Wordstar key bindings.

And then one day it stopped working. I simply had to use the mouse.

I was shocked.

It took me years to recover. I hated it.

Call me a masochist, a few years ago I tried Emacs, it was the only editor with syntax enlighting for Ruby at the time.

Except it was not working, or at least it was not working for me.

I had learned a little bit of lisp however, so it was not a total waste of time.

A few ago I was so frustrated with my editor (Notepad++), that I decided to give Vim a try.

Well... I am french. I can tell you that using Vim with a french keyboard is hell. That, plus copy/paste with the mouse working erratically (that is: more or less depending on the current "mode")... I quickly got frustrated again.

And then, boom, my netbook's hard drive goes back to his creator and I am forced to switch to my Linux netbook. No more Notepad++ there. I am back with SciTe.

Now my friends, may be you will understand it better when I will tell you a little secret I am sligthly ashamed of:

  My project is mainly ONE big file, almost 12 000 lines of code, even the CSS that I used in in it.
No more buffers, no more windows, no more subdirectory to navigate.

Just one big file.

Heaven.

I wish I had seen the ligth before.

All I miss is a little post processor tool, with which I could define "sections" in my big file. Sections that it will dispatch into their own little files.

And when I will move to git, I will write it, and I will make it "bidirectortional", so that I can fetch back changed files, fetch them back into my BIG file that is.

One big file. Simplicity.

Don't worry, be happy.

Re:Two weeks with Vim by jamesbritt on Tuesday November 16, 2010 @01:23AM (#1909277)
A few years ago I was chatting with some fellow geeks, and, as often happens, we got on to ridiculing PHP developers.

Ha ha! Every PHP app is one big file! What losers. Yeah, we were having blast with these digs. But then I realized that, at least in some ways, this was an epic win. Have to go dig into some alien app? No worries; everything you need (or probably care about) is in the one big file. Need to deploy? FTP that one big file.

Seriously, maybe it's not as crazy as it seems.

The better approach might be for your editor to behave as if all code were one big file, when needed, and behave as if all code were nicely split out, when needed.

And have multiple files makes life easier when you're on a team and several people are touching different parts of an app.

But before rejecting something like this out of hand, consider what your needs really are, and if how you're doing things is really what's going to work best for you.

Re:Two weeks with Vim by jhrobert on Wednesday November 17, 2010 @05:00PM (#1915933)
I am in the process of implementing my proposal (JavaScript & nodejs). It will take a couple of days I guess. I'll keep the HN community posted.

We'll see who's crazy!!! :)

Re:Two weeks with Vim by akkartik on Monday November 15, 2010 @09:07PM (#1908773)
Upvoted because it's in interesting idea. But man, you're crazy :)
Re:Two weeks with Vim by jhrobert on Monday November 15, 2010 @11:46PM (#1909068)
Are you sure that "But" is the right word?

Thanks for the compliment anyway. :)

Re:Two weeks with Vim by olalonde on Monday November 15, 2010 @07:59PM (#1908620)
Uh? I thought the purpose of splitting code between different files was simplicity.
Re:Two weeks with Vim by jhrobert on Monday November 15, 2010 @08:06PM (#1908632)
It's a lie.

The true reason is purely historical.

Editor where just TOO SLOW to handle big files (on DOS they often were limited to 64kb, if not less)

Please note that I love "modular code", hence the notion of "sections" in my big file.

To clarify: I love to edit one big file, but for other purposes I definitely need small ones.

What I am basically proposing is that it is easier to edit multiple files from within a single window/buffer. But there exist no editors that do that AFAIK

I am not the only one, see this Python tool for Vim: http://coliveira.net/software/editing-multiple-files-in-a-si...

Re:Two weeks with Vim by seabee on Tuesday November 16, 2010 @12:48AM (#1909204)
Not quite true though, but again it's speed related (and this is very apparent in C++ projects). It has benefits when compiling a changed file. The smaller your file and the fewer things you include, the faster you can compile it and link it with the other (unchanged) objects.
Re:Two weeks with Vim by olalonde on Tuesday November 16, 2010 @02:54AM (#1909450)
What about source control, concurrent team work, external libraries, etc.?
Re:Two weeks with Vim by jhrobert on Wednesday November 17, 2010 @05:05PM (#1915946)
"sections" take care of that.

The "one big file" gets processed so that each section is kept in sync with a file.

Again: the idea is about make editing easier, it's an addition, your "one big file" is just a compound "view" over atomic files.

Re:Two weeks with Vim by gurraman on Monday November 15, 2010 @08:26PM (#1908681)
I too like to have code from multiple logical sections of my projects visible on the same screen at times.

Splitting windows in vim works nicely for this purpose.

Re:Two weeks with Vim by donaq on Monday November 15, 2010 @08:38PM (#1908722)
I can see how that would be useful, but I have a question. If you do edits in both windows, how do you save them? Do you just save in one window and reload the other?
Re:Two weeks with Vim by Periodic on Monday November 15, 2010 @09:07PM (#1908771)
In vim, when you have the same file open in different windows any changes immediately appear in the other window. They are the same buffer, there are just two windows to it.

You can see this by opening a file, and hitting "<Ctrl-W> <Ctrl-S>" to split the window. Do some editing and you'll see it in both places. ":ls" will show only one buffer. And if you have display of the buffer state visible, when you ":w" all the windows will update to say they were saved.

Re:Two weeks with Vim by donaq on Tuesday November 16, 2010 @01:30AM (#1909293)
Wow, I did not know that. I've always just assumed they'd be different buffers. I'll probably be using this a lot in future. Thanks!
Re:Two weeks with Vim by joe_the_user on Tuesday November 16, 2010 @12:00AM (#1909109)
Mice are an ergonomic nightmare.

I wonder if some smart lawyers could team with some physical therapists to create some massive lawsuits- force companies to offer mouse-alternatives for all their programs or something. The law's done much worse.

-- And I think I once cleaned-up some code based on the "one big file" principle...

Re:Two weeks with Vim by jhrobert on Wednesday November 17, 2010 @05:11PM (#1915965)
In the lab, they are making good progress with "mind controled" cursors.

If you can control the mouse cursor with your mind... what is the better solution to copy/cut/paste, a keyboard?

Given how long lawsuits can take, by the time a conclusion is reached, mind controled mouses will be there I guess. :)

Re:Two weeks with Vim by joe_the_user on Thursday November 18, 2010 @04:04PM (#1919240)
The "speed of thought" is essentially the limiting factor in most keyboard input presently.

A normal mouse move requires a lot more bits input to get the effect of several keystrokes and so a thought-controlled mouse would require "more thought" than keystroking requires.

But if you could get broad spectrum output - text, sound, pictures and video, a direct brain interface would be fabulous...

But remember, direct-brain output sounds great but the "high bandwidth outputs" we humans have now (our hands and mouths mostly), were "designed"/evolved as outputs and anything else will be "internal data" - not necessarily useful and quite possibly not what we'd chose to output. This could be overcome but I suspect this means direct brain output will not come a smoothly as one might expect (even with the immense progress of computers

As far as lawsuits go, if you started one now, it would change a lot of behavior even before it finished. And liability for past behavior still exists whatever the present situation is.

Re:Two weeks with Vim by jjcm on Monday November 15, 2010 @10:23PM (#1908889)
The man throws out an excellent plug in the article: vimcasts (http://vimcasts.org). Drew Neil (the man who creates/narrates them) does an excellent job of explaining not only the basics of vim, but also the intricacies of it as well. I consider myself a fairly seasoned vim user, but even I picked up a few tricks from his vimcasts. Try them out.
Re:Two weeks with Vim by Supermighty on Monday November 15, 2010 @09:45PM (#1908802)
I love VIM. It's my go to editor for everything. And as much as I love it I hate to admit that I was more productive using Eclipse when it came to a large-ish web project.

I tried using gVIM tabs, an buffers, and minibufexplorer, and Project, and ctags. Either I was doing it wrong or they just didn't want to work how I thought and worked.

So I'll lust after VIM and use it when I can, but I'll default to Eclipse when it comes time to work with a project set.

Re:Two weeks with Vim by kleevr on Monday November 15, 2010 @10:07PM (#1908846)
I'm running Ubuntu on my development machine, and I really enjoy VIM keybindings. I had a lot of trouble getting the key bindings to work in Eclipse, but jVi worked like a charm in NetBeans for me. (Needed a rich IDE for some Magento dev. Sometimes to make a 2-line change properly in the core involves making 3 dirs, 2 XML files, 1 php file. le sigh)
Re:Two weeks with Vim by kertap on Tuesday November 16, 2010 @03:37PM (#1911542)
I've been doing some ruby and php stuff at home and I mostly use vim. But when I go back into work it's back to java and eclipse.

I would love to use vim on my java work but I'd really miss eclipses background compilation and server integration.

Re:Two weeks with Vim by azim on Tuesday November 16, 2010 @04:21PM (#1911734)
Try Eclim for your java work. It's a set of vim plugins which run and communicate with a headless Eclipse instance in the background. This allows you use Vim as your editor and pull many of Eclipse's fancy features forward.
Re:Two weeks with Vim by apinstein on Monday November 15, 2010 @11:10PM (#1908997)
I just got TM-style command-T working on my vim setup thanks to wincent, it is a nice implementation: http://wincent.com/products/command-t

It was really one of the only things about TM that made me jealous :)

Also it taught me about <Leader> which I'd never even heard of before! Great way to keep your personal commands namespaced from stock vim.

Re:Two weeks with Vim by moe on Tuesday November 16, 2010 @06:25AM (#1909771)
For anyone interested I'd suggest to also look at FuzzyFinder. It does the same thing but is a little more advanced (real fuzzy search, also works on buffers, etc.):

http://www.vim.org/scripts/script.php?script_id=1984

Re:Two weeks with Vim by scorpion032 on Tuesday November 16, 2010 @02:26AM (#1909397)
I use vim, but not vim exclusively. Every single day, I use gedit, scite, scribes and an IDE - some times in the vi mode.

There is a cognitive load to switching between many editors. That is something Emacs users who always exist in Emacs do away with.

Re:Two weeks with Vim by xiongchiamiov on Tuesday November 16, 2010 @09:28PM (#1912659)
And vim users who only use vim don't?
Re:Two weeks with Vim by crazydiamond on Monday November 15, 2010 @11:48PM (#1909074)
To the author (and this has been posted to HN before but deserves a reposting for those who missed it):

http://stevelosh.com/blog/2010/09/coming-home-to-vim/

Re:Two weeks with Vim by olalonde on Monday November 15, 2010 @07:55PM (#1908607)
> I was more of an Emacs person

Are there really any benefit of switching from Emacs to Vim? I was under the impression that both editors were pretty much interchangeable.

Re:Two weeks with Vim by weaksauce on Monday November 15, 2010 @09:47PM (#1908808)
vim is more of a text editor that emphasizes a minimum of keystrokes to do things efficiently. Emacs is a text editor that is leans more to the IDE side of the spectrum with many cool extensions that make your life easier.(I am not saying vim doesn't have extensions just that emacs seems to use them more or has more of an emphasis to them) Both are excellent text editors. one will fit your style of living. use that one.
Re:Two weeks with Vim by FraaJad on Monday November 15, 2010 @11:09PM (#1908995)
Someone said on Stack overflow, "I use Vim for manipulating text, Emacs to do programming and Firefox to look at funny cat pictures". I agree with that assessment.
Re:Two weeks with Vim by _b8r0 on Wednesday November 17, 2010 @04:07AM (#1913549)
Vim is on pretty much everything, it starts up quickly, for rapid text editing it's pretty difficult to beat.

Emacs once it's up and running (in emacs server mode at least) is reasonably speedy but much more resource hungry and is an entire operating system.

To put it into perspective, I used org-mode for 6 months and loved it for that alone, but vim just works better for me as a text editor, YMMV.

Re:Two weeks with Vim by sole on Monday November 15, 2010 @08:05PM (#1908631)
We were taught basic programming with Emacs, connecting to an HP-UX machine. So we really didn't know much Emacs anyway :-)
Re:Two weeks with Vim by xiongchiamiov on Tuesday November 16, 2010 @09:30PM (#1912662)
It can be better for preventing RSI.

But mostly it comes down to a preference on how to do things.

Re:Two weeks with Vim by sero on Tuesday November 16, 2010 @01:42AM (#1909321)
Wow, I would love a personal Drew Neil (from VimCasts) to read me bedtime stories.

(Also, great site, I'm learning!)