Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For some (myself included) the high speed and efficiency of proficient modal editing serves as a thinking aid, like sketching with a pencil and eraser. I tend "play" with the code: chopping it up; splitting lines and inserting a bunch of white space; duplicating lines dozens of times to act as placeholder values (e.g filling an array literal); renaming variables across a file many many times before settling on the right name; moving helpers functions to the top, then to the middle, then next to their first invocation etc.... All doable with other editing styles, but at a higher cost, and the cost of manipulation has to be very low in order to reap those meditative qualities.

Manipulation far outweighs input. And manipulation is fundamentally thinking, at least for me.



Personally, when I find myself doing the things you mention, I realize it's time to back off and refocus on the things mentioned in p-e-w's second paragraph. In that state, I feel I am fidgeting with the code, and it is probably because some unresolved issue is blocking me.


This is a great point that I never thought of. Seems like a general example of the idea that lowering the cost of some action sufficiently low can lead to not just efficiency gains in areas where that action is currently used, but also new and surprising uses of that action.

For example, I once read an economics book that characterized computers as lowering the cost of integer arithmetic by an extreme amount. That led to things like digital music/pictures - no-one would have previously thought of using a ton of numbers to represent a song - not just efficiency gains in accounting.


> no-one would have previously thought of using a ton of numbers to represent a song

Music has long been represented using math and math concepts. Musical notation is a cartesian plane with time on the x-axis and pitch on the y. But that's the representation, and it's not about the representation, it's the ability to manipulate at extremely high speed.


I see what you're saying, but musical notation isn't a precise representation of the audio. Given the same score, two musicians can produce very different interpretations. Perhaps I should have said 'audio' instead of 'song'. (I took classical piano exams as a kid, and at some point a group of us would perform our prepared pieces for each other as practice, and I remember always being surprised at how different everyone's pieces sounded. I'd thought mine was the One True Way!)


Claude Shannon showed that everything is just data, that's why it wasn't done previously. It seems obvious today, but wasn't always.


All of that can be done in JetBrains' IDEs with a single hotkey. Especially stuff like code extraction or variable/class/function renaming — it actually works reliably across the whole project (not just a couple of files) even if you have multiple functions with the same name. Extracting code to variables/constants/functions also works reliably (like automatically adding referenced data as function arguments).


Yes, but does it work the same way in Shell scripts, Ada, Haskell, Perl, Python, C#, screenwriting, and documentation?

The power of text-based manipulation is that you don't have to learn a different set of hotkeys for different types of material.


Yes, and also in CSS, SQL, ocaml, Rust, and a million other languages. Navigation works reliably (including cross-language navigation: for example, you can easily jump from a CSS class mentioned in HTML or JSX to its definition even if it's has a very generic name and is defined in a random file far away). Even if it has a complicated definition using something like SCSS and is simply not greppable.

Or do the reverse — find all usages of a CSS class from its definition (again: do so reliably, it's not a simple grep).

Find all references to a particular database column (in SQL queries across the project, foreign keys in other database tables, and ORM models)? Same hotkey.

Stuff like code selection works reliably since IDE work with code on an AST level and you're asking it to select the current AST node (and not the "current text block"), going up the tree as needed.

And so on.


> The power of text-based manipulation is that you don't have to learn a different set of hotkeys for different types of material.

And the weakness of text-based manipulation is that it views code as characters rather than as semantic data.

Modern IDEs either have their own semantic code operations, or use language servers to actually understand the code rather than just work with character strings. This is vastly more reliable when doing refactoring or project-wide navigation. Text-based approaches are a crude hack by comparison.


In Vim you also have plugins that provide you with semantic editing (e.g. via LSPs). You then have it both.. same as if you installed a Vim plugin in your IDE. The only difference being that the IDE is slow and has a multitude of features that I don't need whereas Vim is configured to exactly my needs and has instant response always.


Would you say that a vim plugin in your IDE of choice gives you the best of both worlds? The superior semantic manipulation of an IDE and the superior text manipulation of vim.


IDEs are incredibly slow. Even the fastest IDEs.


IntelliJ (the canonical JetBrains IDE) has plugins for the first 6 of those - so at least for those, it does work the same way. The hotkeys to perform the actions mentioned in the parent comment don't change.


TIL! There weren't so many language plugins last time I tried it, so I felt like I had to drop back into Emacs/Evil fairly often. Good to know that's not as much the case anymore!


I tend to use Vim/NeoVim regularly, and I really enjoy using IdeaVim when I use JetBrains' products. I get the fast modal editing and the IDE refactoring features. It's the best of both worlds.


Great point, /SEARCH_TERM and n is extremely useful for finding stuff and understanding. also when you screw up either because muscle memory went haywire or the logic looks bad then just uuuuu until the status bar (plugin) show no change since last save.


As opposed to other editors, which don't have shortcuts for search and undo?


Ctrl/CMD + Z vs u

Ctrl/CMD + Y vs r

There’s a significant difference in speed. But more importantly, the former requires RSI inducing finger gymnastics, whereas the latter is a tap of a fingertip.

The much faster speed but more importantly less complicated chords/key taps in VIM, leads to a qualitatively different editing/reading experience.


If your goal is to return to the state where you opened the file ":earlier 10m" might be more useful than spamming u.


totally agree. Also, when developing in complex codebases, being able to shorten the time distance between thinking an action needs to be done and actually doing it means you can keep more ideas in your head rather than spend your CPU cycles on visually moving around your screen, clicking, waiting, etc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: