Hacker News new | ask | show | jobs
by general_ai 3430 days ago
VSCode/Atom are great, but for most folks on UNIX they are worthless, since you have to use something else when ssh-d into another machine. So folks build these elaborate Vim and EMACS set-ups so that they could use the same editor and the same config on all of their machines, whether they're local or remote. Vim is an acquired taste, but once acquired, it's pretty awesome.
7 comments

Well this is your use case. I use Linux every day but I never touch python code directly on remote systems (it's getting automatically or manually deployed). All my python code lives in virtualenv locally here. But I understand when people work for many projects they maybe want to encapsulate it more (vagrant etc.).
Of course, use cases are different. In my case I usually deploy either automatically or manually, but in those rare cases when you can't replicate bug locally there is nothing better than vi. But of course, to each his own.
Debugging directly on the production system?

Yeah, nobody does that. Well, nobody who has any kind of serious operation going on.

If you can't replicate a bug outside a production environment you have a serious deficit in the devops department.

You should be able to stage a machine with a copy of the production DB/data and the same reproducible package(code) that currently runs on your production systems.

Everything else is just an accident waiting to happen.

> Debugging directly on the production system? Yeah, nobody does that.

Uh, what bubble are you living in? Almost everyone does that to some extent. We can all pretend we're code ninjas with super clean deployment pipelines and strict policies, but all of us get lazy occasionally.

Not to mention that, in any successful project, there are going to be systems that need to be looked at by someone else. It's great for the original developer(s) that they can use their IDE to access files directly in containers, but if I'm called to investigate a running system then I'm going to end up in a shell on those hosts.

The only place I can see this never happening is in large enterprises that have huge departments with slow enough turnover that "the accepted workflow" is easily passed on to new hires. Referring to everyone else as "mom & pop shops" makes it sound like the speaker is living in a Silicon Valley enterprise bubble.

I find it amusing to see that term used as an insult on a site largely populated by startups.

Sounds pretty self-serving to say that I "referred to everyone else", just because you want to justify sloppy processes. I only referred to those who do that, and I'm sorry if I'm bursting anyone's bubble here, but nope; not everyone does that!

Also a startup doesn't necessarily have requirements for serious ops, but it may, some day. Well if they want to be an enterprise at least. You do know what the goal of a startup is, don't you?

And btw, no I don't live or work for company in SV. Europe mostly, with a dash of Dallas, Texas in the mix.

In any case, I was hoping for engineering arguments, not personal attacks. :(

dont no
"Almost everyone does that".

No they don't. I am not living in a bubble. You're describing a mom and pop shop.

And by the way you don't have to be a code ninja or have a super devops team for that.

You can have your code locally, point your DB config to a staging server with a copy(you do backups daily, don't you?) of production and boom!

Seriously now... elementary stuff. If you're still changing code directly on live systems you have a long way to go.

And you're describing a pipe dream that doesn't happen in real engineering orgs. I think I can speak for most people here when I say that the best of DevOps intentions only last until your first fire. You can design for best practice, but odds are something will happen that requires you to jump onto a moving train and figure out what the hell is going on. That doesn't mean that DevOps is pointless, it just means that a dose of realism is required to understand how to do real engineering. Sometimes you just won't be able to do things the "right" way because you only have time to do them the "wrong" but still working way before your customer gets pissed. The real world has very different requirements than a management textbook.
Our host, Paul Graham, talks about his first successful startup sometimes. It's ViaWeb, now Yahoo Stores, and it made him the rich investor he is today.

He edited the code live on the production server sometimes. And he did it in the repl, not by editing source files, so he didn't even have a record of what he changed that could go into version control.

When you're nimble and you need every advantage to compete, sometimes you have to be able to do things the hard way.

Not that I would recommend it; every ethical programmer in the galaxy has denounced the practice. And they have good reasons.

>> in those rare cases when you can't replicate bug locally

> directly on the production system?

Why does 'non-local' have to equate to production? Are you able to use an IDE in your container/VM/cloud server?

Yes, PyCharm supports Vagrant, Docker etc.

My host system is Fedora but since our production code is deployed on Ubuntu, I have a Vagrant Ubuntu image. PyCharm reads the Vagrantfile and it has access to the virtualenv(python in our case) of the Vagrant's image.

UPDATE: I am not sure if that's what you were asking. Maybe this response(https://news.ycombinator.com/item?id=13543158) I gave is more relevant ?

That VM/container is still essentially a remote system. Do you never ever log in to it? What types of instrumentation are you using to characterize the performance and operation of your app in the dev instance?
My developer machines I have a neovim setup with a bunch of extra config and plugins, but when doing remote work I often have to use vanilla vi or vim.. and I just put up with it.

If I need to do something significant, i'll scp the file around. I know vim can edit over ssh, but I honestly never do.

I've never tried vscode, but I am tempted to try the remote support: https://github.com/DonJayamanne/pythonVSCode/wiki/Debugging-...

+1. I use VIM all the time on my remote servers, but never to dev.
I prefer console in general, for everything. I've been doing this for 20+ years, and you can pry it from my cold, dead hands.
I've only been coding for 11 years professionally, but also as a hobby before that. Only in 2016 did I move most of my work out of VIM into an IDE: the Jetbrains family. That mostly started for better interactive debugging, but with IDEAVim handling 95% of my VIMisms I find that I'm simply coding in PyCharm and PhpStorm by default now.

The base editor is open source but you can get the full PyCharm for $99 per year. Worth every cent.

I've used PyCharm. The editing feature is beyond useless to me, because it does not have vim key bindings. How am I supposed to cut and paste code when commands like "y}" don't work? You actually expect me to use a mouse to select things or move the cursor? Ridiculous.

The only thing I've found PyCharm good for is doing other functions, like linting, not for the actual code editing. No IDE is any good for that. Luckily, PyCharm works just fine when the code it's working with changes on the filesystem below it because of the use of an external editor.

There is VIM plug-in for Intellij family IDEs. It covers the great part of VIM functionality. It even supports some sort of VIM configs. "y}" works fine, as well as "yi{".
This sound you are trapped in vim keybindings. There is no need to use a mouse on "normal" editors.
"y}" works with IdeaVIM. https://github.com/JetBrains/ideavim
Console for everything is the same like saying I never touch console, only GUI. There is a usecase for everything... I also want to see how you manage a bigger Java project from console with your 20+ years of expertise.
What about Java development necessitates a GUI?

I've never found I needed to use a GUI for developing software, outside of a browser.

Working on a big legacy Java program spread over many dozens smallish files in deeply nested directory trees is very annoying without some IDE features (e.g. jump to definition). And I haven't seen a tool that can provide that kind of support for a classic text editor (Vim/Emacs). So you have to use an IDE (which necessitates a GUI).

To be fair, most other mainstream languages (except maybe Go) lack that kind of tooling too, but at least their cultures do not encourage liberal use of deeply nested directory trees and overengineered abstractions, the way Java does.

What? There are most certainly tools which provide jump-to-definition for vim/emacs.

With respect to vim, at the primitive end of the spectrum is ctags. At the opposite end there are things like the fabulous vim-go, which provides all the functionality that you'd expect in a traditional IDE. There are many similar plugins for other languages.

Regardless, I contest the idea that you have to use an IDE. I find traditional UNIX tools more than sufficient for programming in any language. I can find definitions with grep, use ctags and vim's chugger to manage definitions across many files in many directories. I'm also not limited to the scope of just one project. The tools I use and my expertise with them can then be applied to any language or problem. I use the same tools to write emails and commit messages.

Large legacy Java programs may be frustrating, but they're not all that bad, and certainly don't warrant requiring maintainers to learn and use an IDE.

Why not just run PyCharm on your local box and tunnel-via-SSH-and-pydevd to remote-debug your programs on the target system? You get (a) a full IDE running on your local system (no need to install anything on target system); (b) full debugging and breakpoints; (c) your choice of any "real" or "virtualenv" Python deployment on the target machine. Downsides are that your own source code on the local and remote systems need to match (for your step-through-code to make sense), and you need to set up mappings between directories with source code on the local and remote systems -- but that's a low cost for full visibility into how your program runs on the target system.
You could mount the remote machines filesystem over ssh with sshfs.

https://wiki.archlinux.org/index.php/SSHFS

I use supercomputers which only have a terminal interface. I found it was easier to do most of the development of the code on my machine with a GUI (e.g. Pycharm or VSCode) and then push code to the cluster for production runs. I use vim for minor adjustments, but it seemed way easier to just push code rather than configuring vim when something like VSCode is so much easier to get set up.
Thing is, you only need to configure Vim once, and then use your version controlled config everywhere for 10 years, very gradually improving it. I doubt VSCode will even exist in 10 years.
Are any of your plugins from 10 years ago still around? You can't compare naked Vim with VSCode.

Also, Visual Studio has been around since 1997 and there's no reason to assume, out of hand, that VSCode won't last as long, being both popular and Open Source.

I'm a Vim user, but cut the FUD.

> Are any of your plugins from 10 years ago still around?

Ctrlp, python (the filetype plugin), vimwiki... most of them honestly.

> You can't compare naked Vim with VSCode.

If you're doing C programming, it's probably close to equivalent out of the box. For Python development, you'll want to at least get the Python plugins; but you'll be doing that in most editors.

IMO, VSCode is interesting, but it's not that spectacular if you've been using any form of IDE (or a decent text editor with plugins). That is, it doesn't offer any major advantages over the other editors.

I'm pretty sure they'll still be around. They're all open source.
I don't even need to configure Visual Studio, and it's been around for 20 years.
VSCode seems to be great, Atom is mediocre and that is polite.
I know atom is easy to slow down with tons of plugins and extensions but why does it have a bad wrap? I am just curious because I've seen this sentiment but I find Atom has an amazing ecosystem of plugins it's not the editor for me mostly cause I came into it with Sublime that is what I personally like and now recently spacemacs but I'm curious
I have 20+ yrs of using vim. Tried numerous times to switch to emacs, I started using VSCode and love it. It's not useless, my vim skills is still handy. Logging in to servers to hotfix thing is no longer something to brag about. Cattle not pets. If I really need to login to a server to edit something, I don't need a fancy .vimrc. I don't code live on prod.
Modern GNU/linux filemanagers support connecting to ssh server and browse and open and edit files just like they are local. You can do it in two seconds.

In ubuntu it's file -> connect to server -> type in ssh://username@ip

That's it you are done. You can now browse the files as if they are local and use sublime/gedit/VSCode/Pycharm/whatever you want

I like this answer. For everyone who wants to do this by commandline: Search for sshfs and FUSE (also possible on Mac with osxfuse). Only be aware that a mac uses a different kind of utf-8 than unix. My command I use for sshfs on a mac:

  sshfs -o Ciphers=aes128-gcm@openssh.com -o Compression=no -o reconnect \
  -o modules=iconv,from_code=utf-8,to_code=utf-8-mac \
  myremote:/somedirectory/ /mylocalmountdir
I'm not familiar with Macs. How is their UTF-8 different from the normal one? How is such a thing even possible?
I also thought the same, you would not recognize it most of the time (even while transferring). But I'm german and I use sometimes Umlauts in filenames/directories. They did not showed up in my Samba share so I got aware of this issue. I think this issue is too hidden.

If you want to read about this topic:

rsync: http://askubuntu.com/questions/533690/rsync-with-special-cha...

sshfs: https://github.com/osxfuse/sshfs/issues/14

Plugins like https://atom.io/packages/remote-edit allow you to directly edit your remote code while still in the GUI. I still mostly use VIM, but its a nice alternative.