News for hackers. Stuff that matters.
Re:Neorg: Neovim 0.5’s answer to modern life organization by CA0DA on Sunday July 11, 2021 @05:15PM (#27804575)
I'm not very familiar with VIM - could someone explain what this is? Seems like some settings to make NeoVIM into a note-taking app?
Re:Neorg: Neovim 0.5’s answer to modern life organization by bloopernova on Sunday July 11, 2021 @06:03PM (#27804827)
vim is the "VIsual editor iMproved", which is an upgrade to the "VIsual editor". It works by having a text entry "mode" and a separate text manipulation mode. This is very powerful, but does take some getting used to.

For example, let's say you want to delete 5 lines: In visual studio code, you'd either select all the text and hit backspace, or maybe hold ctrl+backspace to delete whole words at a time. In vim, you'd hit escape to exit "insert" mode, then position your cursor at the beginning of the 5 lines to be deleted, and type "5dd" which means "delete a whole line, 5 times".

In the hands of an experienced vim user, it can make amazing edits to text in fractions of a second. It's really cool! It also works in a terminal, so it's available to you when you SSH to a remote server, for instance.

Org-mode is kind of like Markdown, in that it's a way for plain text to have structure. Something like this:

    * Birthday Party Plan
    ** INPROGRESS [#A] Buy cake
       Ask Jen about her baker friend's availability
    ** TODO [#B] Buy beverages
       Talk to Mike about his party and what people drank
    ** INPROGRESS [#A] Send invitations
       <DEADLINE 2021-08-10>
    *** DONE Design invites
    *** TODO Get Addresses
    *** TODO Mail merge
    *** TODO Print invites
Lots of stuff going on there! I'm tracking the state of each made up todo item. I've got a priority on the main todo items, and a deadline for one of them.

Org is note taking, scheduling, structured text, even running programs and scripts inside your notes and saving the results in the note itself. From orgmode.org: "Org mode is for keeping notes, maintaining to-do lists, planning projects, authoring documents, computational notebooks, literate programming and more — in a fast and effective plain text system."

So, all of that is being supported by NeoVIM now :)

I hope that helped, let me know if there's anything you want clarified or expanded.

Re:Neorg: Neovim 0.5’s answer to modern life organization by CA0DA on Monday July 12, 2021 @09:21AM (#27809950)
thnks!
Re:Neorg: Neovim 0.5’s answer to modern life organization by crubier on Sunday July 11, 2021 @06:32PM (#27804994)
To remove 5 lines in VSCode I would just type cmd-backspace 5 times. Don’t even have to count the number of lines beforehand. Just delete lines until it looks as you wanted. Much simpler than the complex process you describe, that involves counting lines and moving the cursor to the exact correct position.

As always, I am unimpressed by “vim tricks” that vim people always boast about. And I am yet to see a single real use case where vim is faster than good old basic keyboard shortcuts (that includes cmd-d)

Re:Neorg: Neovim 0.5’s answer to modern life organization by rgoulter on Sunday July 11, 2021 @10:52PM (#27806429)
This reads the same as the attitude which motivated the famous StackOverflow answer "your problem with vim is that you don't grok vi": https://stackoverflow.com/questions/1218390/what-is-your-mos...
Re:Neorg: Neovim 0.5’s answer to modern life organization by crubier on Monday July 12, 2021 @02:38AM (#27807711)
Absolutely not. My problem with Vim is I pair program with Vim experts on a daily basis and am annoyed at their slowness while they are proudly using their gimmicks. (Also the length and complexity of the answer you linked makes me laugh, and proves that a category of programmers is more interested in defending Vim than about making things people want)
Re:Neorg: Neovim 0.5’s answer to modern life organization by colordrops on Monday July 12, 2021 @02:50AM (#27807780)
They obviously aren't experts then. I don't know many people who can edit in a GUI as fast as a seasoned vim user. Maybe seen it twice.
Re:Neorg: Neovim 0.5’s answer to modern life organization by crubier on Monday July 12, 2021 @03:04AM (#27807826)
They have been using its daily at work for many years. And they are very competent and productive programmers.

It’s just that it’s tempting to find the “perfect” combo when performing complex tasks, and that takes time and mental energy even if you don’t realize this. Small time admittedly, but still present and cumulative.

Re:Neorg: Neovim 0.5’s answer to modern life organization by gorjusborg on Monday July 12, 2021 @05:08PM (#27815165)
I can't see how someone can use vi for more than a couple of years without doing most everything from muscle-memory. That's the dominant value-proposition, in my view.

That said, your attitude toward use of an editor is bizarre. If you want to use vscode, use it. If not, don't.

If you are trying to convince the world that your choice is the best, and anyone who disagrees is wrong, well, good luck with that.

Re:Neorg: Neovim 0.5’s answer to modern life organization by semi-extrinsic on Sunday July 11, 2021 @07:01PM (#27805203)
Delete until next matching parenthesis 3000-ish lines further down is a neat one. Or hex-edit a 5 GB binary. Or doing columnar editing with visual block mode.
Re:Neorg: Neovim 0.5’s answer to modern life organization by crubier on Monday July 12, 2021 @03:09AM (#27807853)
These do indeed sound cool. Too bad that most vim users I know face these use cases rarely enough that it takes longer to remember how to do these tricks rather than just do it in a normal IDE.
Re:Neorg: Neovim 0.5’s answer to modern life organization by pasabagi on Monday July 12, 2021 @04:16AM (#27808170)
Dunno. I'm about average and I use 'di(' or 'di{' like all the time. Not rocket science. One nice thing about vim is you basically don't need to remember 'tricks'. They're structured, so you can pretty much guess at a new trick if you want. For instance, d2w. Never used it before. Just used it. It deletes two words. Pretty useless, but the point is, it's not a trick - it's just an application of stuff you use all the time (delete, a count, a word object). Or like, dF. It deletes everything until the last dot. This is also obvious, because you use F all the time to jump to the last occurrence of a character. So 'delete till last dot' is just something you can make up or use without even noticing you're using it. I certainly don't know if I've used it before.
Re:Neorg: Neovim 0.5’s answer to modern life organization by unrealhoang on Monday July 12, 2021 @06:20AM (#27808840)
I haven't seen anyone identify themselves as vim user and don't know how to change text inside parenthesis or quotes with ci( or ci" or ci'. How is that rare in everyday programming? Or delete the entire function/scope with di{.

The limitation of non-modal editing is that you only have arrows and modifiers whereas you can have a whole vocabulary /language for yourself with modal.

Re:Neorg: Neovim 0.5’s answer to modern life organization by opan on Sunday July 11, 2021 @09:37PM (#27806039)
You could also hit dd several times or dd followed by a dot to repeat as needed. I wouldn't call them tricks. These are normal actions done in "normal" mode. You don't generally need key chords, which improves ergonomics, and many keys are mnemonics (like d for delete, c for change, etc.) It's not like finding out about a secret shortcut. You're using a ton of these in a smooth flow to do what you want at the speed of thought and with less finger contortion. If you wanted to be convinced, run `vimtutor` and complete the tutorial. It'll show you a variety of common actions.
Re:Neorg: Neovim 0.5’s answer to modern life organization by crubier on Monday July 12, 2021 @02:42AM (#27807730)
You mean “esc, d, d, ., ., ., ., esc” which is two mode changes, eight key strokes of three different types. Versus five identical key strokes with VSCode. Next.

Also define “smooth flow”. I my experience pair programming, by the time you are starting you command after choosing among all possibilities, I have already performed the change with VSCode.

Re:Neorg: Neovim 0.5’s answer to modern life organization by colordrops on Monday July 12, 2021 @02:54AM (#27807794)
No. First, you don't hit esc at the end to get back into insert mode, assuming that's what you mean - you'd hit "i". Also, it doesn't make sense to include mode changes since you don't know what mode you are in to begin with or what mode you want to be in when you are done. Lastly, this is all you need:

5dd

But as long as you are including preparation keystrokes, how may keystrokes would it be to get to a particular line in vscode? I guarantee it will be a lot more than vim. There are countless ways to navigate to a position in a buffer.

Re:Neorg: Neovim 0.5’s answer to modern life organization by crubier on Monday July 12, 2021 @03:08AM (#27807839)
I cmd-arrow + click on it on my MacBook trackpad if needed. Believe it or not, it’s actually really really fast, and in my experience faster than any vim trick.

The reason why it’s faster is that it’s a lower level task: I can just visually go where I want without even having to read contents or even line numbers, just based on text shape, don’t even have to think about it, it’s just muscle reflex.

I don’t have to (consciously or not) plan a strategy choosing the best way among 5 different ways each time I want to select text. And no, this never becomes a true reflex. If it does then it’s just because you always choose the same strategy. You always have this part of your brain that has to think about vim tricks, and believe me, we can see that from the outside.

Re:Neorg: Neovim 0.5’s answer to modern life organization by opan on Monday July 12, 2021 @06:40AM (#27808938)
If you really use vim, you typically are "always" in normal mode. When you want to type text, you go into insert mode, and you leave it when you're done. If you sit around in insert mode, you miss out on a lot of utility.

>Also define “smooth flow”. I my experience pair programming, by the time you are starting you command after choosing among all possibilities, I have already performed the change with VSCode.

There's really not much thought involved. If you can imagine yourself using keyboard shortcuts, it's probably pretty similar. In a simple example, you don't think "I gotta hold ctrl, press c, release c, and then release ctrl", you just think "I'm going to copy this". I think you have the idea that vim is really complicated and its users must be bogged down and thinking more. At worst I would say it's probably the same as what you have now, unless you count very early stages where you actually just don't know your way around too well. When you're situated and experienced, it's not ever slower in my experience. On the contrary I feel a bit disabled when I have to edit in something without vim keys. It's not like I can't jump around with home/end and select text with ctrl-shift-arrows and whatnot, but it doesn't feel as fast or comfortable or natural to me.

Re:Neorg: Neovim 0.5’s answer to modern life organization by Ancapistani on Sunday July 11, 2021 @06:43PM (#27805075)
> And I am yet to see a single real use case where vim is faster than good old basic keyboard shortcuts (that includes cmd-d)

I feel like I’m far from a vim “power user”, but people regularly comment on how quickly I edit text and code when I’m doing a screenshare. It becomes second nature in short order, so I’m never thinking about some multi-step process to before an edit; I just “do it”.

As for the “5dd” example… there are multiple ways to do things. For me, that would likely be:

* navigate to the first or last line of the block

* <shift+V> to start a selection of whole lines.

* navigate to the other extreme

* <D>

Re:Neorg: Neovim 0.5’s answer to modern life organization by iimblack on Sunday July 11, 2021 @06:54PM (#27805153)
In vim you would actually just do 5dk to delete 5 previous lines. Or just do dk to delete one line, then . to repeat until satisfied.

So you get an easy way to repeat actions. You can make this into a macro easily if needed.

Then, most importantly in my opinion, you keep your hands in the normal typing position. The command key is awkward for me to reach and hurts my hands.

Re:Neorg: Neovim 0.5’s answer to modern life organization by parafactual on Sunday July 11, 2021 @07:12PM (#27805284)
Even with the example you mentioned - cmd+backspace 5 times vs. "5dd" - I'm surprised that you can't see why some people would prefer the latter. (Also, if you're on the last line, I think "4dk" works.)
Re:Neorg: Neovim 0.5’s answer to modern life organization by phailhaus on Sunday July 11, 2021 @09:28PM (#27805991)
I agree, the "5dd" example is super contrived, though not as much as you think. In vim, you can have the line numbers on the left show you numbers relative to your current line, so you never really have to count, you can just look at the number on the line you want to go to.

But outside of that, the problem with standard editors is that none of your keyboard shortcuts compose together. You have special shortcuts for deleting lines vs deleting individual words. No shortcut for copying objects to your clipboard. No shortcuts for "get me what's within these parens". You can't move between panes with consistent keybindings, because most editors represent code panes vs directory panes differently.

Vim lets you think of editing and navigating your code in terms of verbs and objects, and treats everything consistently. Take the "w" object, that's "word". Now I can move around by word by mashing "w", I can delete with "dw", change with "cw", yank to clipboard with "yw". The "." command lets me repeat, so I can do things like "dw..." and delete more easily. Some plugins add more objects, like being able to refer to surrounded text (e.g., in parentheses.) They compose with all the verbs you already know, so now I can delete inside parens, surround with parens, replace text within parens, copy in parens, etc.

Vim compared to standard text editors is like functional vs imperative programming. It works best for code, because editing code is not like writing prose. You're manipulating a syntax tree.

Re:Neorg: Neovim 0.5’s answer to modern life organization by crubier on Monday July 12, 2021 @03:01AM (#27807816)
Thank you for this explanation. It makes sense. But still, I find that vim is overcomplicating things for no good reason. What happened to KISS? Like every time I make this sort of remark, the thread becomes a thread about vim people debating that actually typing dd multiple time is better, or that dk could do the trick, or that select text followed by d is better, or that d% does the trick, or soon someone will share their custom shortcut that address this particular case, etc. Vim people have to think about Vim way too much.

Meanwhile, keyboard shortcuts on a Mac do compose: arrow=Move, shift-arrow=Select, arrow=a character at a time (or vertically, a line), shift-arrow=a word at a time (or vertically a paragraph) cmd-arrow=the whole line (or vertically the whole file).

Also cmd-d has immense powers when you know how to use it.

And finally let me mention that syntax-aware editing is overrated when you use a linter/formatter because regular indentation and normal shortcuts work flawlessly already.

Last but not least: these shortcuts work system wide! So we don’t have to reimplement every possible software within my text editor so I can use these shortcuts.

Re:Neorg: Neovim 0.5’s answer to modern life organization by phailhaus on Monday July 12, 2021 @09:48AM (#27810225)
It's not like you _need_ vim to edit code. If those are the only shortcuts you need, then you don't need vim! It's just very useful for power users, especially with the huge plugin ecosystem. Instead of each plugin adding its own shortcuts, they often compose together with what you already know to make editing even easier.

> syntax-aware editing is overrated when you use a linter/formatter

Not quite what I'm talking about actually. Going back to the theme of "code as syntax tree", when editing code you'll often find yourself needing to do things like "ah I should hoist the code in this paren block into its own variable." Vim lets me operate on that syntax level, which feels more reliable to me than using the mouse to carefully select text. I just tell it to delete in parens (which automatically pulls it into a register that I can paste from), move to a new line, paste with "p". When I edit code it's less about individual characters and more about moving blocks of logic around, which is super important for refactoring safely. I end up making fewer mistakes with vim.

Re:Neorg: Neovim 0.5’s answer to modern life organization by paraknight on Sunday July 11, 2021 @06:50PM (#27805118)
There are many ways to skin a cat. Personally, in vim, I would do "dj" or "dk" twice, (deletes two lines up or down respectively) and then dd for the 5th one. Where vim shines is where you can just naturally start stringing together "sentences" of vim vocabulary and you can do what you mean. The macro system allows you to store these commands on the fly and replay them too.
Re:Neorg: Neovim 0.5’s answer to modern life organization by bloopernova on Monday July 12, 2021 @07:22AM (#27809164)
It looks like your comment spawned a lot of discussion!

I chose the "delete 5 lines" example because it was simple; the person I replied to said they weren't familiar with vim, and I didn't know how familiar they were with editors and code in general.

I think that perhaps you jumped to the incorrect conclusion about that part of my comment. I didn't impugn or insult visual studio code, nor try to insinuate that vim is better. In fact, I use vscode every work day for my devops day job, alongside Emacs for my org-mode documents, and vim for remote editing.

For counting lines, in vim I generally don't do that. If I have, say, a couple hundred lines to delete then I use something like 50dd a couple of times. Once I'm close to the end of what I wanted to delete, I just use dd followed by . to repeat that dd.

There's more than enough space in the world for multiple text editors! It doesn't really have to be a competition.

Re:Neorg: Neovim 0.5’s answer to modern life organization by jandrese on Sunday July 11, 2021 @10:31PM (#27806321)
There are loads of other tricks. For example, say you have discovered that you need to delete an entire block of code. You could position your cursor on the opening or closing brace and type d$. This sounds arcane when you hear it (and to be fair it is to a degree), but once you realize that it's just a combination of navigation and action most of it becomes obvious.
Re:Neorg: Neovim 0.5’s answer to modern life organization by bradrn on Sunday July 11, 2021 @11:05PM (#27806506)
Did you perhaps mean ‘d%’? IIRC ‘d$’ deletes to the end of the line.
Re:Neorg: Neovim 0.5’s answer to modern life organization by jandrese on Monday July 12, 2021 @10:28AM (#27810638)
Of course I fat finger the example. LOL.
Re:Neorg: Neovim 0.5’s answer to modern life organization by crubier on Monday July 12, 2021 @02:49AM (#27807772)
Lol, exactly making my point thank you
Re:Neorg: Neovim 0.5’s answer to modern life organization by bradrn on Monday July 12, 2021 @04:45AM (#27808328)
Quite the converse, in fact I use vim mode whenever I can; I would struggle to think of a better way of editing text. (My current editor is Emacs+evil and I don’t anticipate changing it any time soon.) I strongly suspect GGP’s post was simply a typo, as ‘%’ and ‘$’ are right next to each other on the keyboard. And if I were to make that typo while editing a real document, I would need only the three keystrokes ‘ud%’ to undo it and then do the editing action I originally meant.
Re:Neorg: Neovim 0.5’s answer to modern life organization by cercatrova on Sunday July 11, 2021 @05:22PM (#27804607)
org mode in emacs is a very popular note-taking tool. This seeks to emulate and refine it for (neo)vim.
Re:Neorg: Neovim 0.5’s answer to modern life organization by CA0DA on Monday July 12, 2021 @09:23AM (#27809966)
Thanks!
Re:Neorg: Neovim 0.5’s answer to modern life organization by slightwinder on Sunday July 11, 2021 @06:07PM (#27804853)
Looks like another iteration of someones personal markup-flavor, aimed at task-managment for self-organization. Basically, a todo-list in text-form.

But I don't see anything worthful yet which makes this flavor preferable over org-mode or markdown. Seems to be also still very in progress. So give it some more years to grow I would say.

Re:Neorg: Neovim 0.5’s answer to modern life organization by zelphirkalt on Sunday July 11, 2021 @06:44PM (#27805079)
Markdown and Org are not in the same league. However, the goal is to have something like Org in (Neo)Vim. It will take a while, if it ever happens to get to feature parity with Org though.

Edit: I would welcome though, if Org was supported well in (Neo)Vim. Then there would be one less excuse not to use it.

Re:Neorg: Neovim 0.5’s answer to modern life organization by slightwinder on Monday July 12, 2021 @05:51AM (#27808677)
> Markdown and Org are not in the same league.

I don't think so. Their focus and culture is different and so each has different tools available, but syntax-wise they are pretty much the same and you can overall build the same tools for both.

Re:Neorg: Neovim 0.5’s answer to modern life organization by zelphirkalt on Monday July 12, 2021 @07:59AM (#27809386)
Org comes more like an interconnected ecosystem, while in Markdown, you will have to choose your tooling wisely and will still not be able to do all the things you can do in Org. A few examples:

Export to many formats. Emacs ox-... packages. Hit C-c C-e there you go. In Markdown there is no integrated tool for that, there is only the rather excellent Pandoc, but Pandoc itself suggests its own Markdown dialect (! not what we are talking about here) for things like footnotes and quotes and such things, which are required for technical writing.

Running code from Org files in Emacs is, thanks to the Emacs integration of Org, a simple thing to do, once you got an interpreter / compiler installed and configured appropriately. This in conjunction with noweb (oh, did I mention that one?) enables literate programming. Yet another case of needing a specialized markdown dialect.

LaTeX in Org mode documents is possible and the format takes precautions to enable you to do anything you want using LaTeX in an Org file. In Markdown it depends again on your Markdown processing tool. Again Pandoc to the rescue, mostly.

Things like the already mentioned footnotes and citations and quotes. Some of that stuff is not available in Markdown. You can merely patch something up using HTML or, if you use Pandoc, perhaps you can add LaTeX to your document. This becomes a necessity, rather than a choice like in Org, because Org supports these things.

Document internal linking. In Markdown you can again only patch it to full capability by using HTML. In Org it is included in the format.

Tables and spreadsheets. You need special markdown dialects for that, which have special processing tools, which can then do half the things you can do in Org using spreadsheets.

You can probably somehow shoehorn all of that into some kind of markdown dialect or multiple ones and process it using multiple external tools. It is just not there in normal Markdown and you will have to build the whole chain yourself or use some obscure tool, that has already showhorned it all. So Org and Markdown are really 2 different kinds of beasts. For more details you could join the Emacs-org-mode mailing list, where people all the time come with tricky questions and use-cases they are using Org for. Quite an active mailing list.

Re:Neorg: Neovim 0.5’s answer to modern life organization by slightwinder on Monday July 12, 2021 @08:54AM (#27809728)
You're missing a bit the point. Markdown is today a family of flavors and tools, not just the original format made 2 decades ago. Yes, not all flavors have the same syntax, not all tools have the same abilities. Markdown-family today is quite chaotic, but also moving and consolidating. It's constantly evolving and moving forward. And while org-mode in it's single-app-cage provides a better offer in it's specific focus of abilities, markdown is not worse in general and also beats org-mode in other aspects.

And in the meanwhile we also have tools emerging which start to beat org-mode&emacs even in their own strong points. One crucial apsect here is that markdown never had the strong focus on task-managment that org-mode had. This changed in the last years.

Re:Neorg: Neovim 0.5’s answer to modern life organization by zelphirkalt on Monday July 12, 2021 @08:24PM (#27816572)
Hmmm. You are not really bringing any examples and we have moved the goalpost to all markdown dialects in existence and call it "markdown family" now. I think you will have to be more specific there to convince me.
Re:Neorg: Neovim 0.5’s answer to modern life organization by _benj on Sunday July 11, 2021 @06:33PM (#27805002)
In my opinion is the creation of an actual alternative to emacs, but more modern and simpler using lua instead of (e)lisp.

I have nothing against emacs but being a fan of vim and of simpler systems I'm a fan of what I'm seeing being done with NeoVIM!