Debugging in Vim
dannyadam.com
dannyadam.com
The benefit is that you can copy data to/from it like any other Vim buffer.
It fits a certain workflow that some people prefer. If you don't consider alt-tabbing out of Vim to another window to be a big deal, it's probably not the workflow you're after, but for people like me who live inside a terminal and won't tab out for anything other than a web browser, it's useful. That said, I normally use another tmux window.
[1] https://ftp.gnu.org/old-gnu/Manuals/gdb/html_chapter/gdb_19....
It is much more powerful and productive though, reverse debugging and scripting offer far more power than just stepping through code in an IDE. It's probably possible to do that through vim, but at some point your basically using the CLI interface and have to learn GDB anyway.
[1] https://lists.gnu.org/archive/html/info-gnu/2019-05/msg00007...
peda is an excellent project that uses this to great success: https://github.com/longld/peda
All of that being said... it's really not very practical. (: But, it CAN be done, and it is done, I'm just glad I'm not the person doing it.
[0]: https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS.1...
Regardless of editor X, Y, or Z, this article is about a feature Vim received. I for one find it useful since, well, I use vim.
Given that for decades a primary draw for vi was that it was simple, the fact that people keep adding features to it until it's approaching where Emacs was a few decades ago is noteworthy. Noting that Emacs has had a certain feature for decades, and that the feature has been receiving bug fixes and adding still more sub-features is substantial.
Given that users of vim no longer seem to care about simplicity, one has to wonder: why stick with vim? Emacs has a far better extension language (elisp is to vimscript as a thermonuclear weapon is to a sharp stick), evil-mode can accurately replicate the vim editing experience, and Emacs has far more features and packages now than does vim.
It's a bit like preferring a race car to a van because you want speed, but then deciding you want to haul packages for a living and bolting on a 2-ton flatbed to the back of your race car. You end up wasting fuel and still not carrying as many packages as you could with a good van — and not running as quickly, either.
The first time I fired up emacs was in 1995 on a pentium 66 with 8 MB of RAM. It made my computer grind to a halt so editing text was not going to happen. When I tried vi, it ran like I expected a text editor to run.
So here I am today, my fingers long trained up to use vi, and I find little need to learn emacs. Sure emacs has had useful features for years, but the barrier to entry was just too high, and now it is too late to win over folks like me.
But I'm equally sure that if you made a habit of using e.g. spacemacs, you probably would not need to use it all the time either. But I guess I don't know your workflow. Why do you even use that buffer? I curse every time I accidentally open it.
Besides, as long as hitting the Escape key feels like sending messages in morse code I don't think I'll ever get used to it.
Emacs is the greatest application I’ve ever used, bar none. I’ve tried vim, and it doesn’t even come close.
Trying to adapt Emacs for me coming from Vim feels like recreating Alpine Linux by modifying an Ubuntu installation: it's pointless, cumbersome and feels insane.
The desire to include more and more in vim mirrors what people have done with emacs but I personally have no use for making vim anything other than a very fast and efficient text editor.
There’s a practical side to that - the biggest benefit of vi(m) is that it’s _always_ there, no matter where you’re shelled in to. However, their vi doesn’t have your plugins. So if you get used to using plain-vanilla vi, you won’t be lost when you sit down at (or ssh into) somebody else’s computer.
Why would you develop software over SSH is seriously beyond me.
Eg are you actually SSHing into your running docker containers to edit code? The only language that allows for it is PHP - because any other language is either compiled or needs modules to be reloaded.
Are you viewing large datasets in csv files through vim? - This can’t possibly work as vim requires them loaded into memory.
Are you editing config files on your servers using vim? - Do you not use automation to set everytting up on the servers?
no, not primarily
A few use cases:
1) I'm on a bastion host, and I need to knock up a script to run there
2) I'm working at home, and I don't want turn on the VPN, I SSH into my workstation and develop as if I was on the workstation
3) I need to change a conf/script/other because something is wrong, and the edit->commit->change config run-> test cycle is more than 2 seconds.
4) I'm in a container, debugging something and I want to edit a file (mostly python here so no need to compile) docker build-> run -> retry is painfully slow, and leaves loads of mess.
5) I'm working on a headless box somewhere or other.
6) I'm debugging on someone else's workstation
I only really work with vim in a terminal, so doing it over SSH isn't actually all that noticeable. It does gets to be a problem when the latency is > 200ms
I love that this straw-man argument pops up in every thread I read about editing text or IDE debate.
As someone who leverages SSH in their average work day I can explain my personal reasons. Let me be clear; this is likely not the way you work but it is how I work. I am not defending the merits of this for you but that they warrant my approval. If any debate is to be made in this it is that all users have a choice and those who prefer SSH should have every right to use it irregardless of any unemphatic assertions to the contrary.
I have a Linux desktop that has two very nice and pretty monitors. Given a choice I would wish my development to take place on that machine. However, the development I do is on a work computer that happens to be a small Mac Laptop (I don't get to choose the hardware I must develop on). Of all the different methods to edit files I found that SSH into the laptop from the Linux box to be the most efficient and eloquent solution while still keeping the work information on the work computer. I edit in Vim. I test with the browser running on the Mac. I can clearly see and manipulate the source on the pretty monitor while seeing the results on the little LCD screen.
Pairing like this is a huge win. Instead of Forcing a pair partner to wait for me to Alt-Tab the right screen they can connect via SSH (tmate.io) and on their end have their terminal on one monitor and the Zoom / screen share on the other. This way they can edit or watch and see the result without any ask to Alt-Tab. I can read the code while they look at the result. It is truly asynchronous code-pairing.