Live data from Hacker News

Using Vim as a Python IDE

liuchengxu.org

131–140 of 158 posts

Re: Using Vim as a Python IDE

#131
post #30

Emacs comes configured with a command called "send-region-to-shell" that will take the current region and send it to a python interpreter. It makes for a great development experience that I haven't seen replicated with other tools and I'm not sure why there's not a bigger interest in it.

If I'm not mistaken, that's one of the features of Tslime[1], which is a Vim plugin that allows Vim to communicate with Tmux. [1]: https://github.com/jgdavey/tslime.vim/

Yup! There are in fact quite a few similar vim plug-ins that do the same.

This is one of the longest-standing line in my vimrc so far:

    Plug 'epeli/slimux'
Works best for what I do.

Re: Using Vim as a Python IDE

#132

Earlier quoted context omitted.

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.

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

Re: Using Vim as a Python IDE

#133
post #73

Earlier quoted context omitted.

But isn't it still easier to use a proper IDE in the local machine with Linux/Windows/OSX gui and then just git push the code? What advantages does your setup have?

Most 'proper' IDEs have no or terrible merge tools.

And terminal has better such tools?

Re: Using Vim as a Python IDE

#134

Earlier quoted context omitted.

You imply that vim is somehow technological inferior to some other tool. I take issue with that. I don't use vim because I have to or some silly 'vim everywhere' argument. I use it because it is a demonstrably superior text editing appliance. Every so often when vim irritates me I try out PyCharm or vm-whatsit, and while IDE's do have better viz for some use cases, the actual act of manipulating code in-buffer never…

I'm in the same boat. Local development only, my terminal is still my IDE. Other editing tools I've attempted and jumped back out of: PyCharm - No good vim emulation for editing Spacemacs - Soft locks, Ctrl-] doesn't follow the same word boundaries as Meta-. (which matches Vim's implementation) Sublime Text - Closest fit (enough that I own a personal license), but again, the vim emulation is pretty bad. Atom - Slow.…

I'm trying Neovim and it's the only editor I've ever tried that I like as much as Vim. Every other substitute has been inadequate.

Re: Using Vim as a Python IDE

#135
post #52

Earlier quoted context omitted.

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…

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.

Re: Using Vim as a Python IDE

#136

Earlier quoted context omitted.

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?

I can't characterize the performance of my app on a dev instance. I don't even think it's possible. You could characterize in the sense you do it for algorithms(with regards to time complexity). But in general this is my(our) process. - First I write the code. - Then I test the code locally. - Then I test the code on an instance with a copy of prod data. If I want to debug at this point, I run the web process locally…

> I test on a staging environment, that duplicates(as much as possible) the prod infrastructure.

I believe it's possible that nobody ever logs into any instances in the staging environment, but if that's the case then your organization is an exception to the rule. Plus you mention it's "as close as possible" to the prod infrastructure rather than identical.

The point is: don't act superior by feigning ignorance that most shops still have people who occasionally log into Linux hosts.

Re: Using Vim as a Python IDE

#137

Earlier quoted context omitted.

I can't characterize the performance of my app on a dev instance. I don't even think it's possible. You could characterize in the sense you do it for algorithms(with regards to time complexity). But in general this is my(our) process. - First I write the code. - Then I test the code locally. - Then I test the code on an instance with a copy of prod data. If I want to debug at this point, I run the web process locally…

> I test on a staging environment, that duplicates(as much as possible) the prod infrastructure. I believe it's possible that nobody ever logs into any instances in the staging environment, but if that's the case then your organization is an exception to the rule. Plus you mention it's "as close as possible" to the prod infrastructure rather than identical. The point is: don't act superior by feigning ignorance that…

Log into the machines to your heart's desire. I never said we never log in.

I said we never directly change code on production because it's bat-shit insane. That's why this thread was started. You can trace it back.

I never acted superior, but I really don't get the "me and some people I know do this so everyone must be doing it". No they're not.

And what I described in all my responses (not just to you) can be scaled down to this:

1) Do you know how to install a Linux machine?

2) Do you know how to install a DB?

3) Do you know how to take backups of your DB?

4) Do you know how to change your DB's config so that it points to other machines?

5) Can you write a shell script no more than couple lines?

You answered yes to all of the above? Then congrats you can already do what I'm describing. Yes, you can go crazy later with configuration software(ansible/puppet/etc) and better infrastructure, but the above will suffice as a first step.

So all this "haha, this guy is in his own SV bubble, haha"... yeah really not getting it, sorry.

Re: Using Vim as a Python IDE

#140
post #90

Earlier quoted context omitted.

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?
Post reply on HN