r/programming • • Sep 24 '15

Vim Creep

http://www.norfolkwinters.com/vim-creep/
1.2k Upvotes

844 comments sorted by

View all comments

Show parent comments

39

u/sethamin Sep 25 '15 edited Sep 25 '15

Sure. Just with more keystrokes and a meta key.

79

u/fermion72 Sep 25 '15

I'm a Vim guy. I teach an introduction to computer science course to 300 students. Last week I suggested that they all use emacs because I figured (1) insert mode screws with beginners and ctrl-x,ctrl-c is easy to learn, and (2) it will get me to learn emacs.

I'm in emacs hell right about now -- "Okay guys, to cut/paste, do ctrl-space, then select, then ctrl-y...I mean ctrl-w. Oh, and your Macs don't automatically map the Meta key, so you have to use ESC instead, but you don't hold down ESC like ctrl..." That fact that yank means exactly the opposite in emacs and Vim is boggling. Grr.

168

u/[deleted] Sep 25 '15

I am going against my own personal feelings here, but why not just tell them to use notepad++ or an ide for whatever language they are using. For intro computer science you really don't need a good text editor, you need just the basics. Some will naturally gravitate towards them over time.

83

u/[deleted] Sep 25 '15

I concur. It is such overkill to be teaching emacs/vim in comp sci 101. Why not just let them know about the options out there?

15

u/fermion72 Sep 25 '15

Oh, we do -- we had an entire 1.5-hour extra session to just give them a taste of different editors available for their own computers. But, it's nice to have everyone on the same page (esp. in a lab setting), and I also think it is important to learn a tool that is available for virtually every computing platform ever built.

10

u/kqr Sep 25 '15

Oh, so... Vim? ;)

→ More replies (1)

20

u/myhf Sep 25 '15

Because paying teachers properly is harder than convincing teachers that their "ideology" and "passion" are rewarding. But of course the important parts of the curriculum are already decided, so if you want to communicate any of your own ideas, you'll have to limit them to trivialities like whitespace formatting and text editor choice.

28

u/DevestatingAttack Sep 25 '15

Also, by teaching these things right off the bat, another huge batch of junior programmers can immediately become useful in the burgeoning Reddit industry of arguing about tabs vs spaces! And I'm sure that there's nothing at all similar between using Vim because it's more authentic, and sporting the hipster-lumberjack look.

15

u/cittatva Sep 25 '15

:set tabstop=4 :set expandtab Or gtfo

→ More replies (3)
→ More replies (11)

16

u/Sluisifer Sep 25 '15

There's only so much mental overhead space for learning new things. Don't clog it up by doing too much at once.

One of the things I like about the Learn ____ The Hard Way stuff is that he says just use Notepad++ or equivalent. Get some syntax highlighting and that's it.

9

u/[deleted] Sep 25 '15

For me syntax highlighting is probably the most important feature for most languages. Code completion, error checking, code suggestion is nice for large projects in languages like Java, but honestly if I am whipping something up in Prolog or something small in Common Lisp, just give me syntax highlighting and I will be fine.

→ More replies (1)

11

u/fermion72 Sep 25 '15

It's a bit complicated. The server that has their files is a Linux (Red Hat) server, and we like them to work on the files via the server. So, unless we get them all set up with a local editor and teach them how to load/save files through SFTP (e.g., Notepad++ for Windows, TextWrangler for Mac, Sublime, etc.--by the way, about 90% of the students have MacBooks), we have to get them to use an editor available on the department's Red Hat system. Available editors include Vim, Emacs, Kate, GEdit, nano, etc., but the "easy" ones are graphical. Not really a problem, because they can ssh with the -X flag. That is, not a problem until they realize that the school's wireless network is feeling its age, and can get bogged down really quickly. Ever try to use X-forwarding on a slow wireless connection? It blows.

So, I decided that we'd coax them towards a non-graphical editor, and of the choices, emacs seemed reasonable. I'm learning it, and the students are learning it, and most of the time they can use emacs in windowed mode, anyway (when the connection is decent).

I'm preparing to jump into this whole "buffer" idea, but I'm a bit afraid...

15

u/[deleted] Sep 25 '15

Buffers are easy. They're basically just browser tabs before tabs existed.

7

u/Skyler827 Sep 25 '15

Why do you need them to work on the files on the server? Why can't they just run the software on their own machines, and submit to a school server when they're done? Are you teaching sysadministration or computer science?

6

u/fermion72 Sep 25 '15

It's pretty much a standardization issue. Yes, they're not doing anything that won't port to standard C++ compilers, but there are a number of headaches with getting a command-line compiler on Windows (e.g.), and I want to give individual attention to students on important things, not on "this is how you install MinGW, etc." Also, we want them to learn and be comfortable with a Linux terminal, so we have them use Linux on our server. The intermediate courses quickly go deep, and most are not Window or Mac friendly given the course material.

It is much more about the system than the editor (and of course I let them use any editor they want--I don't promise to help with support of they can't get things to work exactly). When you scale to a class of 300, you have to be judicious about your resources.

→ More replies (1)

4

u/DJTheLQ Sep 25 '15

sshfs perhaps? Means any editor on *nix can be used without special SFTP plugins. If they already know SSH then it's essentially the same thing usage-wise.

4

u/fermion72 Sep 25 '15

Yes, I've shown students sshfs before. I agree that it works well.

6

u/roerd Sep 25 '15 edited Sep 25 '15

Also, Emacs with its own GUI is better than Emacs on a terminal. Emacs has its own system for editing remote files called TRAMP.

→ More replies (1)
→ More replies (2)
→ More replies (6)
→ More replies (6)

7

u/arctander Sep 25 '15

If I may, a few things for teaching emacs:

  • The built in tutorial accessible via C-H t which works well only in 80x24 size windows :-(

  • Emacs in two pages just the first two pages of that page, not the seminar notes

Emacs is my go to editor for programming and writing a document of any significant length. Vi and it's cousin Vim, are there for anything quick and dirty. A modal editor just seems like 1979 or earlier.

The other thing that has been so darn handy with Emacs is its portability. I've run it under DOS (Lugaru Software version), VMS, Pyramid SysV, SunOS, MIPS OS, Linux, all the Unix's, Windows, Mac, and have never had to re-learn how to edit on a platform. I'm sure Vi/M is portable too these days. Anyway, its turtles all the way down.

→ More replies (1)

20

u/austingwalters Sep 25 '15 edited Sep 25 '15

I'm glad to hear you suggested/told them to learn emacs. I've used both, but settled on Emacs while I was still in high school. It was always what I perceived as the most "hard core" programmers using. It taught me about lisp, and what not all before I entered college. More importantly, this decision helped me dramatically when I started a job after college.

When I started my first job after college there was a group of 13 of us, all just hired, and we were working with a director to "source" us (assign us to teams). Prior to assignment we were getting all the software we needed setup on our nice shinny new macs.

One question from the director was,

"what IDE's/text editor do you guys need?"

We went around the room:

"Sublime!", "IntelliJ!", "Eclipse!", "Sublime!", "Eclipse!", "Eclipse!", "Emacs!" ... silence

The director stopped the conversation, looked at me, and said:

"You've told me all I need to know"

The next day, I get placed to mentor several of the new hires (I also was the only one who new Rails, which was necessary for our project). Within a year I was promoted and officially a technical lead for a pretty large team at 23.

About a month after my promotion the director (now a VP) comes up to me at a Christmas party. Shakes my hand, congratulates me on the promotion, and tells me:

"I knew you could go far. If you can bend emacs to your will, you can do anything"

Quite honestly, I find the reality of things hard to believe myself... Truly, knowing emacs and the perception around it has put me in a great position already in my life. I'm definitely good at my job, but it's knowing emacs and using it in work, school, and every-day-life that put me in the position I am in.

Sure, it's hard as hell to break that learning curve (hell, I'm still learning), but if you can overcome it people often will respect you more. Plus, my favorite thing is writing my own modes. I keep my own version of github-style stats, logging my productivity in emacs (lines created/destroyed), auto run tests, send emails, format invoices, it's really amazing.

Anyways, thought I would share why I think it's great you're teaching the class emacs.

Edit: Grammar

11

u/Deathspiral222 Sep 25 '15 edited Sep 25 '15

I don't understand this thinking. It sounds like you were doing a lot of Java (thus the Eclipse and IntelliJ references) and honestly, an IDE is better than emacs or Vim when it comes to refactoring large codebases written in Java.

As a trivial example: take any large open source project written in Java and try to rename all references to a SPECIFIC function called foo() in emacs. There may be a dozen foo() functions in the codebase but we just want to refactor this particular name (hopefully to call it something other than foo().

This kind of thing takes two keystrokes in an IDE and it can take hours in an editor that doesn't understand the context of a language.

EDIT: I say this as someone who has a 600 line .vimrc file from years and years of tweaking, so I understand the value of vim/emacs.

2

u/austingwalters Sep 25 '15 edited Sep 25 '15

At the time we weren't assigned to a project. I actually work heavily in Ruby Rails and Golang.

Also, regardless of the language you should be able to use

M-x semantic-mode RET

Then you can open all references and rename.

It's more than two clicks, but it's like 5 commands.

Obviously, I will use IDEs where it makes sense. Xcode for iOS is a must, IntelliJ for Java, etc. I was just pointing out you can do what you mentioned in emacs.

→ More replies (6)
→ More replies (5)

0

u/[deleted] Sep 25 '15

[deleted]

15

u/austingwalters Sep 25 '15

Indeed he does. However, apparently he didn't use emacs himself, he was a originally a vim guy.

Based on my experience, this is a lot more common than you think. It's like telling someone you learned/know Chinese. It may not matter all that much for your day-to-day activities, but it does shed light onto how driven/motivated you are and that you can stick with things.

→ More replies (3)
→ More replies (1)
→ More replies (6)