News for hackers. Stuff that matters.
Re:What I would do differently if I was learning to program ... by emodendroket on Monday July 09, 2018 @10:38AM (#17490453)
What inferior text manipulation capabilities?
Re:What I would do differently if I was learning to program ... by VonGallifrey on Monday July 09, 2018 @12:20PM (#17491345)
Every IDE or text editor I have ever used had very limited text manipulation and navigation capabilities.

The only exceptions are VIM and Emacs (and editors that follow that spirit, like Neovim).

Vim especially has an entire language of text manipulation and navigation features. This language is made up of actions (like c for change or d for delete), Motions (like hjkl for left, up, down, right respectively) and Repetitions. These elements can be combined into very powerful commands, especially since there are a lot of Actions and Motions that can be performed. This is made possible by the Modal Editing[1] that Vim provides. You would simply type these commands in "Normal Mode" and then you would be dropped into "Insert Mode" if necessary.

At first this might seem very silly or inefficient, but after a while it becomes almost second nature and is more efficient then using the mouse or pressing Arrow Keys 100 times. Especially if combined with the Macro capabilities and the Search Commands.

Some examples of this language:

Navigate 10 lines up: 10k

Navigate 10 lines down: 10j

Go to the beginning of the next Method: ]m

Change the word under the cursor: cw

Change the paragraph under the Cursor: cip

Change the inside of "" pair under the Cursor: ci"

Change a pair of "" after the Cursor: ca"

Change the inside of {} pair under the Cursor: ci{

Visually select the text from the cursor until the 3rd occurrence of the character x going to the left without selecting the x: v3Tx

Same thing, but going right: v3tx

Same thing, but going to the right and selecting the x: v3fx

Same thing, but change instead of visual select: c3Tx

Same thing, but do a rot13 "encryption" after selecting: v3Txg?

[1]: https://unix.stackexchange.com/a/57708

Re:What I would do differently if I was learning to program ... by timrichard on Monday July 09, 2018 @01:04PM (#17491693)
Been doing all that happily for years with IdeaVIM. And still retaining access to the things that are nice in a graphical environment.
Re:What I would do differently if I was learning to program ... by VonGallifrey on Monday July 09, 2018 @01:54PM (#17492105)
IdeaVIM is not good. I have tried it and for me it just pales in comparison to just vim. I can get all my IDE features in vim anyways.

I don't use java though, so maybe that would be different if I where using Java.

Re:What I would do differently if I was learning to program ... by emodendroket on Monday July 09, 2018 @01:01PM (#17491669)
This stuff is all supported by IDEs, though. e.g., https://github.com/JetBrains/ideavim
Re:What I would do differently if I was learning to program ... by VonGallifrey on Monday July 09, 2018 @01:33PM (#17491914)
These kind of Vim emulators are not really providing the full vim experience. Some come close (like Emacs Evil Mode), but most just don't. Most are just scratching the surface of stock vim.

Not even the vim experience when using plugins, just stock vim.

I tried ideaVim and while I do not remember what my specific problems where, you can read their ReadMe for a glimpse that they have a lot of issues still.

Even IF they would provide a decent enough vim emulation, why use something emulated when I can have all the IDE features in Vim itself.

Also: Vim plugins that provide IDE features are purposefully build with the way vim works. Providing advanced IDE functionality in a Modal Editing environment. This can not be said about an IDE with vim emulation. As far as I can see they implement those features as ":action <actionName>" which is so much worse then what vim can do.

IntelliJ + IdeaVim is simply a worse Text editor then Vim despite being significantly more bloated and slower and I would even say that Vim with plugins is a much better IDE as well (while STILL being less bloated and faster).

Re:What I would do differently if I was learning to program ... by emodendroket on Monday July 09, 2018 @04:00PM (#17492992)
I was always more of an Emacs guy so I can't speak to that specifically, but in your big list of examples there's nothing that wouldn't work, as far as I can tell.
Re:What I would do differently if I was learning to program ... by jrockway on Monday July 09, 2018 @11:05AM (#17490703)
I've always found basic text manipulation lacking in the GUI apps I've used. "Make this comment fit in 100 columns without losing paragraphs" "move the next line up to the end of this line" "go to line 647" "move the cursor to the beginning of this method" etc.

My knowledge dates from the "one keystroke to convert this to a JavaBean!" era, though. I'm guessing people don't do that anymore.

Re:What I would do differently if I was learning to program ... by emodendroket on Monday July 09, 2018 @11:16AM (#17490837)
I just have IntelliJ configured to use Emacs key bindings; vi ones are also available for people who use the wrong text editor.
Re:What I would do differently if I was learning to program ... by jrockway on Monday July 09, 2018 @11:43AM (#17491070)
The default Emacs keybindings are nice, but do the semantics transfer (mark/point and associated manipulation functions), and can you write your own functions? I don't have a _ton_ of custom elisp functions for raw text manipulation, but the ones I have written are useful and I wouldn't just give those up for no reason.

There are also a lot of dumb keybindings in Emacs that should not be copied by anyone (looking at you, C-u - 1 M-z X to delete all characters backwards to the first X.).

Re:What I would do differently if I was learning to program ... by emodendroket on Monday July 09, 2018 @01:00PM (#17491658)
The semantics are pretty good with the IDE I use most often, IntelliJ (for instance you definitely do have marks, there is a sensible kill-ring-like functionality for M-y, etc.). Writing a custom function is harder (I think you've got to write an extension, basically), but there are a lot of other useful things you can customize (making up your own templates, for instance). Also, the deeper understanding the IDE has of your code compared to Emacs lets it make many more useful suggestions for issues and potential refactors.